TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
import sys
n, m = map(int, input().split())
a = []
for i in range(n):
  a.append(list(input()))
b = []
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:i+m][j:j+m] == b:
      print('Yes')
      sys.exit()
print('No')


import sys
n, m = map(int, input().split())
a = []
for i in range(n):
  a.append(list(input()))
b = []
for i in range(m):
  b.append(list(input()))
for i in range(n - m + 1):
  for j in range(n - m + 1):
    if [c[j:j+m] for c in a[i:i+m]] == b:
      print('Yes')
      sys.exit()
print('No')


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import numpy as np

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

As = np.array([["." for n in range(N)] for nn in range(N)])
for n in range(N):
  As[n,:] = np.array(list(input()))
  
Bs = np.array([["." for n in range(M)] for nn in range(M)])
for m in range(M):
  Bs[m,:] = np.array(list(input()))
  
ok = False
for i in range(N-M+1):
  for j in range(N-M+1):
    print(As[i:i+M,j:j+M])
    print()
    if (As[i:i+M,j:j+M] == Bs).all():
      ok = True
      break
if ok:
  print("Yes")
else:
  print("No")


import numpy as np

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

As = np.array([["." for n in range(N)] for nn in range(N)])
for n in range(N):
  As[n,:] = np.array(list(input()))
  
Bs = np.array([["." for n in range(M)] for nn in range(M)])
for m in range(M):
  Bs[m,:] = np.array(list(input()))
  
ok = False
for i in range(N-M+1):
  for j in range(N-M+1):
    if (As[i:i+M,j:j+M] == Bs).all():
      ok = True
      break
if ok:
  print("Yes")
else:
  print("No")


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

if n == m:
    if a == b:
        print('Yes')
    else:
        print('No')
    exit()

for i in range(n-m+1):
    for j in range(n-m+1):
        c = [l[j:j+m] for l in a[i:i+m]]
        print(c)
        if c == b:
            print('Yes')
            exit()

print('No')

n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

if n == m:
    if a == b:
        print('Yes')
    else:
        print('No')
    exit()

for i in range(n-m+1):
    for j in range(n-m+1):
        c = [l[j:j+m] for l in a[i:i+m]]
        if c == b:
            print('Yes')
            exit()

print('No')



Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int,input().split())
A = [str(input()) for _ in range(N)]
B = [str(input()) for _ in range(M)]
 
res = "No"

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):
        res="yes"
          
print(res)

N, M = map(int,input().split())
A = [str(input()) for _ in range(N)]
B = [str(input()) for _ in range(M)]
 
res = "No"

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):
        res="Yes"
          
print(res)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from sys import exit
n, m = map(int, input().split())
s1 = " ".join([input() for _ in range(n)])
s2 = [input() for _ in range(m)]
flag = True

i = 0
while i < m:
    try:
        if s1.count(s2[i]) == 0:
            print("No")
            exit()
        ind = s1.index(s2[i])
        s1 = list(s1)
        del s1[ind]
        s1 = "".join(s1)
        if s1[ind+n+1:ind+n+m+1:] == s2[i+1]:
            i += 1
    except:
        print("No")
        exit()
print("Yes")

from sys import exit
n, m = map(int, input().split())
s1 = " ".join([input() for _ in range(n)])
s2 = [input() for _ in range(m)]
flag = True

i = 0
while i < m:
    #try:
        if s1.count(s2[i]) == 0:
            print("No")
            exit()
        ind = s1.index(s2[i])
        s1 = list(s1)
        del s1[ind]
        s1 = "".join(s1)
        if s1[ind+n+1:ind+n+m+1:] == s2[i+1]:
            i += 1
    #except:
        """print("No")
        exit()"""
print("Yes")

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

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
t,*a=open(0);n,m=map(int,t.split());r=range(n-m+1);print('YNeos'[all(a[n:]!=[t[j:j+m]for t in a[i:i+m]]for i in r for j in r)::2])

t,*a=open(0);n,m=map(int,t.split());r=range(n-m+1);print('YNeos'[all(a[n:-1]!=[t[j:j+m]for t in a[i:i+m]]for i in r for j in r)::2])

