Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np
x = int(input())
r = range(-100,100)
for a in r:
  for b in r:
    if a*a*a*a*a - b*b*b*b*b ==x:
      ans = (a,b)
print(ans)


Fixed submission:
x = int(input())
r = range(-1000,1000)
for a in r:
  for b in r:
    if a*a*a*a*a - b*b*b*b*b == x:
      ans = (a,b)
print(ans[0], ans[1])
Buggy python submission (verdict: Runtime Error):
s = input()
list = ['SUN','MON','TUE','WED','THU','FRY','SAT']
index = 0
for i in list:
    if s == i:
        ans = 7 - index
    index += 1
print(ans)

Fixed submission:
s = input()
list = ['SUN','MON','TUE','WED','THU','FRI','SAT']
index = 0
for i in list:
    if s == i:
        ans = 7 - index
    index += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()

for i in range(3):
	if S[i] == "7":
		print("Yes")
		exit(1)

print("No")

Fixed submission:
S = input()

ans = 0
for i in range(3):
	if S[i] == "7":
		print("Yes")
		ans = 1
		break

if ans == 0:
	print("No")
Buggy python submission (verdict: Runtime Error):
import collections

N = int(input())
data = [input() for i in range(N)]

dicdata = collections.Counter(data)

m = max(dicdata.values())

newdata = [k for k, v in dicdata.items() if v == m]

newdata.sort()

[print(i) for i in newdata]


Fixed submission:
import numpy as np

a, b, c = map(int, input().split())

if (a == b or a == c or b == c) and not(a == b == c):
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import collections

N = int(input())
data = [input() for i in range(N)]

dicdata = collections.Counter(data)

newdata = [k for k, v in dicdata.items() if v == max(dicdata.values())]

newdata.sort()

[print(i) for i in newdata]


Fixed submission:
import collections

N = int(input())
data = [input() for i in range(N)]

dicdata = collections.Counter(data)

m = max(dicdata.values())

newdata = [k for k, v in dicdata.items() if v == m]

newdata.sort()

[print(i) for i in newdata]

Buggy python submission (verdict: Time Limit Exceeded):
import collections
 
N = int(input())
data = list([input() for i in range(N)])
 
dicdata = collections.Counter(data)
 
newdata = [k for k, v in dicdata.items() if v == max(dicdata.values())]
 
newdata = sorted(newdata)
 
[print(i) for i in newdata]

Fixed submission:
import collections

N = int(input())
data = [input() for i in range(N)]

dicdata = collections.Counter(data)

m = max(dicdata.values())

newdata = [k for k, v in dicdata.items() if v == m]

newdata.sort()

[print(i) for i in newdata]

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import collections

N = int(input())
data = list([input() for i in range(N)])

dicdata = collections.Counter(data)

newdata = [k for k, v in dicdata.items() if v == max(dicdata.values())]

newdata = sorted(newdata)

[print(i) for i in newdata]


Fixed submission:
import collections

N = int(input())
data = [input() for i in range(N)]

dicdata = collections.Counter(data)

m = max(dicdata.values())

newdata = [k for k, v in dicdata.items() if v == m]

newdata.sort()

[print(i) for i in newdata]

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())

dicdata = {}
for i in range(N):
	data = input()
	if data in dicdata:
		dicdata[data] += 1
	else:
		dicdata[data] = 1

newdata = [k for k, v in dicdata.items() if v == max(dicdata.values())]

newdata = sorted(newdata)

[print(i) for i in newdata]

Fixed submission:
import collections

N = int(input())
data = [input() for i in range(N)]

dicdata = collections.Counter(data)

m = max(dicdata.values())

newdata = [k for k, v in dicdata.items() if v == m]

newdata.sort()

[print(i) for i in newdata]

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())

dicdata = {}
for i in range(N):
	data = input()
	if data in dicdata:
		dicdata[data] += 1
	else:
		dicdata[data] = 1

newdata = [k for k, v in dicdata.items() if v == max(dicdata.values())]

newdata = sorted(newdata)

