Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
maxi = max(A,B,C)
mini = min(A,B,C)
mid = sum([A,B,C]) - (maxi+mini)
i,j,k,l = 0,0,0,0
if mini%2 != mid%2:
    #midだけ偶奇が違うとき
    if maxi%2 == mini%2 and maxi%2 != mid%2:
        if mid - maxi != 1:
            ans += (maxi+1-mid)//2
            mid = maxi + 1
    #miniだけ偶奇が違うとき
    if maxi%2 != mini%2 and maxi%2 == mid%2:
        if mini - maxi != 1:
            ans += (maxi+1-mini)//2
            mini = maxi + 1
while maxi - mini > 1:
    mini += 2
    k += 1
while maxi - mid > 1:
    mid += 2
    l += 1
if maxi == mini and maxi == mid:
    print(i+j+k+l)
else:
    print(i+j+k+l+1)

Fixed submission:
A,B,C = map(int,input().split())
maxi = max(A,B,C)
mini = min(A,B,C)
mid = sum([A,B,C]) - (maxi+mini)
i,j,k,l = 0,0,0,0
if mini%2 != mid%2:
    #midだけ偶奇が違うとき
    if maxi%2 == mini%2 and maxi%2 != mid%2:
        if mid - maxi != 1:
            i = (maxi+1-mid)//2
            mid = maxi + 1
    #miniだけ偶奇が違うとき
    if maxi%2 != mini%2 and maxi%2 == mid%2:
        if mini - maxi != 1:
            j = (maxi+1-mini)//2
            mini = maxi + 1
while maxi - mini > 1:
    mini += 2
    k += 1
while maxi - mid > 1:
    mid += 2
    l += 1
if maxi == mini and maxi == mid:
    print(i+j+k+l)
else:
    print(i+j+k+l+1)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,C = map(int,input().split())
maxi = max(A,B,C)
mini = min(A,B,C)
mid = sum([A,B,C]) - (maxi+mini)
i,j,k,l = 0,0,0,0
if mini%2 != mid%2:
    #midだけ偶奇が違うとき
    if maxi%2 == mini%2 and maxi%2 != mid%2:
        while mid - maxi != 1:
            mid += 2
            i += 1
    #miniだけ偶奇が違うとき
    if maxi%2 != mini%2 and maxi%2 == mid%2:
        while mini - maxi != 1:
            mid += 2
            j += 1
while maxi - mini > 1:
    mini += 2
    k += 1
while maxi - mid > 1:
    mid += 2
    l += 1
if maxi == mini and maxi == mid:
    print(i+j+k+l)
else:
    print(i+j+k+l+1)

Fixed submission:
A,B,C = map(int,input().split())
maxi = max(A,B,C)
mini = min(A,B,C)
mid = sum([A,B,C]) - (maxi+mini)
i,j,k,l = 0,0,0,0
if mini%2 != mid%2:
    #midだけ偶奇が違うとき
    if maxi%2 == mini%2 and maxi%2 != mid%2:
        if mid - maxi != 1:
            i = (maxi+1-mid)//2
            mid = maxi + 1
    #miniだけ偶奇が違うとき
    if maxi%2 != mini%2 and maxi%2 == mid%2:
        if mini - maxi != 1:
            j = (maxi+1-mini)//2
            mini = maxi + 1
while maxi - mini > 1:
    mini += 2
    k += 1
while maxi - mid > 1:
    mid += 2
    l += 1
if maxi == mini and maxi == mid:
    print(i+j+k+l)