n,m,*a=open(0).read().split();n,m=int(n),int(m);r=range(n-m+1);print('YNeos'[all(a[n:]!=[t[j:j+m]for t in a[i:i+m]]for i in r for j in r)::2])

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for y in range(N-M+1):
    for x in range(N-M+1):
        for k in range(M):
            if A[y+k][x:x+M] != B[y]:
                break
        else:
            print("Yes")
            exit()
print("No")

import sys

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

for y in range(N-M+1):
    for x in range(N-M+1):
        for k in range(M):
            if A[y+k][x:x+M] != B[k]:
                break
        else:
            print("Yes")
            sys.exit()
print("No")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n,m = map(int,input().split())
a = []
b = []
fl = False
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):
    if b[0] in a[i]:
        tmp = a[i].find(b[0])
        if m == 1:
            fl = True
        for j in range(1,m):
            if a[i+j][tmp:tmp+m] != b[j]:
                fl = False
                break
            fl = True
    if fl:
        break
        if fl:
    print("Yes")
else:
    print("No")

n,m = map(int,input().split())
a = []
b = []
fl = False
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):
    if b[0] in a[i]:
        tmp = a[i].find(b[0])
        if m == 1:
            fl = True
        for j in range(1,m):
            if a[i+j][tmp:tmp+m] != b[j]:
                fl = False
                break
            fl = True
    if fl:
        break
if fl:
    print("Yes")
else:
    print("No")

n,m = map(int,input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
fl = False
for i in range(n - m + 1):
    if b[0] in a[i]:
        tmp = a[i].find(b[0])
        if m == 1:
            fl = True
        for j in range(1,m):
            if a[i+j][tmp:tmp+m] != b[j]:
                fl = False
                break
            fl = True
    if fl:
        break
if fl:
    print("Yes")
else:
    print("No")

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)])

hantei = False

for i in range(N-M+1):
  for j in range(N-M+1):
    if (A[i:M+i,j:M+j] == B).all:
      hantei = True
      print(A[i:M+i,j:M+j])
print('Yes' if hantei else'No')

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

hantei = False

for i in range(N-M+1):
  for j in range(N-M+1):
    C=np.array(A[i:i+M,j:j+M])
    if (C==B).all():
      hantei = True
print('Yes' if hantei else 'No')

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, M = [int(x) for x in input().split()]

A = [None]*N
for i in range(N):
    A[i] = input()

B = [None]*M
for i in range(M):
    B[i] = input()

def check():
    for x in range(N-M+1):
        for y in range(N-M+1):
            if all(all(A[r+x][c+y] == B[r][c] for c in range(M)) for r range(M))
                return "Yes"
    return "No"
print(check())



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

A = [None]*N
for i in range(N):
    A[i] = input()

B = [None]*M
for i in range(M):
    B[i] = input()

def check():
    for x in range(N-M+1):
        for y in range(N-M+1):
            for r in range(M):
                if all(A[r+x][c+y] == B[r][c] for c in range(M)):
                    return "Yes"
    return "No"
print(check())



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

A = [None]*N
for i in range(N):
    A[i] = input()

B = [None]*M
for i in range(M):
    B[i] = input()

def check():
    for x in range(N-M+1):
        for y in range(N-M+1):
            match = True
            for r in range(M):
                if not all(A[r+x][c+y] == B[r][c] for c in range(M)):
                    match = False
                    break
            if match:
                return "Yes"

    return "No"
print(check())



Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input().split())
a = list()
for _ in range(n):
    a.append(str(input()))
b = list()
for _ in range(m):
    b.append(str(input()))

for H in range(n if m == 1 else n-m+1):
    for W in range(n if m == 1 else n-m+1):
        for M in range(m):
            cnt = 0
            if a[H+M][0+W:m+W] == b[M]:
                cnt+=1
        if cnt==m:
            print('Yes')
            exit()

print('No')


n, m = map(int, input().split())
a = list()
for _ in range(n):
    a.append(str(input()))
b = list()
for _ in range(m):
    b.append(str(input()))

for H in range(n if m == 1 else n-m+1):
    for W in range(n if m == 1 else n-m+1):
        cnt = 0
        for M in range(m):
            if a[H+M][0+W:m+W] == b[M]:
                cnt+=1
        if cnt==m:
            print('Yes')
            exit()

print('No')


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m = map(int,input().split())
a = [[str(i) for i in input()]for _ in range(n)]
b = [[str(i) for i in input()]for _ in range(m)]