for i in range(len(newdata)):
	print(newdata[i])

Fixed submission:
import collections

N = int(input())
data = [input() for i in range(N)]

dicdata = collections.Counter(data)

m = max(dicdata.values())

newdata = [k for k, v in dicdata.items() if v == m]

newdata.sort()

[print(i) for i in newdata]
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

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

m = 0

for i in range(N-K+1):
	ans = 0
	for j in range(i, i+K):
		ans += np.mean(np.array(range(1, x[j]+1))) 

	if ans > m:
		m = ans

print(m)

Fixed submission:
import numpy as np

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

for i in range(N):
	x[i] = (1 + x[i]) / 2

data = np.sum(x[:K])
ans = data

for i in range(N-K):
	data = data + x[i+K] - x[i]
	if data > ans:
		ans = data

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

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

m = 0

for i in range(N-K+1):
	ans = 0
	for j in range(i, i+K):
		ans += np.sum(np.array(range(1, x[j]+1))) / x[j]

	if ans > m:
		m = ans

print(m)

Fixed submission:
import numpy as np

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

for i in range(N):
	x[i] = (1 + x[i]) / 2

data = np.sum(x[:K])
ans = data

for i in range(N-K):
	data = data + x[i+K] - x[i]
	if data > ans:
		ans = data

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

def sum(n):
	s = 0
	y = 1
	while y <= n:
		s += y
		y += 1
	return s

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

m = 0

for i in range(N-K+1):
	ans = 0
	for j in range(i, i+K):
		ans += sum(x[j]) / x[j]

	if ans > m:
		m = ans

print(m)

Fixed submission:
import numpy as np

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

for i in range(N):
	x[i] = (1 + x[i]) / 2

data = np.sum(x[:K])
ans = data

for i in range(N-K):
	data = data + x[i+K] - x[i]
	if data > ans:
		ans = data

print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

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

x = list(map(int, input().split()))

win = 0
for i in range(N):
	for j in range(i+1, N):
		if x[i] + x[j] >= H:
			win = 1
			print("Yes")
			break
	if win == 1:
		break


if win == 0:
	print("No")

Fixed submission:
import numpy as np

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

ans = N // A

if N%A>0:
	ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

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

x = np.array(list(map(int, input().split())))

x = np.sort(x)[::-1]

if x[0] + x[1] >= H:
	print("Yes")
else:
	print("No")


Fixed submission:
import numpy as np

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

x = np.array(list(map(int, input().split())))

if sum(x) >= H:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np

x = list(map(int, input().split()))

N, M = x[0], x[1]

ac, wa = np.array([0 for i in range(N)]), np.array([0 for i in range(N)])

for i in range(M):
    num, result = input().split()
    num = int(num) - 1

    if ac[num] == 1:
        pass
    else:
        if result == "AC":
            ac[num] = 1
        else:
            wa[num] += 1

print(np.sum(ac), np.sum(wa))


Fixed submission:
input_line = input()

print(chr(ord(input_line)+1))
Buggy python submission (verdict: Runtime Error):
import numpy as np
import math

input_line = input().split()

x = int(input_line[0])
y = int(input_line[1])

