Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def execute(a, b, c):
    return b+c, a+c, a+b

a, b, c, k = [int(x) for x in stdin.readline().rstrip().split()]

for i in range(k):
    a, b, c = execute(a, b, c)

if a - b > 10e18:
    print('Unfair')
else:
    print(a-b)


Fixed submission:
from sys import stdin

def execute(a, b, c):
    return b+c, a+c, a+b


a, b, c, k = [int(x) for x in stdin.readline().rstrip().split()]

"""
for i in range(k):
    a, b, c = execute(a, b, c)

if a - b > 10e18:
    print('Unfair')
else:
    print(a-b)
"""

if k % 2 == 0:
    print(a-b)
else:
    print(b-a)
Buggy python submission (verdict: Runtime Error):
import string


lowercase = string.ascii_lowercase

s = input()
K = int(input())

substrings = []

stack = list(lowercase)[::-1]

while len(substrings) < 5:
    # print(stack)
    v = stack.pop()
    if v in s:
        substrings.append(v)
        for c in list(lowercase)[::-1]:
            stack.append(v+c)

print(substrings[K-1])


Fixed submission:
import string


lowercase = string.ascii_lowercase

s = input()
K = int(input())

substrings = []

stack = list(lowercase)[::-1]

while len(substrings) < K:
    # print(stack)
    v = stack.pop()
    if v in s:
        substrings.append(v)
        for c in list(lowercase)[::-1]:
            stack.append(v+c)

print(substrings[K-1])

Buggy python submission (verdict: Time Limit Exceeded):
import string


lowercase = string.ascii_lowercase

s = input()
K = int(input())

substrings = ['']

for i in range(K):
    for c in lowercase:
        for string in substrings:
            if string+c in s and string+c not in substrings:
                substrings.append(string+c)

print(sorted(substrings)[K])


Fixed submission:
import string


lowercase = string.ascii_lowercase

s = input()
K = int(input())

substrings = []

stack = list(lowercase)[::-1]

while len(substrings) < K:
    # print(stack)
    v = stack.pop()
    if v in s:
        substrings.append(v)
        for c in list(lowercase)[::-1]:
            stack.append(v+c)

print(substrings[K-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]

maxleft = [0] * (N+2)
maxright = [0] * (N+2)

for i in range(N):
    maxleft[i+1] = max(A[0:i+1])
    maxright[i+1] = max(A[i:])

for i in range(N):
    print(max(maxleft[i], maxright[2+i]))


Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]

maxleft = [0] * (N+2)
maxright = [0] * (N+2)

for i in range(N):
    maxleft[i+1] = max(maxleft[i],A[i])
    maxright[N-i] = max(maxright[N-i+1],A[N-i-1])

for i in range(N):
    print(max(maxleft[i], maxright[2+i]))
Buggy python submission (verdict: Time Limit Exceeded):
def dec(X, d):
    X[1] -= d
    return X


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

task.sort(key=lambda x: x[1])

while task:
    if task[0][1] - task[0][0] < 0:
        print("No")
        exit()
    task = list(map(lambda x: dec(x, task[0][0]), task[1:]))

print("Yes")


Fixed submission:
def dec(X, d):
    X[1] -= d
    return X


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

task.sort(key=lambda x: x[1])
time = 0
for i in range(N):
    time += task[i][0]
    if time > task[i][1]:
        print("No")
        exit()

print("Yes")

Buggy python submission (verdict: Runtime Error):
C:\Users\ryo-2\Anaconda3\python.exe C:/Users/ryo-2/PycharmProjects/atcoder/ABC131/ABC131_D.py
30
384 8895
1725 9791
170 1024
4 11105
2 6
578 1815
702 3352
143 5141
1420 6980
24 1602
849 999
76 7586
85 5570
444 4991
719 11090
470 10708
1137 4547
455 9003
110 9901
15 8578
368 3692
104 1286
3 4
366 12143
7 6649
610 2374
152 7324
4 7042
292 11386
334 5720
Yes

Process finished with exit code 0


Fixed submission:
def dec(X, d):
    X[1] -= d
    return X


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

task.sort(key=lambda x: x[1])
time = 0
for i in range(N):
    time += task[i][0]
    if time > task[i][1]:
        print("No")
        exit()

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