for i in range(n-m+1):
  for j in range(n-m+1):
    c =0
    for k in range(m):
      for l in range(m):
        if a[i+k][j+l] == b[k][l]:
          c +=1
          print(c)
          
    print(c)
    if c == m**2:
      print("Yes")
      exit()
      
      
      
print("No")

n,m = map(int,input().split())
a = [[str(i) for i in input()]for _ in range(n)]
b = [[str(i) for i in input()]for _ in range(m)]

for i in range(n-m+1):
  for j in range(n-m+1):
    c =0
    for k in range(m):
      for l in range(m):
        if a[i+k][j+l] == b[k][l]:
          c +=1
          
          
    
    if c == m**2:
      print("Yes")
      exit()
      
      
      
print("No")



Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,M=map(int,input().split())
a=[]
for i in range(N):
  a.append([i for i in input()])
b=[]
for i in range(M):
  b.append([i for i in input()]) 
flg=True
for iS in range(0,N-M+1):
  for ie in range(iS,M):
    flg=True 
    for js in range(0,N-M+1):
      for je in range(js,M):
        print(a[ie][je],b[ie][je])
        if a[ie][je]!=b[ie][je]:
          flg=False
          break
print(flg)      

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

for i in range(m):
  b.append([i for i in input()])
  
for i in range(n-m+1):
  flg=True
  if b_flg:
    break
  for j in range(n-m+1):
    if not flg:
      break
    for k in range(m):
      if not flg:
        break
      for l in range(m):
        if a[i+k][j+l]==b[k][l]:
          flg=True
        else:
          flg=False
    if flg:
      b_flg=True
      break
if b_flg:
  print("YES")
else:
  print("NO")
        
        

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

for i in range(m):
  b.append([i for i in input()])
  
for i in range(n-m+1):
  flg=True
  if b_flg:
    break
  for j in range(n-m+1):
    if not flg:
      break
    for k in range(m):
      if not flg:
        break
      for l in range(m):
        if a[i+k][j+l]==b[k][l]:
          flg=True
        else:
          flg=False
    if flg:
      b_flg=True
      break
if b_flg:
  print("Yes")
else:
  print("No")
        
        

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m = map(int, input().split())

A = [input() for i in range(n)]
B = [intpu() for j in range(m)]

for i in range(n-m+1):
  for j in range(n-m+1):
    if A[i][j:j+m] == B[0]:
      if all(A[i+k][j:j+m] == B[k] for k in range(1,M)):
        print("Yes")
        exit()
print("No")

n,m = map(int, input().split())

A = [input() for i in range(n)]
B = [input() for j in range(m)]

for i in range(n-m+1):
  for j in range(n-m+1):
    if A[i][j:j+m] == B[0]:
      if all(A[i+k][j:j+m] == B[k] for k in range(1,M)):
        print("Yes")
        exit()
print("No")


n,m = map(int, input().split())

A = [input() for i in range(n)]
B = [input() for j in range(m)]

for i in range(n-m+1):
  for j in range(n-m+1):
    if A[i][j:j+m] == B[0]:
      if all(A[i+k][j:j+m] == B[k] for k in range(1,m)):
        print("Yes")
        exit()
print("No")


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import numpy as np

N,M = map(int,input().split())
A = np.array([list(input()) for i in range(N)])
B = np.array([list(input()) for i in range(M)])
f = 0

for i in range(N-M+1):
  for j in range(N-M+1):
    if (A[i:i+M,j:j+M]==B).all():
      f = 1

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

import numpy as np
N,M = map(int,input().split())
A = np.array([list(input()) for n in range(N)])
B = np.array([list(input()) for m in range(M)])
a = "No"

for i in range(N-M+1):
  for j in range(N-M+1):
    if (A[i:i+M,j:j+M]==B).all():
      a = "Yes"

print(a)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys

input_num = input().split()
N = int(input_num[0])
M = int(input_num[1])

AB = [input() for i in range(0, N + M)]
A = AB[0: N]
B = AB[N:]

diff = N - M
matches = []
for i in range(0, diff+1):
    l = 0
    while N - l > diff:
        index = A[i][l:].find(B[0])
        if index != -1 and i <= diff:
            matches.append((index, l, i))
        l += 1