print((x * y) // math.gcd(x, y))

Fixed submission:
import numpy as np

input_line = input().split()

a = int(input_line[0])
b = int(input_line[1])

x = a * b

if a < b:
	tmp = a
	a = b
	b = tmp

r = a % b
while r != 0:
	a = b
	b = r
	r = a % b

print(int(x / b))
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
x = input().split()

data = [0 for i in range(N)]
for i in range(N):
	data[i] = int(x[i])

nxt = 1
ans = 0

for i in range(N):
	if nxt == data[i]:
		nxt += 1
	else:
		ans += 1
if ans == N:
	print(-1)
	exit(1)

print(ans)

Fixed submission:
import numpy as np

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

nxt = 1
ans = 0

for data in x:
	if nxt == data:
		nxt += 1
	else:
		ans += 1
if ans == N:
	ans = -1

print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
d=[]
for i in range(n):
    d.append(int(input()))
ans=0
for l in range(n):
    for i in range(l+1,n):
        ans+=d[l]*d[i]
print(ans)


Fixed submission:
n=int(input())
d=[]
"""for i in range(n):
    d.append(int(input()))
"""
d=list(map(int,input().split()))

ans=0
for l in range(n):
    for i in range(l+1,n):
        ans+=d[l]*d[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
T=int(input())
A=int(input())

def abs_1(x):
    return abs(A-(T-x*0.006))

H=[]
for i in range(N):
    H.append(int(input()))
abslists=list(map(abs_1,H))

print(abslists)

print(min(abslists))

print(abslists.index(min(abslists))+1)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
lists=[abs(a-(t-x*0.006)) for x in map(int,input().split())]
print(lists.index(min(lists))+1)

Buggy python submission (verdict: Runtime Error):
def abs_1(x):
    return abs(A-(T-x*0.006))
N=int(input())
T=int(input())
A=int(input())
H=[]
for i in range(N):
    H.append(int(input())) 
abslists=list(map(abs_1,H))
print(abslists.index(min(abslists))+1)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
lists=[abs(a-(t-x*0.006)) for x in map(int,input().split())]
print(lists.index(min(lists))+1)

Buggy python submission (verdict: Runtime Error):
N=int(input())
T=int(input())
A=int(input())
"候補地の標高"
H=[]
for i in range(N):
    H.append(int(input()))


def abs_1(x):
    return abs(A-(T-x*0.006))

abslists=list(map(abs_1,H))
print(abslists.index(min(abslists))+1)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
lists=[abs(a-(t-x*0.006)) for x in map(int,input().split())]
print(lists.index(min(lists))+1)

Buggy python submission (verdict: Runtime Error):
N=int(input())
T=int(input())
A=int(input())
"候補地の標高"
H=[]
for i in range(N):
    H.append(int(input()))


def abs_1(x):
    return abs(A-(T-x*0.006))

abslists=list(map(abs_1,H))

print(abslists)

print(min(abslists))

print(abslists.index(min(abslists))+1)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
lists=[abs(a-(t-x*0.006)) for x in map(int,input().split())]
print(lists.index(min(lists))+1)
Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter

n,m,q=map(int,input().split())
l=[]
fa=[m]*n

def check_list(la: list):
    for i in range(len(la)-1):
        if la[i+1]<la[i] or la[i]>m or la[i]<1:
            return False
    
    return True


def dfs(i,a):
    if not check_list(a):
        return -1
    elif i==len(l):
        ret=0
        for i in range(len(a)-1):
            if a[i+1]<a[i] or a[i]>m:
                ret=-1

        for le in l:
            if a[le[1]-1]-a[le[0]-1]==le[2]:
                ret+=le[3]
        return ret
    else:
        c0=a.copy()     # use this (change first)
        c1=a.copy()     # use this (change second)
        c2=a.copy()     # dojn't use this
        c0[l[i][0]-1]=c0[l[i][1]-1]-l[i][2]
        c1[l[i][1]-1]=c1[l[i][0]-1]+l[i][2]
        return max(dfs(i+1,c0),dfs(i+1,c1),dfs(i+1,c2))




for _ in range(q):
    l.append(tuple(map(int,input().split())))


print(dfs(0,fa))

Fixed submission:
import itertools
n,m,q=map(int,input().split())

ql=[]
for _ in range(q):
    ql.append(tuple(map(int,input().split())))

def check(t):
    ret=0
    for q in ql:
        if t[q[1]-1]-t[q[0]-1]==q[2]:
            ret+=q[3]

    return ret

print(max(map(check,itertools.combinations_with_replacement(range(1,m+1),n))))

Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter

n,m,q=map(int,input().split())
l=[]
fa=[m]*n

def check_list(la: list):
    for i in range(len(la)-1):
        if la[i+1]<la[i] or la[i]>m or la[i]<1:
            return False
    
    return True


def dfs(i,a):
    if not check_list(a):
        return -1
    elif i==len(l):
        ret=0
        for i in range(len(a)-1):
            if a[i+1]<a[i] or a[i]>m:
                ret=-1

        for le in l:
            if a[le[1]-1]-a[le[0]-1]==le[2]:
                ret+=le[3]
        return ret
    else:
        c0=a.copy()     # use this (change first)
        c1=a.copy()     # use this (change second)
        c2=a.copy()     # dojn't use this
        c0[l[i][0]-1]=c0[l[i][1]-1]-l[i][2]
        c1[l[i][1]-1]=c1[l[i][0]-1]+l[i][2]
        return max(dfs(i+1,c0),dfs(i+1,c1),dfs(i+1,c2))




for _ in range(q):
    l.append(tuple(map(int,input().split())))

l.sort(key=lambda x:x[3],reverse=True)

print(dfs(0,fa))

Fixed submission:
import itertools
n,m,q=map(int,input().split())

ql=[]
for _ in range(q):
    ql.append(tuple(map(int,input().split())))

def check(t):
    ret=0
    for q in ql:
        if t[q[1]-1]-t[q[0]-1]==q[2]:
            ret+=q[3]

    return ret

print(max(map(check,itertools.combinations_with_replacement(range(1,m+1),n))))
Buggy python submission (verdict: Time Limit Exceeded):
n= int(input())
s = input()

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        if s[i] == s[j]:
            continue
        else:
            for k in range(j+1, n):
                if s[i] == s[k] or s[j] == s[k] or j - i == k - j:
                    continue
                else:
                    ans += 1

print(ans)

Fixed submission:
n= int(input())
s = input()

cnt_r = s.count('R')
cnt_g = s.count('G')
cnt_b = s.count('B')

ans = cnt_r * cnt_g * cnt_b

for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
            ans -= 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())

for i in range(0, Q):
    query = input().split()
    if int(query[0]) == 1:
        S = S[::-1]
    else:
        if int(query[1]) == 1:
            S = query[2] + S
        else:
            S = S + query[2]

print(S)


Fixed submission:
S = input()
Q = int(input())
is_norm = True  # Sが元の順番かどうか
s_head = ""     # 元のSに対して先頭側につく文字列
s_tail = ""     # 元のSに対して末尾側につく文字列

for i in range(0, Q):
    query = input().split()
    if int(query[0]) == 1:
        is_norm = not is_norm
    else:
        if is_norm:
            if int(query[1]) == 1:
                s_head = query[2] + s_head
            else:
                s_tail = s_tail + query[2]
        else:
            if int(query[1]) == 1:
                s_tail = s_tail + query[2]
            else:
                s_head = query[2] + s_head

if is_norm:
    print(s_head + S + s_tail)
else:
    print(s_tail[::-1] + S[::-1] + s_head[::-1])
Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
num = [-1] * n


for i in range(m):
    s, c = list(map(int, input().split()))
    if n > 1 and s == 1 and c == 0:
        print(-1)
        exit()
    elif num[s-1] != -1 and num[s-1] != c:
        print(-1)
        exit()
    else:
        num[s-1] = c

for i in range(m):
    if i == 0 and num[i] == -1:
        num[i] = 1
    elif num[i] == -1:
        num[i] = 0

print(int(''.join(list(map(str, num)))))


Fixed submission:
n, m = list(map(int, input().split()))
num = [-1] * n


for i in range(m):
    s, c = list(map(int, input().split()))
    if n > 1 and s == 1 and c == 0:
        print(-1)
        exit()
    elif num[s-1] != -1 and num[s-1] != c:
        print(-1)
        exit()
    else:
        num[s-1] = c

for i in range(n):
    if i == 0 and num[i] == -1:
        if n == 1:
            num[i] = 0
        else:
            num[i] = 1

    elif num[i] == -1:
        num[i] = 0

print(int(''.join(list(map(str, num)))))
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
cnt=0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z==s:
                cnt+=1

print(cnt)

Fixed submission:
k, s = map(int, input().split())
cnt=0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0<=z and z<=k:
            cnt+=1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))
