Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(N: int, Y: int):
    for i in range(2000+1):
        for j in range((2000+1)-i):
            k = Y-10000*i-5000*j
            if(k//1000 == N-i-j):
                print(i,j,k//1000)
                sys.exit()

    prnt(-1,-1,-1)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(N, Y)

if __name__ == '__main__':
    main()


Fixed submission:
## ABC 085C
## C - Otoshidama

import sys
n, y = (int(_) for _ in input().split())

for i in range(0,n+1):
    for j in range(0,n+1-i):
        if(10000*i+5000*j+1000*(n-i-j) == y):
            print(i,j,n-i-j)
            sys.exit()
                    
print('-1 -1 -1')

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(N: int, Y: int):
    for i in range(2000+1):
        for j in range((2000+1)-i):
            k = Y-10000*i-5000*j
            if(k//1000 == N-i-j):
                print(i,j,k)
                sys.exit()

    prnt(-1,-1,-1)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(N, Y)

if __name__ == '__main__':
    main()


Fixed submission:
## ABC 085C
## C - Otoshidama

import sys
n, y = (int(_) for _ in input().split())

for i in range(0,n+1):
    for j in range(0,n+1-i):
        if(10000*i+5000*j+1000*(n-i-j) == y):
            print(i,j,n-i-j)
            sys.exit()
                    
print('-1 -1 -1')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n, y = (int(_) for _ in input().split())

for i in range(0,n+1):
    for j in range(0,n+1-i):
        for k in range(0,n+1-i-j):
            if(i+j+k == n):
                if(10000*i+5000*j+1000*k == y):
                    print(i,j,k)
                    sys.exit()
                    
print('-1 -1 -1')

Fixed submission:
## ABC 085C
## C - Otoshidama

import sys
n, y = (int(_) for _ in input().split())

for i in range(0,n+1):
    for j in range(0,n+1-i):
        if(10000*i+5000*j+1000*(n-i-j) == y):
            print(i,j,n-i-j)
            sys.exit()
                    
print('-1 -1 -1')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))

s=set(a)

c=0
for i in s:
    t=a.count(i)
    if(t-i>=0):
        c+=(t-i)
    else:
        c+=t

print(c)

Fixed submission:
from collections import defaultdict

n=int(input())
a=list(map(int,input().split()))

d=defaultdict(int)
for b in a:
    d[b] +=1

c=0
for k,v in d.items():
    if(k>v):
        c+=v
    else:
        c+=v-k

print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))

s=set(a)

c=0
for i in s:
    t=a.count(i) - i
    if(t>=0):
        c+=t
    else:
        c+=a.count(i)

print(c)

Fixed submission:
from collections import defaultdict

n=int(input())
a=list(map(int,input().split()))

d=defaultdict(int)
for b in a:
    d[b] +=1

c=0
for k,v in d.items():
    if(k>v):
        c+=v
    else:
        c+=v-k

print(c)
Buggy python submission (verdict: Runtime Error):
# a = input()
# b = input()
a,b = input().split() 

if(a == b[::-1] and b == a[::-1]):
    print('YES')
else:
    print('NO')

Fixed submission:
a = input()
b = input()
if(a == b[::-1] and b == a[::-1]):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    St = list(input())
    T = input()

    # print(len(T))
    f = False
    for i in range(len(St)):
        if(St[i] == T[0]):
            cnt = 0
            for j in range(len(T)):
                if(T[j] == St[i+j] or St[i+j] == '?'):
                    # if(cnt == len(T)-1):
                    #     St[i:i+j] = T[j]
                    cnt += 1
                else:
                    break
            if(cnt == len(T)):
                for j in range(len(T)):
                    St[i+j] = T[j]
                f = True
    # print(St)
    if(f):
        print(''.join(St).replace('?', 'a'))
    else:
        print('UNRESTORABLE')
    
    