if len(matches) == 0:
    print("No")
    sys.exit()
print(matches)
count_no = []
for m, l, i in matches:
    for a, b in zip(A[i:], B):
        if a[l:].find(b) != m:
            count_no.append(0)
            break
if len(count_no) == len(matches):
    print("No")
else:
    print("Yes")

import sys

input_num = input().split()
N = int(input_num[0])
M = int(input_num[1])

AB = [input() for i in range(0, N + M)]
A = AB[0: N]
B = AB[N:]

diff = N-M+1
top = 0
ind = 0
for i in range(0, diff):
    print(i)
    ind = A[i].find(B[0])
    if ind != -1:
        top += i
        break
else:
    print("No")
    sys.exit()
for i in range(0, len(B)):
    if A[i + top].find(B[i]) != ind:
        print("No")
        break
else:
    print("Yes")

import sys
input_num = input().split()
N = int(input_num[0])
M = int(input_num[1])

AB = [input() for i in range(0, N + M)]
A = AB[0: N]
B = AB[N:]

diff = N - M
matches = []
for i in range(0, diff+1):
    l = 0
    while N - l > diff:
        index = A[i][l:].find(B[0])
        if index != -1 and i <= diff:
            matches.append((index, l, i))
        l += 1
if len(matches) == 0:
    print("No")
    sys.exit()
count_no = []
for m, l, i in matches:
    for a, b in zip(A[i:], B):
        if a[l:].find(b) != m:
            count_no.append(0)
            break
if len(count_no) == len(matches):
    print("No")
else:
    print("Yes")

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,M = map(int,input().split())
A = [input() for i in range(N)]
B = [input() for i in range(M)]

def match(ofs_x, ofs_y):
    for ar,br in zip(A[ofs_y:], B):
        if ar[ofs_x:] != br:
            return False
    return True

for y in range(N-M+1):
    for x in range(N-M+1):
        if match(x,y):
            print('YES')
            exit()
print('NO')

N,M = map(int,input().split())
A = [input() for i in range(N)]
B = [input() for i in range(M)]

def match(ofs_x, ofs_y):
    for ar,br in zip(A[ofs_y:], B):
        if ar[ofs_x : ofs_x + M] != br:
            return False
    return True

for y in range(N-M+1):
    for x in range(N-M+1):
        if match(x,y):
            print('Yes')
            exit()
print('No')

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int, input().split())
Alist = [list(input()) for _ in range(N)]
Blist = [list(input()) for _ in range(M)]
from sys import exit
for i in range(N - M):
    for j in range(N - M):
        if Alist[i:i + M][j:j + M] == Blist:
            print("Yes")
            exit()
print("No")


N, M = map(int, input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]
def check(dx, dy):
    cut_A = [[] for _ in range(M)]
    for i in range(dx, dx + M):
        for j in range(dy, dy + M):
            cut_A[i-dx].append(A[i][j])
    return cut_A == B

for dx in range(N-M+1):
    for dy in range(N-M+1):
        if check(dx, dy):
            print("Yes")
            exit()
print("No")


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int, input().split())
A, B = [], []
for i in range(N):
    A.append(input())
for i in range(M):
    B.append(input())
ans = 'No'
end = 0
for i in range(N-M+1):
    for j in range(N-M+1):
        temp = []
        for k in range(1, M):
            temp.append(A[i+k][j:])
        if temp == B:
            ans = 'Yes'
            end = 1
            break
    if end == 1:
        break
print(ans)

N, M = map(int, input().split())
A, B = [], []
for i in range(N):
    A.append(input())
for i in range(M):
    B.append(input())
ans = 'No'
end = 0
for i in range(N-M+1):
    for j in range(N-M+1):
        temp = []
        for k in range(M):
            temp.append(A[i+k][j:j+M])
        if temp == B:
            ans = 'Yes'
            end = 1
            break
    if end == 1:
        break
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,M = map(int,input().split())
a = []
c = []
for i in range(N):
    b = list(input())
    a+=b
for i in range(M):
  b = list(input())
  c+=b