for i in range(N):
    print(A.count(i+1))

Fixed submission:
N = int(input())
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))
    
l = [0]*N
for a in A:
    l[a-1]+=1
for sl in l:print(sl)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))

l = [0]*N
for i in range(max(A)):
    l[i] = A.count(i+1)
for sl in l:
    print(sl)

Fixed submission:
N = int(input())
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))
    
l = [0]*N
for a in A:
    l[a-1]+=1
for sl in l:print(sl)

Buggy python submission (verdict: Time Limit Exceeded):
ip1 = input()
ip1list = ip1.split(" ")
N = int(ip1list[0])
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))

l = [0]*N
for i in range(max(A)):
    l[i] = A.count(i+1)
for sl in l:
    print(sl)

Fixed submission:
N = int(input())
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))
    
l = [0]*N
for a in A:
    l[a-1]+=1
for sl in l:print(sl)

Buggy python submission (verdict: Time Limit Exceeded):
ip1 = input()
ip1list = ip1.split(" ")
N = int(ip1list[0])
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))

l = [0]*N
for i in range(max(A)):
    l[i] = A.count(i+1)
for sl in l:
    print(sl)

Fixed submission:
N = int(input())
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))
    
l = [0]*N
for a in A:
    l[a-1]+=1
for sl in l:print(sl)
Buggy python submission (verdict: Runtime Error):
ip1 = input().split()
N = int(ip1[0])
L = int(ip1[1])
strings = []
for i in range(N):
    strings.append(input())