if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    S = input().replace('?', '.')
    T = input()

    import re
    import sys

    for i in range(len(S)-len(T),-1,-1):
        if(re.match(S[i:i+len(T)],T)):
            S = S.replace('.', 'a')
            print(S[:i]+T+S[i+len(T):])
            exit()
    else:
        print("UNRESTORABLE")
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    St = list(input())
    T = input()

    # print(len(T))
    f = False
    for i in range(len(St)):
        if(St[i] == T[0]):
            cnt = 0
            for j in range(len(T)):
                if(T[j] == St[i+j] or St[i+j] == '?'):
                    # if(cnt == len(T)-1):
                    #     St[i:i+j] = T[j]
                    continue
                else:
                    break
            if(cnt == len(T[j])-1):
                for j in range(len(T)):
                    St[i+j] = T[j]
                f = True
    # print(St)
    if(f):
        print(''.join(St).replace('?', 'a'))
    else:
        print('UNRESTORABLE')
    
    
if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    S = input().replace('?', '.')
    T = input()

    import re
    import sys

    for i in range(len(S)-len(T),-1,-1):
        if(re.match(S[i:i+len(T)],T)):
            S = S.replace('.', 'a')
            print(S[:i]+T+S[i+len(T):])
            exit()
    else:
        print("UNRESTORABLE")
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000)
INF = 1<<32

YES = "YES"  # type: str
NO = "NO"  # type: str

def solve(N: int, D: "List[int]", M: int, T: "List[int]"):
    
    D.sort()
    T.sort()

    from bisect import bisect_left, bisect_right

    if M > N:
        print(NO)
        exit()
        

    for i in range(M):
        lf = bisect_left(D, T[i])
        ri = bisect_right(D, T[i])
        if lf != ri:
            D.pop(lf)
        else:
            print(NO)
            exit()

    print(YES)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    D = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    M = int(next(tokens))  # type: int
    T = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    solve(N, D, M, T)

if __name__ == '__main__':
    main()


Fixed submission:
n = int(input())
d_li = list(map(int,input().split()))
m = int(input())
t_li = list(map(int,input().split()))

d_li.sort()
t_li.sort()

check = 0

for i in range(n):
    if d_li[i] == t_li[check]:
        check += 1
        
    if check == m:
        print("YES")
        exit()
else:
    print("NO")

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000)
INF = 1<<32

YES = "YES"  # type: str
NO = "NO"  # type: str

def solve(N: int, D: "List[int]", M: int, T: "List[int]"):
    
    D.sort()
    T.sort()

    from bisect import bisect_left, bisect_right

    for i in range(M):
        lf = bisect_left(D, T[i])
        ri = bisect_right(D, T[i])
        if lf != ri:
            D.pop(lf)
        else:
            print(NO)
            exit()

    print(YES)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    D = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    M = int(next(tokens))  # type: int
    T = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    solve(N, D, M, T)

if __name__ == '__main__':
    main()


Fixed submission:
n = int(input())
d_li = list(map(int,input().split()))
m = int(input())
t_li = list(map(int,input().split()))

d_li.sort()
t_li.sort()

check = 0

for i in range(n):
    if d_li[i] == t_li[check]:
        check += 1
        
    if check == m:
        print("YES")
        exit()
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
from math import ceil, floor

def solve(A: int, B: int, C: int, D: int, E: int, F: int):
    
    x = []
    y = []  

    for i in range(ceil(F/(100*A))+1):
        for j in range(ceil(F/(100*B))+1):
            dx = 100*A*i+100*B*j
            if(100*min(A,B) <= dx <= F):
                x.append(dx)

    for i in range(ceil(F/C)+1):
        for j in range(ceil(F/C)+1):
            dy = C*i+D*j
            if(0 <= dy <= F):
                y.append(dy)

    x = sorted(list(set(x)))
    y = sorted(list(set(y)))
    
    w = x[1]
    s = y[1]

    for i in x:
        for j in y:
            de = 100*s/(w+s)
            ne = 100*j/(i+j)
            if(i+j <= F and de < ne <= 100*E/(100+E)):
                # print(i, j, ne)
                w = i
                s = j

    print(w+s, s)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    F = int(next(tokens))  # type: int
    solve(A, B, C, D, E, F)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys
from math import ceil, floor