f = False
for i in range(N*N):
  if f == True:
    break
  count=0
  if N*N-(i)<M*M:
    break
  flag = True
  if c[0] == a[i]:
    if N-((i+1)%N)>M:
      continue
    num = i
    for j in range(M):
      for k in range(M):
        print(c[count],a[num])
        if c[count] == a[num]:
          
          num+=1
          count+=1
        elif c[count]!=a[num]:
          flag =False
          break
      num+=N-M
      if flag == False:
        print(i)
        break  
      if j == M-1:
        f = True
            
  else:
    continue
if f == False:
  print('No')
else:
  print('Yes')

N,M = map(int,input().split())
a = []
c = []
for i in range(N):
    b = list(input())
    a+=b
for i in range(M):
  b = list(input())
  c+=b
#print(c,a)
f = False
for i in range(N*N):
  if f == True:
    break
  if N*N-i<M*M:
    break
  if M>1 and i//N==N-1:
    break
  count=0
  flag = True
  #print(i,c[0],a[i])
  if c[0] == a[i]:
    if N-((i)%N)<M:
      continue
    num = i
    for j in range(M):
      for k in range(M):
        #print(c[count],a[num])
        if c[count] == a[num]:
          
          num+=1
          count+=1
        elif c[count]!=a[num]:
          flag =False
          break
      num+=N-M
      if flag == False:
        #print(i)
        break  
      if j == M-1:
        f = True
            
  else:
    continue
if f == False:
  print('No')
else:
  print('Yes')
           
    

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-
A = []
B = []
N, M = list(map(int, input().split()))

for n in range(N):
    A.append(input())
for n in range(M):
    B.append(input())

def match(r, c):
    for i, row in enumerate(range(r, r+M)):
        if A[row][c:c+M] != B[i]:
            return False
    return True

ok = 0

for r in range(N-M+1):
    if ok == 0:
        for c in range(N-M+1):
            if match(r, c):
                print("YES")
                ok = 1
            
if not ok:
    print("No")

# -*- coding: utf-8 -*-
A = []
B = []
N, M = list(map(int, input().split()))

for n in range(N):
    A.append(input())
for n in range(M):
    B.append(input())

def match(r, c):
    for i, row in enumerate(range(r, r+M)):
#        print("{} : {}  {}".format(A[row][c:c+M], B[i], A[row][c:c+M]==B[i]))
        if A[row][c:c+M] != B[i]:
            return False
    return True

ok = 0

for r in range(N-M+1):
    if ok == 1:
        break
    else:
        for c in range(N-M+1):
            if match(r, c):
                print("YES")
                ok = 1
                break
            
if not ok:
    print("No")

# -*- coding: utf-8 -*-
A = []
B = []
N, M = list(map(int, input().split()))

for n in range(N):
    A.append(input())
for n in range(M):
    B.append(input())

def match(r, c):
    for i, row in enumerate(range(r, r+M)):
#        print("{} : {}  {}".format(A[row][c:c+M], B[i], A[row][c:c+M]==B[i]))
        if A[row][c:c+M] != B[i]:
            return False
    return True

ok = 0

for r in range(N-M+1):
    if ok == 1:
        break
    else:
        for c in range(N-M+1):
            if match(r, c):
                print("Yes")
                ok = 1
                break
            
if not ok:
    print("No")

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int,input().split())

tg = [list(map(int,input().split())) for _ in range(N)]


tmpl = [list(map(int,input().split())) 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]:
      for k in range(i+1,i+M):
        if tmpl[k] != tg[i+k][j:j+M]: break
      else:
        print('Yes')
        exit()
print('No')

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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
4 1
....
....
....
....
#


N,M=map(int,input().split())
A=[input() for i in range(N)]
B=[input() for i in range(M)]

for X in range(N-M+1):
    for Y in range(N-M+1):
        flag=1
        for x in range(M):
            for y in range(M):
                if B[x][y]!=A[x+X][y+Y]:
                    flag=0
                    break
            if not flag:
                break
        if flag:
            print("Yes")
            exit()
print("No")


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int, input().split())



A = [input() for j in range(N)]
B = [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 A[i+k][j:j+k] != B[k]:
                break
        else:
            print("Yes")
            exit()
else:
    print("No")

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



A = [input() for j in range(N)]
B = [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 A[i+k][j:j+M] != B[k]:
                break
        else:
            print("Yes")
            exit()
else:
    print("No")

Verdicts: Wrong Answer

Accepted