N = int(input())
A = list(map(int, input().split()))
A.sort()
d = deque(A)
if A[0] <= 0 and A[-1] > 0:
    print(sum(map(abs, A)))
    while len(d) > 2:
        while d[1] < 0 and len(d)>2:
            print(list(d))
            x = d.pop()
            y = d.popleft()
            print(x, y)
            d.append(x - y)
        x = d.popleft()
        y = d.pop()
        print(x, y)
        d.appendleft(x - y)
    if len(d) >= 2:
        print(d[1], d[0])

elif A[0] > 0:
    print(sum(A) - 2 * A[0])
    x = d.popleft()
    y = d.pop()
    print(x, y)
    d.appendleft(x - y)
    while len(d) > 2:
        x = d.popleft()
        y = d.pop()
        print(x, y)
        d.appendleft(x - y)
    if len(d) >= 2:
        print(d[1], d[0])
else:
    print(-sum(A) + 2 * A[-1])
    x = d.pop()
    y = d.popleft()
    print(x, y)
    d.append(x - y)
    while len(d) > 2:
        while d[1] < 0 and len(d) > 2:
            x = d.pop()
            y = d.popleft()
            print(x, y)
            d.append(x - y)
        x = d.pop()
        y = d.popleft()
        print(x, y)
        d.appendleft(x - y)
    if len(d) >= 2:
        print(d[1], d[0])


Fixed submission:
from collections import deque

N = int(input())
A = list(map(int, input().split()))
A.sort()
d = deque(A)
if A[0] <= 0 and A[-1] >= 0:
    print(sum(map(abs, A)))
    while len(d) > 2:
        while d[1] < 0:
            x = d.pop()
            y = d.popleft()
            print(x, y)
            d.append(x - y)
        x = d.popleft()
        y = d.pop()
        if d:
            print(x, y)
        else:
            print(y, x)
        d.appendleft(x - y)
    if len(d) >= 2:
        print(d[1], d[0])

elif A[0] > 0:
    print(sum(A) - 2 * A[0])
    x = d.popleft()
    y = d.pop()
    if not d:
        print(y, x)
    else:
        print(x, y)
    d.appendleft(x - y)
    while len(d) > 2:
        x = d.popleft()
        y = d.pop()
        print(x, y)
        d.appendleft(x - y)
    if len(d) >= 2:
        print(d[1], d[0])
else:
    print(-sum(A) + 2 * A[-1])
    x = d.pop()
    y = d.popleft()
    print(x, y)
    d.append(x - y)
    while len(d) > 2:
        while d[1] < 0 and len(d) > 2:
            x = d.pop()
            y = d.popleft()
            print(x, y)
            d.append(x - y)
        x = d.pop()
        y = d.popleft()
        print(x, y)
        d.appendleft(x - y)
    if len(d) >= 2:
        print(d[1], d[0])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
operation = []
ans = 0

for _ in range(M):
    t = tuple(map(int, input().split()))
    operation.append(t)

operation.sort(key=lambda x: x[1], reverse=True)
A.sort()

while A and operation:
    if A[-1] >= operation[0][1]:
        ans += A[-1]
        A.pop(-1)
    else:
        cnt = 0
        for i in range(operation[0][0]):
            if len(A) == i or A[i] > operation[0][1]:
                cnt = i
                break
        else:
            cnt = operation[0][0]
        for _ in range(cnt):
            A.pop(0)
        ans += cnt * operation[0][1]
        operation.pop(0)

ans += sum(A)

print(ans)


Fixed submission:
from collections import deque

N, M = map(int, input().split())
A = list(map(int, input().split()))
operation = []
ans = 0

for _ in range(M):
    t = tuple(map(int, input().split()))
    operation.append(t)

operation.sort(key=lambda x: x[1], reverse=True)
A.sort()
A = deque(A)
operation = deque(operation)

while A and operation:
    if A[-1] >= operation[0][1]:
        ans += A[-1]
        A.pop()
    else:
        cnt = 0
        for i in range(operation[0][0]):
            if len(A) == i or A[i] > operation[0][1]:
                cnt = i
                break
        else:
            cnt = operation[0][0]
        for _ in range(cnt):
            A.popleft()
        ans += cnt * operation[0][1]
        operation.popleft()