strings.sort()
ans = ""
for i in range(len(strings)):
    ans += string[i]

print(ans)


Fixed submission:
ip1 = input().split()
N = int(ip1[0])
L = int(ip1[1])
strings = []
for i in range(N):
    strings.append(input())
strings.sort()
ans = ""
for i in range(len(strings)):
    ans += strings[i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
H=list(map(int,input().split()))
sc=[[0]*N for _ in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    sc[a-1][b-1]=H[b-1]
    sc[b-1][a-1]=H[a-1]

cnt=0
for i in range(N):
    if max(sc[i])<H[i] or max(sc[i])==0:
        cnt+=1

print(cnt)

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))

flag=[True]*N
for i in range(M):
    a,b=map(int,input().split())
    ha=H[a-1]
    hb=H[b-1]
    if ha==hb:
        flag[a-1]=False
        flag[b-1]=False
    elif ha<hb:
        flag[a-1]=False
    else:
        flag[b-1]=False
cnt=0
for f in flag:    
    if f:
        cnt+=1

print(cnt)
Buggy python submission (verdict: Runtime Error):
cnt=0
S=str(input())
mc=[0]*2019
L=len(S)

tg=0
digit=1
for s in S[::-1]:
    tg+=int(s)*digit
    mt=tg%2019
    if mt==0:cnt+=1
    cnt+=mc[mt]
    mc[mt]+=1
    digit*=10
    
print(cnt)


Fixed submission:
S,W=map(int,input().split())

if W>=S:
    print('unsafe')
else:
    print('safe')
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

ans=0
for i in range(1,N):
    ans+=i
print(ans)
    


Fixed submission:
N=int(input())

ans=N*(N-1)//2
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

ans=0
for i in range(1,N):
    ans+=i%(i+1)
print(ans)
    


Fixed submission:
N=int(input())

ans=N*(N-1)//2
    
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=c=0
for i in range(N+1):
    a=A[i]
    b=B[i]
    ans+=min(a,c)
    a=max(a-c,0)
    ans+=min(a,b)
    c=max(b-a,0)
print(ans)


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))+[0]
ans=c=0
for i in range(N+1):
    a=A[i]
    b=B[i]
    ans+=min(a,c)
    a=max(a-c,0)
    ans+=min(a,b)
    c=max(b-a,0)
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
N,K=map(int,input().split())
R=N-K
D=int(10**9+7)


def cnr(n,r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1,K+1):
    print(cnr(K-1,i-1)*cnr(R+1,i)%D)