else:
    print(i+j+k+l+1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
A.append(0)

j = 1
sm = abs(A[1])
while j < N:
        sm += abs(A[j]-A[j+1])
        j += 1
print(sm)

for i in range(1,N):
    j = 0
    sm = abs(A[0])
    while j < N:
        if j+1 == i and j+2 < N+1:
            sm += abs(A[j]-A[j+2])
            j += 2
        else:
            sm += abs(A[j]-A[j+1])
            j += 1
    print(sm)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.append(0)
sm = abs(A[0])
j = 0
while j < N:
        sm += abs(A[j]-A[j+1])
        j += 1

for i in range(N):
    if i == 0:
        print(sm-abs(A[0]-0)
                -abs(A[1]-A[0])
                +abs(A[1]-0))
        continue
    print(sm-abs(A[i]-A[i-1])
            -abs(A[i+1]-A[i])
            +abs(A[i+1]-A[i-1]))
Buggy python submission (verdict: Time Limit Exceeded):
#AtCorder Beginner Contest 085  C Otoshidama
n, y = map(int, input().split())

a = -1
b = -1
c = -1

for i in range(n + 1):
    if 10000*i == y and i == n:
        a = i
        b = 0
        c = 0
        break
    else:
        for j in range(n-i + 1):
            if i+j == n and 10000*i + 5000*j == y:
                a = i
                b = j
                c = 0
                break
            else:
                for k in range(n - i - j + 1):
                    if  i + j + k == n and 10000*i + 5000*j + 1000*k == y :
                        a = i
                        b = j
                        c = k
                        break


print(str(a) + " " + str(b) + " " + str(c))

Fixed submission:
#AtCorder Beginner Contest 085  C Otoshidama
n, y = map(int, input().split())

a = -1
b = -1
c = -1

for i in range(n + 1):
    if 10000*i == y and i == n:
        a = i
        b = 0
        c = 0
        break
    else:
        for j in range(n - i + 1):
            if i+j == n and 10000*i + 5000*j == y:
                a = i
                b = j
                c = 0
                break
            elif 10000*i + 5000*j + 1000*(n - i -j) == y:
                a = i
                b = j
                c = n - i - j
                break


print(str(a) + " " + str(b) + " " + str(c))

Buggy python submission (verdict: Time Limit Exceeded):
#AtCorder Beginner Contest 085  C Otoshidama
n, y = map(int, input().split())

a = -1
b = -1
c = -1

for i in range(n + 1):
    if 10000*i == y and i == n:
        a = i
        b = 0
        c = 0
        break
    else:
        for j in range(n-i + 1):
            if 10000*i + 5000*j == y and i+j == n:
                a = i
                b = j
                c = 0
                break
            else:
                for k in range(n - i - j + 1):
                    if 10000*i + 5000*j + 1000*k == y and i + j + k == n:
                        a = i
                        b = j
                        c = k
                        break


print(str(a) + " " + str(b) + " " + str(c))

Fixed submission:
#AtCorder Beginner Contest 085  C Otoshidama
n, y = map(int, input().split())

a = -1
b = -1
c = -1

for i in range(n + 1):
    if 10000*i == y and i == n:
        a = i
        b = 0
        c = 0
        break
    else:
        for j in range(n - i + 1):
            if i+j == n and 10000*i + 5000*j == y:
                a = i
                b = j
                c = 0
                break
            elif 10000*i + 5000*j + 1000*(n - i -j) == y:
                a = i
                b = j
                c = n - i - j
                break


print(str(a) + " " + str(b) + " " + str(c))
Buggy python submission (verdict: Runtime Error):
import sys
import os
import math

N, H  = map(int,input().split())
katana = [0 for _ in range(N)]

for i in range(N):
    a,b = map(int,input().split())
    katana[i] = [a,b]
katana = sorted(katana,key=itemgetter(1),reverse=True)
maxA = 0
for i in range(N):
    maxA = max(maxA,katana[i][0])

cnt = 0
for k in katana:
    if H <= 0:
        print(cnt)
        sys.exit()
    if k[1] > maxA:
        H -= k[1]
        cnt += 1
cnt += math.ceil(H/maxA)
print(cnt)


Fixed submission:
import sys
import os
import math
from operator import itemgetter
 
N, H  = map(int,input().split())
katana = [0 for _ in range(N)]
 
for i in range(N):
    a,b = map(int,input().split())
    katana[i] = [a,b]
katana = sorted(katana,key=itemgetter(1),reverse=True)
maxA = 0
for i in range(N):
    maxA = max(maxA,katana[i][0])
 
cnt = 0
for k in katana:
    if H <= 0:
        print(cnt)
        sys.exit()
    if k[1] > maxA:
        H -= k[1]
        cnt += 1
cnt += math.ceil(H/maxA)
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import os
sys.setrecursionlimit(100000)

prime = [2]
def gcd(x,y):
    if y <= 0:
        return x
    return gcd(y,x%y)
  
#P以下の素数のリストを作成
def makePrime(P):
    for x in range(3,P+1,2):
        for y in prime:
            if gcd(x,y) == 1:
                if y == max(prime):
                    prime.append(x)
                continue
            else:
                break
                
Q = int(input())
cnt = 0
L = [0 for _ in range(Q) ]
R = [0 for _ in range(Q) ]

for i in range(Q):
    l, r = map(int,input().split())
    L[i], R[i] = l, r
makePrime(max(R))

for i in range(Q):
    l, r = L[i], R[i]
    j = l
    while l <= j and j <= r:
        if j in prime and (j+1)//2 in prime:
            cnt += 1
        j += 1
    print(cnt)
    cnt = 0


Fixed submission:
#Pはiが素数かどうかを表すlist
#素数でないと判明したらFalseに書き換える
P = [True]*100001
for i in range(2,100001):#2から始める
    if P[i]:
        for j in range(i+i,100000,i): #stepはi
            P[j] = False

#2017に似た数の個数をあらかじめ求める
#C[i]はi以下の2017に似た数の個数
C = [0 for _ in range(100002)]
#まずC[i]にiと(i+1)/2が2017likeであれば1を格納
for i in range(3,100000,2):
    if P[i] and P[(i+1)//2]:
        C[i] += 1
#C[i]はi<以下>の2017likeな数の個数なので，
#下から個数を足していく（累積和という）
for i in range(3,100000):
    C[i+1] += C[i]
Q = int(input())
for i in range(Q):
    l,r = map(int,input().split())
    print(C[r]-C[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
prime = []
def isPrime(n):
    if n == 1:
        return False
    if n in prime:
        return True
    k = 2
    while k*k <= n:
        if n%k==0:
            return False
        k += 1
    prime.append(n)
    return True

Q = int(input())
L = [0]*Q
R = [0]*Q
cnt = 0
for i in range(Q):
    l, r = map(int,input().split())
    j = l
    while l <= j and j <= r:
        if isPrime(j) and isPrime((j+1)//2):
            cnt += 1
        j += 1
    print(cnt)
    cnt = 0


Fixed submission:
#Pはiが素数かどうかを表すlist
#素数でないと判明したらFalseに書き換える
P = [True]*100001
for i in range(2,100001):#2から始める
    if P[i]:
        for j in range(i+i,100000,i): #stepはi
            P[j] = False

#2017に似た数の個数をあらかじめ求める
#C[i]はi以下の2017に似た数の個数
C = [0 for _ in range(100002)]
#まずC[i]にiと(i+1)/2が2017likeであれば1を格納
for i in range(3,100000,2):
    if P[i] and P[(i+1)//2]:
        C[i] += 1
#C[i]はi<以下>の2017likeな数の個数なので，
#下から個数を足していく（累積和という）
for i in range(3,100000):
    C[i+1] += C[i]
Q = int(input())
for i in range(Q):
    l,r = map(int,input().split())
    print(C[r]-C[l-1])
Buggy python submission (verdict: Runtime Error):
a,b,c,d = input()
print("Yes" b==c and(a==b or c==d) else "No" )

Fixed submission:
a,b,c,d = input()
print("Yes" if b==c and( a==b or c==d ) else "No" )
Buggy python submission (verdict: Runtime Error):
S = list(input())
invS = []
for s in reversed(S):
    invS.append(s)
cnt = 0
loop = 0
i,j = 0,0
while i+j != len(S)-1:
    if S[i] == invS[j]:
        i += 1
        j += 1
    elif S[i] == "x":
        cnt += 1
        i += 1
    elif invS[j] == "x":
        cnt += 1
        j += 1
    else:
        cnt = -1
        break
print(cnt)


Fixed submission:
S = list(input())
invS = []
for s in reversed(S):
    invS.append(s)
cnt = 0
loop = 0
i,j = 0,0
while i+j < len(S)-1 and i <= len(S)-1 and j <= len(S)-1 :
    if S[i] == invS[j]:
        i += 1
        j += 1
    elif S[i] == "x":
        cnt += 1
        i += 1
    elif invS[j] == "x":
        cnt += 1
        j += 1
    else:
        cnt = -1
        break
print(cnt)

Buggy python submission (verdict: Runtime Error):
S = list(input())
invS = []
for s in reversed(S):
    invS.append(s)
cnt = 0
loop = 0
i,j = 0,0
while i <= len(S)//2+1 and j <= len(S)//2+1:
    if S[i] == invS[j]:
        i += 1
        j += 1
    elif S[i] == "x":
        cnt += 1
        i += 1
    elif invS[j] == "x":
        cnt += 1
        j += 1
    loop += 1
    if loop > len(S):
        cnt = -1
        break
print(cnt)


Fixed submission:
S = list(input())
invS = []
for s in reversed(S):
    invS.append(s)
cnt = 0
loop = 0
i,j = 0,0
while i+j < len(S)-1 and i <= len(S)-1 and j <= len(S)-1 :
    if S[i] == invS[j]:
        i += 1
        j += 1
    elif S[i] == "x":
        cnt += 1
        i += 1
    elif invS[j] == "x":
        cnt += 1
        j += 1
    else:
        cnt = -1
        break
print(cnt)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 7)
#f = open('input.txt','r')
input = sys.stdin.readline
#sys.stdin = f

N = int(input())
A = [int(input()) for _ in range(N)]
cntA = [0 for _ in range(max(A)+1)]
for a in A:
    cntA[a] += 1
    cntA[a] %= 2
print(sum(cntA))

Fixed submission:
N = input()
if "9" in N:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 7)
#f = open('input.txt','r')
input = sys.stdin.readline
#sys.stdin = f

N = int(input())
A = [int(input()) for _ in range(N)]
cntA = [0 for _ in range(max(A)+1)]
for a in A:
    cntA[a] += 1
    cntA[a] %= 2
print(sum(cntA))

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
cnt = 1
ans = 0
if len(A) == 1:
    print(1)
    exit()
for i in range(1,N):
    if A[i-1] == A[i]:
        cnt += 1
    else:
        ans += cnt%2
        cnt = 1
if cnt >= 1:
    ans += cnt%2
print(ans)

Buggy python submission (verdict: Runtime Error):
import sys
sys.stdin.readline()
#sys.stdin = f

N = int(input())
A = [ int(input()) for _ in range(N)]
cntA = [0 for _ in range(max(A)+1)]
for a in A:
    cntA[a] += 1
    cntA[a] %= 2
print(sum(cntA))

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
cnt = 1
ans = 0
if len(A) == 1:
    print(1)
    exit()
for i in range(1,N):
    if A[i-1] == A[i]:
        cnt += 1
    else:
        ans += cnt%2
        cnt = 1
if cnt >= 1:
    ans += cnt%2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [ int(input()) for _ in range(N)]
cntA = [0 for _ in range(max(A)+1)]
for a in A:
    cntA[a] += 1
    cntA[a] %= 2
print(sum(cntA))

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
cnt = 1
ans = 0
if len(A) == 1:
    print(1)
    exit()
for i in range(1,N):
    if A[i-1] == A[i]:
        cnt += 1
    else:
        ans += cnt%2
        cnt = 1
if cnt >= 1:
    ans += cnt%2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [ int(input()) for _ in range(N)]
cntA = [0 for _ in range(max(A)+1)]
for a in A:
    cntA[a] += 1
    cntA[a] %= 2
print(sum(cntA))

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
cnt = 1
ans = 0
if len(A) == 1:
    print(1)
    exit()
for i in range(1,N):
    if A[i-1] == A[i]:
        cnt += 1
    else:
        ans += cnt%2
        cnt = 1
if cnt >= 1:
    ans += cnt%2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
A.sort()
cntA = [0 for _ in range(10**5)]
for i in range(10**5):
    if i in A:
        cntA[i] = A.count(i)
sumA = [0 for _ in range(10**5)]
sumA[0] = cntA[0]
sumA[1] = cntA[0] + cntA[1]
for i in range(2,10**5):
    sumA[i] = cntA[i] + cntA[i-1] + cntA[i-2]
print(max(sumA))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
cntA = [0 for _ in range(10**5)]
for a in A:
        cntA[a] += 1
sumA = [0 for _ in range(10**5)]
sumA[0] = cntA[0]
sumA[1] = cntA[0] + cntA[1]
for i in range(2,10**5):
    sumA[i] = cntA[i] + cntA[i-1] + cntA[i-2]
print(max(sumA))
Buggy python submission (verdict: Time Limit Exceeded):
def fact(X):
    res = 1
    for i in range(1,X+1):
        res *= i
    return res

N, M = map(int,input().split())
N, M = max(N,M), min(N,M)
mod = 10**9 + 7
if N-M != 1 and N != M:
    ans = 0
elif N != M:
    factN = fact(N)
    ans = (factN*factN//N)%mod
else:
    factN = fact(N)
    ans = (factN*factN*2)%mod
print(ans)

Fixed submission:
import math
N, M = map(int,input().split())
N, M = max(N,M), min(N,M)
mod = 10**9 + 7
if N-M != 1 and N != M:
    ans = 0
elif N != M:
    factN = math.factorial(N)
    ans = (factN*factN//N)%mod
else:
    factN = math.factorial(N)
    ans = (factN*factN*2)%mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def fact(X):
    res = 1
    for i in range(1,X+1):
        res *= i
    return res

N, M = map(int,input().split())
N, M = max(N,M), min(N,M)
mod = 10**9 + 7
if N-M != 1 and N != M:
    ans = 0
elif N != M:
    ans = (fact(N)*fact(M))%mod
else:
    ans = (fact(N)*fact(M)*2)%mod
print(ans)

Fixed submission:
import math
N, M = map(int,input().split())
N, M = max(N,M), min(N,M)
mod = 10**9 + 7
if N-M != 1 and N != M:
    ans = 0
elif N != M:
    factN = math.factorial(N)
    ans = (factN*factN//N)%mod
else:
    factN = math.factorial(N)
    ans = (factN*factN*2)%mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
N, K = map(int,input().split())
Q = []
for i in range(N):
    a, b = map(int,input().split())
    for j in range(b):
        heapq.heappush(Q,a)
for i in range(K-1):
    heapq.heappop(Q)
print(heapq.heappop(Q))

Fixed submission:
N, K = map(int,input().split())
Q = [0 for i in range(N)]
for i in range(N):
    Q[i] = list(map(int,input().split()))
Q.sort()
cnt = 0
j = 0
while cnt < K:
    cnt += Q[j][1]
    j += 1
print(Q[j-1][0])
Buggy python submission (verdict: Runtime Error):
from collections import deque
def bfs():
    Q = deque()
    Q.append(0)
    #今の時刻
    i = 1
    while len(Q) > 0:
        x = Q.popleft()
        if x-i >= 0:
            T[i][x-i] = 1
            if x-i == X: return i
            Q.append(x-i)
        if 0 <= x and x <= X:
            T[i][x] = 1
            if x == X: return i
            Q.append(x)
        if x+i <= X:
            T[i][x+i] = 1
            if x+i == X: return i
            Q.append(x+i)
        i += 1

X = int(input())
INF = 10**9 +1
#時刻iで座標jに到着できるかどうか
T = [[0 for _ in range(X+1)] for _ in range(X**2)]
T[0][0] = 1
print(bfs())


Fixed submission:
W, a, b = map(int,input().split())
print(max(b-(a+W),(a-(b+W)),0))

Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque
def bfs():
    Q = deque()
    Q.append(0)
    #今の時刻
    i = 1
    while len(Q) > 0:
        x = Q.popleft()
        print(x)
        if x-i >= 0:
            T[i][x-i] = 1
            if x-i == X: return i
            Q.append(x-i)
        if 0 <= x and x <= X:
            T[i][x] = 1
            if x == X: return i
            Q.append(x)
        if x+i <= X:
            T[i][x+i] = 1
            if x+i == X: return i
            Q.append(x+i)
        i += 1

X = int(input())
INF = 10**9 +1
#時刻iで座標jに到着できるかどうか
T = [[0 for _ in range(X+1)] for _ in range(X**2)]
T[0][0] = 1
print(bfs())


Fixed submission:
W, a, b = map(int,input().split())
print(max(b-(a+W),(a-(b+W)),0))

Buggy python submission (verdict: Runtime Error):
from collections import deque

def bfs():
    Q = deque()
    Q.append(0)
    #今の時刻
    i = 1
    while len(Q) > 0:
        x = Q.popleft()
        print(x)
        if x-i >= 0:
            T[i][x-i] = 1
            if x-i == X: return i
            Q.append(x-i)
        if 0 <= x and x <= X:
            T[i][x] = 1
            if x == X: return i
            Q.append(x)
        if x+i <= X:
            T[i][x+i] = 1
            if x+i == X: return i
            Q.append(x+i)
        i += 1

X = int(input())
INF = 10**9 +1
#時刻iで座標jに到着できるかどうか
T = [[0 for _ in range(X+1)] for _ in range(X**2)]
T[0][0] = 1
print(bfs())

Fixed submission:
W, a, b = map(int,input().split())
print(max(b-(a+W),(a-(b+W)),0))
Buggy python submission (verdict: Runtime Error):
N, M  = map(int, input().split())
A = [ input() for i in range(N)]
B = [ input() for i in range(M)]


def serch(x0, y0):
  for i in range(M):
    for j in range(M):
      if A[x0+i][y0+j] != B[i][j]:
        return False
  return True

if M > N:
  print('No')
  exit()


for x in range(N):
  for y in range(N):
    if not serch(x,y):
      continue
    else:
      print('Yes')
      exit()
print('No')


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


def serch(x0, y0):
  for i in range(M):
    for j in range(M):
      if x0+i >= N or y0+j >= N:
        return False
      if A[x0+i][y0+j] != B[i][j]:
        return False
  return True

if M > N:
  print('No')
  exit()


for x in range(N):
  for y in range(N):
    if not serch(x,y):
      continue
    else:
      print('Yes')
      exit()
print('No')

Buggy python submission (verdict: Runtime Error):
N, M  = map(int, input().split())
A = [ input() for i in range(N)]
B = [ input() for i in range(M)]


def serch(x0, y0):
  for i in range(M):
    for j in range(M):
      if A[x0+i][y0+j] != B[i][j]:
        return False
  return True

if M > N:
  print('No')
  exit()

for b in B:
  for x in range(N):
    for y in range(N):
      if not serch(x,y):
        continue
      else:
        print('Yes')
        exit()
print('No')


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


def serch(x0, y0):
  for i in range(M):
    for j in range(M):
      if x0+i >= N or y0+j >= N:
        return False
      if A[x0+i][y0+j] != B[i][j]:
        return False
  return True

if M > N:
  print('No')
  exit()


for x in range(N):
  for y in range(N):
    if not serch(x,y):
      continue
    else:
      print('Yes')
      exit()
print('No')

Buggy python submission (verdict: Runtime Error):
N, M  = map(int, input().split())
A = [ input() for i in range(N)]
B = [ input() for i in range(M)]


def serch(x0, y0):
  for i in range(M):
    for j in range(M):
      if A[x0+i][y0+j] != B[i][j]:
        return False
  return True


for b in B:
  for x in range(N):
    for y in range(N):
      if not serch(x,y):
        continue
      else:
        print('Yes')
        exit()
print('No')


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


def serch(x0, y0):
  for i in range(M):
    for j in range(M):
      if x0+i >= N or y0+j >= N:
        return False
      if A[x0+i][y0+j] != B[i][j]:
        return False
  return True

if M > N:
  print('No')
  exit()


for x in range(N):
  for y in range(N):
    if not serch(x,y):
      continue
    else:
      print('Yes')
      exit()
print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
K, S = map(int,input().split())
listK = [i for i in range(K+1)]
list2K = [i for i in range(K**2)]
ans = 0
for i in range(K+1):
    id = bisect.bisect_left(list2K,S-i)
    if id < len(list2K) and list2K[id] == S-i:
        for j in range(K+1):
            id2 = bisect.bisect_left(listK,list2K[id]-j)
            if id2 < len(listK) and listK[id2] == list2K[id]-j:
                ans += 1
print(ans)

Fixed submission:
K, S = map(int,input().split())
ans = 0
for x in range(K+1):
    for y in range(K+1):
        z = S-x-y
        if 0 <= z and z <= K:
            ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
K, S = map(int,input().split())
listK = [i for i in range(K+1)]
list2K = [i for i in range(K**2)]
ans = 0
for i in range(K+1):
    id = bisect.bisect_left(list2K,S-i)
    if id < len(list2K) and list2K[id] == S-i:
        for j in range(K+1):
            id2 = bisect.bisect_left(listK,list2K[id]-j)
            if id2 < len(listK) and listK[id2] == list2K[id]-j:
                ans += 1
print(ans)

Fixed submission:
K, S = map(int,input().split())
ans = 0
for x in range(K+1):
    for y in range(K+1):
        z = S-x-y
        if 0 <= z and z <= K:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
K, S = map(int,input().split())
listK = [i for i in range(K+1)]
ans = 0
for i in range(K+1):
    for j in range(K+1):
        id = bisect.bisect_left(listK,S-i-j)
        if id < len(listK) and listK[id] == S-i-j:
                ans += 1
print(ans)

Fixed submission:
K, S = map(int,input().split())
ans = 0
for x in range(K+1):
    for y in range(K+1):
        z = S-x-y
        if 0 <= z and z <= K:
            ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
K, S = map(int,input().split())
listK = [i for i in range(K+1)]
ans = 0
for i in range(K+1):
    for j in range(K+1):
        id = bisect.bisect_left(listK,S-i-j)
        if id < len(listK) and listK[id] == S-i-j:
                ans += 1
print(ans)

Fixed submission:
K, S = map(int,input().split())
ans = 0
for x in range(K+1):
    for y in range(K+1):
        z = S-x-y
        if 0 <= z and z <= K:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int,input().split())
ans = 0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k == S:
                ans += 1
print(ans)

Fixed submission:
K, S = map(int,input().split())
ans = 0
for x in range(K+1):
    for y in range(K+1):
        z = S-x-y
        if 0 <= z and z <= K:
            ans += 1
print(ans)