ans += sum(A)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
operation = []

for _ in range(M):
    t = tuple(map(int, input().split()))
    operation.append(t)

operation.sort(key=lambda x: x[1], reverse=True)

for i in range(M):
    A.sort()
    if operation[i][1] <= A[0]:
        break
    else:
        for j in range(operation[i][0]):
            if operation[i][1] > A[j]:
                A[j] = operation[i][1]
            else:
                break

print(sum(A))


Fixed submission:
from collections import deque

N, M = map(int, input().split())
A = list(map(int, input().split()))
operation = []
ans = 0

for _ in range(M):
    t = tuple(map(int, input().split()))
    operation.append(t)

operation.sort(key=lambda x: x[1], reverse=True)
A.sort()
A = deque(A)
operation = deque(operation)

while A and operation:
    if A[-1] >= operation[0][1]:
        ans += A[-1]
        A.pop()
    else:
        cnt = 0
        for i in range(operation[0][0]):
            if len(A) == i or A[i] > operation[0][1]:
                cnt = i
                break
        else:
            cnt = operation[0][0]
        for _ in range(cnt):
            A.popleft()
        ans += cnt * operation[0][1]
        operation.popleft()

ans += sum(A)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)


N = int(input())
A = list(map(int, input().split()))

A.sort()
ans = 1

for i in range(N):
    B = A[:]
    B.pop(i)
    tmp=B[0];
    for j in B:
        if(ans>j):
            break
        tmp=gcd(tmp,j)

    ans = max(ans, tmp)

print(ans)

Fixed submission:
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)


N = int(input())
A = list(map(int, input().split()))

L = [0] * (N + 1)
L[0] = 0
R = [0] * (N + 1)
R[0] = 0

for i in range(N):
    L[i + 1] = gcd(L[i], A[i])
    R[i + 1] = gcd(R[i], A[-i - 1])

ans = 0
for i in range(N):
    ans = max(ans, gcd(L[i], R[N - i - 1]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)


N = int(input())
A = list(map(int, input().split()))

A.sort()
ans = 1

for i in range(N):
    B = A[:]
    B.pop(i)
    tmp=B[0];
    for j in B:
        tmp=gcd(tmp,j)

    ans = max(ans, tmp)

print(ans)

Fixed submission:
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)


N = int(input())
A = list(map(int, input().split()))

L = [0] * (N + 1)
L[0] = 0
R = [0] * (N + 1)
R[0] = 0

for i in range(N):
    L[i + 1] = gcd(L[i], A[i])
    R[i + 1] = gcd(R[i], A[-i - 1])

ans = 0
for i in range(N):
    ans = max(ans, gcd(L[i], R[N - i - 1]))
print(ans)

Buggy python submission (verdict: Runtime Error):
import functools
import math

N = int(input())
A = list(map(int, input().split()))

A.sort()
ans = 1

for i in range(N):
    B = A[:]
    B.pop(i)
    gcd = functools.reduce(math.gcd, B)
    ans = max(ans, gcd)

print(ans)

Fixed submission:
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)


N = int(input())
A = list(map(int, input().split()))

L = [0] * (N + 1)
L[0] = 0
R = [0] * (N + 1)
R[0] = 0

for i in range(N):
    L[i + 1] = gcd(L[i], A[i])
    R[i + 1] = gcd(R[i], A[-i - 1])

ans = 0
for i in range(N):
    ans = max(ans, gcd(L[i], R[N - i - 1]))
print(ans)

Buggy python submission (verdict: Runtime Error):
import functools
import math
import copy

N = int(input())
A = list(map(int, input().split()))

A.sort()
ans = 1

for i in range(N):
    B = copy.copy(A)
    B.pop(i)
    gcd = functools.reduce(math.gcd, B)
    ans = max(ans, gcd)

print(ans)

Fixed submission:
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)


N = int(input())
A = list(map(int, input().split()))

L = [0] * (N + 1)
L[0] = 0
R = [0] * (N + 1)
R[0] = 0

for i in range(N):
    L[i + 1] = gcd(L[i], A[i])
    R[i + 1] = gcd(R[i], A[-i - 1])