Fixed submission:
import math
N,K=map(int,input().split())
R=N-K
mod = 10**9+7    
def cnr(n,r):
    a=math.factorial(n)
    b=math.factorial(n - r)
    c=math.factorial(r)
    return a//(b*c)

# def cmb(n, r, mod):
#     if ( r<0 or r>n ):
#         return 0
#     r = min(r, n-r)
#     return g1[n] * g2[r] * g2[n-r] % mod


# N = 10**5
# g1 = [1, 1]
# g2 = [1, 1]
# inverse = [0, 1]

# for i in range( 2, N + 1 ):
#     g1.append( ( g1[-1] * i ) % mod )
#     inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
#     g2.append( (g2[-1] * inverse[-1]) % mod )


for i in range(1,K+1):
    if R+2>i:
        print(cnr(K-1,i-1)*cnr(R+1,i)%mod)
    else:
        print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)]) == '.'
T=np.zeros((H,W))
B=np.zeros((H,W))
L=np.zeros((H,W))
R=np.zeros((H,W))

for j in range(W):
    nt=0
    for i in range(1,H):  
        if S[i-1,j]:
            nt+=1          
        else:
            nt=0
        T[i,j]=nt

for j in range(W):
    nt=0
    for i in reversed(range(H-1)):
        if S[i+1,j]:
            nt+=1          
        else:
            nt=0
        B[i,j]=nt

for i in range(H):
    nt=0
    for j in range(1,W):
        if S[i,j-1]:
            nt+=1          
        else:
            nt=0
        L[i,j]=nt

for i in range(H):
    nt=0
    for j in reversed(range(W-1)):
        if S[i,j+1]:
            nt+=1          
        else:
            nt=0
        R[i,j]=nt

na=0
for i in range(H):
    for j in range(W):
        if S[i,j]:
            nat=int(T[i,j]+B[i,j]+L[i,j]+R[i,j]+1)
            na=max(nat,na)

print(na)
#print(T)



Fixed submission:
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)]) == '.'
T=np.zeros((H,W),dtype=int)
B=np.zeros((H,W),dtype=int)
L=np.zeros((H,W),dtype=int)
R=np.zeros((H,W),dtype=int)

for i in range(1,H):  
    T[i,:]=(T[i-1,:]+1)*S[i-1,:]

for i in reversed(range(H-1)):
    B[i,:]=(B[i+1,:]+1)*S[i+1,:]

for j in range(1,W):
    L[:,j]=(L[:,j-1]+1)*S[:,j-1]        

for j in reversed(range(W-1)):
    R[:,j]=(R[:,j+1]+1)*S[:,j+1]
        

na=((T+B+L+R)*S).max()+1

print(na)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)]) == '.'
na=0
for i in range(H):
    for j in range(W):
        if S[i,j]:
            nat=1
            for ibw in reversed(range(i)):
                if S[ibw,j]:
                    nat+=1
                else:
                    break
            for ifw in range(i+1,H):
                if S[ifw,j]:
                    nat+=1
                else:
                    break
            for jbw in reversed(range(j)):
                if S[i,jbw]:
                    nat+=1
                else:
                    break
            for jfw in range(j+1,W):
                if S[i,jfw]:
                    nat+=1
                else:
                    break
            na=max(nat,na)

print(na)


Fixed submission:
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)]) == '.'
T=np.zeros((H,W),dtype=int)
B=np.zeros((H,W),dtype=int)
L=np.zeros((H,W),dtype=int)
R=np.zeros((H,W),dtype=int)

for i in range(1,H):  
    T[i,:]=(T[i-1,:]+1)*S[i-1,:]

for i in reversed(range(H-1)):
    B[i,:]=(B[i+1,:]+1)*S[i+1,:]

for j in range(1,W):
    L[:,j]=(L[:,j-1]+1)*S[:,j-1]        

for j in reversed(range(W-1)):
    R[:,j]=(R[:,j+1]+1)*S[:,j+1]
        

na=((T+B+L+R)*S).max()+1

print(na)