def solve(A: int, B: int, C: int, D: int, E: int, F: int):
    
    x = []
    y = []  

    for i in range(ceil(F/(100*A))+1):
        for j in range(ceil(F/(100*B))+1):
            dx = 100*A*i+100*B*j
            if(min(100*A,100*B) <= dx <= F):
                x.append(dx)

    for i in range(ceil(F/C)+1):
        for j in range(ceil(F/C)+1):
            dy = C*i+D*j
            if(0 <= dy <= F):
                y.append(dy)

    x = sorted(list(set(x)))
    y = sorted(list(set(y)))
    
    w = x[0]
    s = y[0]

    for i in x:
        for j in y:
            de = 100*s/(w+s)
            ne = 100*j/(i+j)
            if(i+j <= F and de < ne <= 100*E/(100+E)):
                # print(i, j, ne)
                w = i
                s = j

    print(w+s, s)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    F = int(next(tokens))  # type: int
    solve(A, B, C, D, E, F)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, R: int, r: "List[int]", A: "List[int]", B: "List[int]", C: "List[int]"):

    '''
    Warshall-Floyd
    input:  c[|V|][|V|]
            input example to from cost
            (c[i][i] == 0)
    Output: Minimun cost of all paths in the inputed graph 
    '''
    V = N
    INF = 1<<32
    d = [[INF] * (N+1) for i in range(N+1)]
 
    for i in range(M):
        d[A[i]][B[i]] = C[i]
        d[B[i]][A[i]] = C[i]

    for k in range(N+1):
        for i in range(N+1):
            if d[i][k] == INF : continue
            for j in range(N+1):
                if d[k][j] == INF: continue
                d[i][j] = min(d[i][j], d[i][k]+d[k][j])


    ans = INF

    from itertools import product
    for i in product(r,repeat=len(r)):
        # print(i)
        if(len(i) != len(set(i))): continue
        ta = 0
        for j in range(1,len(i)):
            ta += d[i[j-1]][i[j]]
        
        ans = min(ans, ta)
    
    print(ans)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    r = [int(next(tokens)) for _ in range(R)]  # type: "List[int]"
    A = [int()] * (M)  # type: "List[int]"
    B = [int()] * (M)  # type: "List[int]"
    C = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
        C[i] = int(next(tokens))
    solve(N, M, R, r, A, B, C)

if __name__ == '__main__':
    main()


Fixed submission:
n = input()
if(n[0] == '9' or n[1] == '9'):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
## ABC 072 c
n = int(input())
a = [int(i) for i in input().split()]
a.sort()

cnt = 0
for x in range(a[0]-1, a[-1]+2):
    c = a.count(x)+a.count(x-1)+a.count(x+1)
    cnt = max(c,cnt)

print(cnt)


Fixed submission:
## ABC 072 c
from collections import Counter

n = int(input())
a = [int(i) for i in input().split()]
a.sort()

ad = Counter(a)
cnt = 0
for x in range(a[0]-1, a[-1]+2):
    c = ad[x]+ad[x-1]+ad[x+1]
    cnt = max(c,cnt)

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
## ABC 072 c
n = int(input())
a = [int(i) for i in input().split()]
a.sort()

cnt = 0
for x in range(a[0]-1, a[-1]+2):
    c = 0
    for v in a:
        if (abs(x-v) <= 1):
            c += 1
    cnt = max(c,cnt)

print(cnt)


Fixed submission:
## ABC 072 c
from collections import Counter

n = int(input())
a = [int(i) for i in input().split()]
a.sort()

ad = Counter(a)
cnt = 0
for x in range(a[0]-1, a[-1]+2):
    c = ad[x]+ad[x-1]+ad[x+1]
    cnt = max(c,cnt)

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
## ABC 072 c
n = int(input())
a = [int(i) for i in input().split()]
a.sort()

ans = 0
cnt = 0
for x in range(a[0]-1, a[-1]+2):
    c = 0
    for i, v in enumerate(a):
        if (abs(x-v) <= 1):
            c += 1
    if (c > cnt):
        ans = x
        cnt = c

print(cnt)


Fixed submission:
## ABC 072 c
from collections import Counter

n = int(input())
a = [int(i) for i in input().split()]
a.sort()

ad = Counter(a)
cnt = 0
for x in range(a[0]-1, a[-1]+2):
    c = ad[x]+ad[x-1]+ad[x+1]
    cnt = max(c,cnt)