ans = 0
for i in range(N):
    ans = max(ans, gcd(L[i], R[N - i - 1]))
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline

N, K = map(int, input().split())
h = list(map(int, (input().split())))

dp = [sys.maxsize] * N

dp[0] = 0

for i in range(1, N):
    s = max(0, i - K)
    dp[i] = min(dp[s:i] + abs(h[s:i] - h[i]))

print(dp[N - 1])


Fixed submission:
import sys
import numpy as np

input = sys.stdin.readline

N, K = map(int, input().split())
h = np.array(list(map(int, (input().split()))))

dp = np.full(N,sys.maxsize,dtype=int)

dp[0] = 0

for i in range(1, N):
    s = max(0, i - K)
    dp[i] = min(dp[s:i] + abs(h[i] - h[s:i]))

print(dp[N - 1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys

input = sys.stdin.readline

N, K = map(int, input().split())
h = list(map(int, (input().split())))

dp = [sys.maxsize] * N

dp[0] = 0

for i in range(1, N):
    for j in range(1, K+1):
        if i >= j:
            dp[i] = min(dp[i], dp[i - j] + abs(h[i - j] - h[i]))

print(dp[N - 1])


Fixed submission:
import sys
import numpy as np

input = sys.stdin.readline

N, K = map(int, input().split())
h = np.array(list(map(int, (input().split()))))

dp = np.full(N,sys.maxsize,dtype=int)

dp[0] = 0

for i in range(1, N):
    s = max(0, i - K)
    dp[i] = min(dp[s:i] + abs(h[i] - h[s:i]))

print(dp[N - 1])
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = [["."] * (W + 2)]
for _ in range(H):
    S.append([".", *list(input()), "."])
S.append(["."] * (W + 2))

ans = [[-1] * W for _ in range(H)]

for i in range(1, H + 1):
    for j in range(1, W + 1):
        if S[i][j] == "#":
            continue
        cnt = 0
        if S[i - 1][j - 1] == "#":
            cnt += 1
        if S[i][j - 1] == "#":
            cnt += 1
        if S[i + 1][j - 1] == "#":
            cnt += 1
        if S[i - 1][j] == "#":
            cnt += 1
        if S[i + 1][j] == "#":
            cnt += 1
        if S[i - 1][j + 1] == "#":
            cnt += 1
        if S[i][j + 1] == "#":
            cnt += 1
        if S[i + 1][j + 1] == "#":
            cnt += 1
        ans[i - 1][j - 1] = cnt

for i in ans:
    p = ["#" if x == -1 else x for x in i]
    print(*p, sep="")


Fixed submission:
H, W = map(int, input().split())
S = ["." * (W + 2)]
for _ in range(H):
    S += ["." + input() + "."]
S += ["." * (W + 2)]

ans = [[-1] * W for _ in range(H)]

for i in range(1, H + 1):
    for j in range(1, W + 1):
        if S[i][j] == "#":
            continue
        cnt = 0
        if S[i - 1][j - 1] == "#":
            cnt += 1
        if S[i][j - 1] == "#":
            cnt += 1
        if S[i + 1][j - 1] == "#":
            cnt += 1
        if S[i - 1][j] == "#":
            cnt += 1
        if S[i + 1][j] == "#":
            cnt += 1
        if S[i - 1][j + 1] == "#":
            cnt += 1
        if S[i][j + 1] == "#":
            cnt += 1
        if S[i + 1][j + 1] == "#":
            cnt += 1
        ans[i - 1][j - 1] = cnt

for i in ans:
    p = ["#" if x == -1 else x for x in i]
    print(*p, sep="")
Buggy python submission (verdict: Time Limit Exceeded):
import collections

N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

D.sort()
T2 = collections.Counter(T)

for i in T2.keys():
    if T2[i] > D.count(i):
        print("NO")
        exit()

print("YES")


Fixed submission:
import collections
import bisect

N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

D.sort()
T2 = collections.Counter(T)

for i in T2.keys():
    if T2[i] > bisect.bisect_right(D, i) - bisect.bisect_left(D, i):
        print("NO")
        exit()

print("YES")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(input()) for _ in range(N)]
pikaa = 1
ans = 0
while 1:
    pikaa = a[pikaa - 1]
    ans += 1
    if pikaa == 1:
        print(-1)
        exit()
    elif pikaa == 2:
        print(ans)
        exit()


Fixed submission:
N = int(input())
a = [int(input()) for _ in range(N)]
pikaa = 1
ans = 0
for _ in range(N):
    pikaa = a[pikaa - 1]
    ans += 1
    if pikaa == 2:
        print(ans)
        exit()
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
X = input()

while X.count("ST"):
    X = X.replace("ST", "")

print(len(X))


Fixed submission:
X = input()

ans = ["foo"]
for i in range(len(X)):
    ans.append(X[i])
    if ans[-2] == "S" and ans[-1] == "T":
        ans.pop()
        ans.pop()

print(len(ans) - 1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
b=0
c=0
for h in map(int, input.split()):
  if b<=h:
    b=h
    c+=1
print(c)

Fixed submission:
n=int(input())
b=0
c=0
for h in map(int,input().split()):
  if b<=h:
    b=h
    c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
print("Christmas"+" Eve"*(25-int(input()))

Fixed submission:
print("Christmas"+" Eve"*(25-int(input())))
Buggy python submission (verdict: Runtime Error):
n=int(input()
print((((n-1)//111)+1)*111)

Fixed submission:
n=int(input())
print((((n-1)//111)+1)*111)

Buggy python submission (verdict: Runtime Error):
n=int(input()
print(((n-1)//111)*111+111)

Fixed submission:
n=int(input())
print((((n-1)//111)+1)*111)

Buggy python submission (verdict: Runtime Error):
n=int(input()
print(((n-1)//111)*111+111)

Fixed submission:
n=int(input())
print((((n-1)//111)+1)*111)

Buggy python submission (verdict: Runtime Error):
n=int(input()
print((n-1)//111+111))

Fixed submission:
n=int(input())
print((((n-1)//111)+1)*111)
Buggy python submission (verdict: Runtime Error):
a,b,c = sorted (map(int,input().split())
print(10*c+b+a)

Fixed submission:
a,b,c = sorted (map(int,input().split()))
print(10*c+b+a)
Buggy python submission (verdict: Runtime Error):
n=int(input())
if(n<1200):
  print("ABC")
elif(n<2800):
  print("ARC"):
else:
  print("AGC")

Fixed submission:
print(["ABC","ARC","AGC"][int(input())//50+8>>5])

Buggy python submission (verdict: Runtime Error):
n=int(input())
if(n<1200):
  print("ABC")
elif(n<2800):
  print("ARC"):
elif(n>=2800):
  print("AGC")

Fixed submission:
print(["ABC","ARC","AGC"][int(input())//50+8>>5])
Buggy python submission (verdict: Runtime Error):
a,b,c,d = [int(input()) for_ in range(4)]
print(min(a,b)+min(c,d))

Fixed submission:
a,b,c,d=[int(input()) for _ in range(4)]
print(min(a,b)+min(c,d))

Buggy python submission (verdict: Runtime Error):
a,b,c,d = [int(input()) for_ range(4)]
print(min(a,b)+min(c,d))

Fixed submission:
a,b,c,d=[int(input()) for _ in range(4)]
print(min(a,b)+min(c,d))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input())
print("Yes" if a+b>=c else "No")

Fixed submission:
a,b,c=map(int,input().split())
print("Yes" if a+b>=c else "No")
Buggy python submission (verdict: Runtime Error):
a,b =map(int,input().split())
print(sum(i==i[::-1] for i in map(str,range(a,b+1)))

Fixed submission:
a,b =map(int,input().split())
print(sum(i==i[::-1] for i in map(str,range(a,b+1))))
Buggy python submission (verdict: Runtime Error):
n=int(input())
m=int(input())
print(2m-n)

Fixed submission:
n=int(input())
m=int(input())
print(2*m-n)
Buggy python submission (verdict: Runtime Error):
a,b,c=sorted(map(int,input().split()))
if("c" a==b else "a")

Fixed submission:
a,b,c=sorted(map(int,input().split()))
print(c if a==b else a)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[int for _ in range (h)]
for i in range(h):
  l=""
  for j in range(w):
    if s[i][j]=="#":
      l+="#"
    else:
      l+=str(sum([t[max(0,j-1):min(w,j+2)].count("#") for t in s[max(0,i-1):min(h,i+2)]]))
print(l)

Fixed submission:
h,w=map(int,input().split())
s=[input() for _ in range(h)]
for i in range(h):
    l=""
    for j in range(w):
        if s[i][j]=="#":
            l+="#"
        else:
            l+=str(sum([t[max(0,j-1):min(w,j+2)].count("#") for t in s[max(0,i-1):min(h,i+2)]]))
    print(l)

Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[int for _ in range (h)]
for i in range(h):
  l=""
  for j in range(w):
    if s[i][j]=="#":
      l+="#"
    else:
      l+=str(sum([t[max(0,j-1):min(w,j+2)].count("#") for t in s[max(0,i-1):min(h,i+2)]]))
print(l)

Fixed submission:
h,w=map(int,input().split())
s=[input() for _ in range(h)]
for i in range(h):
    l=""
    for j in range(w):
        if s[i][j]=="#":
            l+="#"
        else:
            l+=str(sum([t[max(0,j-1):min(w,j+2)].count("#") for t in s[max(0,i-1):min(h,i+2)]]))
    print(l)
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int.input().split())
print(max(0,min(b,d)-max(a,c)))

Fixed submission:
a,b,c,d=map(int,input().split())
if(b<=c or d<=a):
  print(0)
else:
  print(abs(min(b,d)-max(a,c)))

Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int.input().split())
print(min(b,d)-(max(a,c))

Fixed submission:
a,b,c,d=map(int,input().split())
if(b<=c or d<=a):
  print(0)
else:
  print(abs(min(b,d)-max(a,c)))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(sum(a+b)%24)

Fixed submission:
print(sum(map(int,input().split()))%24)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=1

for i in range(1,n+1):
  ans*=i
print(ans%(10**9+7))

Fixed submission:
ans=1
n=int(input())
for i in range(1,n+1):
  ans*=i
  ans=ans%(10**9+7)
print(ans)
Buggy python submission (verdict: Runtime Error):
m,n =map(int,input().split())
a=[input() for _ in range(m)]
b=[input() for _ in range(m)]
r=any([r[j:j+m] for r in a[i:i+m]]==b for i in range (n-m+1) for j in range(n-m+1))
print("Yes" if r else "No")

Fixed submission:
n,m =map(int,input().split())
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
r=any([r[j:j+m] for r in a[i:i+m]]==b for i in range (n-m+1) for j in range(n-m+1))
print("Yes" if r else "No")
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
print(max(a*b,c*d)

Fixed submission:
a,b,c,d=map(int,input().split())
print(max(a*b,c*d))
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
a=1
for i in range(n):
  if s[i]!=s[i+1]:
    a+=1
print(a)

Fixed submission:
n=int(input())
s=input()
a=1
for i in range(n-1):
  if s[i]!=s[i+1]:
    a+=1
print(a)
Buggy python submission (verdict: Runtime Error):
N,K,Q = map(int,input().split())
a = [0 for i in range(N)]
for i in range(Q):
  a[int(input())-1]+=1
for i in range(a):
  if K-Q+i>0:
    print("Yes")
  else:
    print("No")

Fixed submission:
N,K,Q = map(int,input().split())
a = [0 for i in range(N)]
for i in range(Q):
  a[int(input())-1]+=1
for i in a:
  if K-Q+i>0:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int,input().split())
a=[]
for i in range(Q):
    a.append(int(input()))
for i in range(N):
	if 0<K-Q+a.count(i+1):
	    print("Yes")
	else:
	    print("No")

Fixed submission:
N,K,Q = map(int,input().split())
a = [0 for i in range(N)]
for i in range(Q):
  a[int(input())-1]+=1
for i in a:
  if K-Q+i>0:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N,K,Q = map(int,input().split())
a=[]
for i in range(Q):
  a.append(int(input()))
for i in range(N):
  if 0<K-Q+a.count(i+1):
	print("Yes")
  else:
	print("No")

Fixed submission:
N,K,Q = map(int,input().split())
a = [0 for i in range(N)]
for i in range(Q):
  a[int(input())-1]+=1
for i in a:
  if K-Q+i>0:
    print("Yes")
  else:
    print("No")