print(cnt)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
# from fractions import gcd
from math import gcd
from functools import reduce

def lcm(x, y):
    return (x * y) // gcd(x, y)


def solve(N: int, T: "List[int]"):
    print(reduce(lcm, T))
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    T = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, T)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys
from fractions import gcd
# from math import gcd
from functools import reduce

def lcm(x, y):
    return (x * y) // gcd(x, y)


def solve(N: int, T: "List[int]"):
    print(reduce(lcm, T))
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    T = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, T)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(n: int, a: "List[int]"):
    l = []
    for i in range(n):
        l.append(a[i])
        l.reverse()

    l = map(str, l)
    print(' '.join(l))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(n) ]  # type: "List[int]"
    solve(n, a)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys


def solve(n: int, a: "List[int]"):
    from collections import deque

    d = deque()
    for i in range(n):
        if(i%2 == 0):
            d.append(a[i])
        else:
            d.appendleft(a[i])

    if(n%2 == 1):
        d.reverse()

    d = map(str, d)
    print(' '.join(d))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(n) ]  # type: "List[int]"
    solve(n, a)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys

import math


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def solve(N: int):
    from functools import reduce
    from operator import mul

    a = prime_factorize(N)
    a.sort(reverse=True)
    if(len(a)==1):
        print(len(str(a[0])))
        exit()

    # bit all search
    ans = 100000000
    for i in range(1<<len(a)):
        x = 1
        y = 1
        for j in range(len(a)):
            if((i >> j)&1):
                x *= a[j]
            else:
                y *= a[j]

        ans = min(ans, max(len(str(x)), len(str(y))))


    print(ans)
    


    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys

import math


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def solve(N: int):
    from functools import reduce
    from operator import mul

    a = prime_factorize(N)
    a.sort(reverse=True)
    if(len(a)==1):
        print(len(str(a[0])))
        exit()

    # bit all search
    ans = 100000000
    for i in range(1<<len(a)):
        x = 1
        y = 1
        for j in range(len(a)):
            if((i >> j)&1):
                x *= a[j]
            else:
                y *= a[j]

        ans = min(ans, max(len(str(x)), len(str(y))))


    print(ans)
    


    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
## ABC 054 b
import sys
import numpy as np

n,m = (int(_) for _ in input().split())
a = [list(input()) for i in range(n)]
b = [list(input()) for i in range(m)]
aa = np.array(a)
bb = np.array(b)

for i in range(n-m+1):
    for j in range(n-m+1):
        if (bb[:, :] == aa[i:i+m, j:j+m]):
            print('Yes')
            sys.exit(0)

print('No')

Fixed submission:
## ABC 054 b
import sys

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

if(a[::1] == b[::1]):
    print('Yes')
    sys.exit(0)

for i in range(n-m):
    for j in range(n-m):
        if (b[::1] == [ai[j:j+m] for ai in a[i:i+m]]):
            print('Yes')
            sys.exit(0)

print('No')

Buggy python submission (verdict: Runtime Error):
## ABC 054 B
import sys
n, m = map(int, input().split())

a = [input() for i in range(n)]
b = [input() for j in range(m)]

if(n == m and a == b):
    print('Yes')
    sys.exit(0)
elif(m == 1):
    for i in range(n):
        if(b[0] in a[i]):
            print('Yes')
            sys.exit(0)
    print('No')
    sys.exit(0)

for k in range(n-m):
    idx = []
    for j in range(n-m):
        if (a[k][j:j + m] == b[k]):
            idx.append(j)
            continue
    for id in idx:
        for i in range(k,m):
            if(a[i][id:id+m] == b[i]):
                continue
            else:
                print('No')
                sys.exit(0)
        print('Yes')
        sys.exit(0)

Fixed submission:
## ABC 054 b
import sys

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

if(a[::1] == b[::1]):
    print('Yes')
    sys.exit(0)

for i in range(n-m):
    for j in range(n-m):
        if (b[::1] == [ai[j:j+m] for ai in a[i:i+m]]):
            print('Yes')
            sys.exit(0)

print('No')