Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
for _ in range(min(k,int(n**0.5)+10)):
  add_a=[0]*(n+1)
  for i in range(n):
    a[i]
    add_a[max(0,i-a[i])]+=1
    add_a[min(n,i+a[i]+1)]-=1
  tmp=0
  for i in range(n):
    tmp+=add_a[i]
    a[i]=tmp
print(' '.join(map(str,a)))


### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
for _ in range(min(k,int(n**0.5)+10)):
  add_a=[0]*(n+1)
  for i in range(n):
    a[i]
    add_a[max(0,i-a[i])]+=1
    add_a[min(n,i+a[i]+1)]-=1
  tmp=0
  for i in range(n):
    tmp+=add_a[i]
    a[i]=tmp
print(' '.join(map(str,a)))
### BUGGY CODE ###

n=int(input())
a = [i for i in range(n+1)]
res=0
time = 0
for i in range(1,n+1):
  cnt = n // a[i]
  res += a[i]*cnt*(cnt+1)//2
  #print(res)

print(res)


### FIXED CODE ###

n=int(input())
a = [i for i in range(n+1)]
res=0
time = 0
for i in range(1,n+1):
  cnt = n // a[i]
  res += a[i]*cnt*(cnt+1)//2
  #print(res)

print(res)
### BUGGY CODE ###

import math
K = int(input())      
ans = 0           
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            ans += math.gcd(math.gcd(a,b),math.gcd(b,c))
print(ans)

### FIXED CODE ###

import math
K = int(input())      
ans = 0           
for a in range(1,K+1):
    for b in range(1,K+1):
        g = math.gcd(a,b)
        for c in range(1,K+1):
            ans += math.gcd(g,c)
print(ans)
### BUGGY CODE ###

n,x,y=map(int,input().split())
s=[]
for i in range(1,n):
  for j in range(i+1,n+1):
    s.append(min(j-i,abs(x-j)+1+abs(y-i),abs(x-i)+1+abs(y-j)))
for l in range(1,n):
  print(s.count(l))

### FIXED CODE ###

n,x,y=map(int,input().split())
res=[0]*n
for i in range(1,n):
  for j in range(i+1,n+1):
    s=(min(j-i,abs(x-j)+1+abs(y-i),abs(x-i)+1+abs(y-j)))
    res[s]+=1
for k in range(1,n):
  print(res[k])
### BUGGY CODE ###

S = input()
N = len(S)
K = int(input())
Data = set()

for s in range(N):
    for e in range(s+1,N+1):
        Data.add(S[s:e])
print(sorted(Data)[K-1])

### FIXED CODE ###

S = input()
N = len(S)
K = int(input())
Data = set()

for s in range(N):
    for e in range(s+1,min(N+1,s+1+K+1)):
        Data.add(S[s:e])
print(sorted(Data)[K-1])
### BUGGY CODE ###

from collections import Counter
N = int(input())
A = list(map(int, input().split()))

A.sort()
ans = 0

for i in range(N):
  flg = True
  for j in range(N):
    if i == j:
      continue
    if A[i] < A[j]:
      break
    elif A[i] % A[j] == 0:
      flg = False
      break
  if flg:
    ans += 1
      

print(ans)

### FIXED CODE ###

import sys
import numpy as np
#from numba import njit
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
#@njit('(i4[::1],)', cache=True)
def solve(A):
    count = np.zeros(10**6 + 10, np.int32)
    for x in A:
        if count[x] > 1:
            continue
        count[::x] += 1
    ret = 0
    for x in A:
        ret += count[x] == 1
    return ret

A = np.array(read().split(), np.int32)[1:]
 
print(solve(A))
### BUGGY CODE ###

n = int(input())
a_list = list(map(int, input().split()))
dic = {}
i_list = []
for a in a_list:
    dic[a] = 0
for a in a_list:
    dic[a] += 1
for i in a_list:
    if i not in i_list:
        i_list.append(i)
ans = 0
for i in i_list:
    p = dic[i] - i 
    if p >= 0:
        ans += p
    else:
        ans += dic[i]
print(ans)

### FIXED CODE ###

n = int(input())
a_list = list(map(int, input().split()))
dic = {}
i_list = []
for a in a_list:
    dic[a] = 0
for a in a_list:
    dic[a] += 1
    if dic[a] == 1:
        i_list.append(a)
ans = 0
for i in i_list:
    p = dic[i] - i 
    if p >= 0:
        ans += p
    else:
        ans += dic[i]
print(ans)
### BUGGY CODE ###

h,w = map(int,input().split())
s = [input() for i in range(h)]
cost = [[2500] * w for i in range(h)]
cost[0][0] = 1
wall = 0
for i in range(h):
  for j in range(w):
    if s[i][j] == '#':
      wall += 1
for k in range(h*w):
  for i in range(h):
    for j in range(w):
      if s[i][j] != '#':
        u = cost[i-1][j] + 1 if i > 0 and s[i-1][j] != '#' else 2500
        d = cost[i+1][j] + 1 if i < h-1 and s[i+1][j] != '#' else 2500
        l = cost[i][j-1] + 1 if j > 0 and s[i][j-1] != '#' else 2500
        r = cost[i][j+1] + 1 if j < w-1 and s[i][j+1] != '#' else 2500
        cost[i][j] = min(cost[i][j], u, d, l, r)

if cost[h-1][w-1] == 2500:
  print(-1)
else:
  print(h*w - cost[h-1][w-1] - wall)

### FIXED CODE ###

h,w = map(int,input().split())
s = [input() for i in range(h)]
cost = [[2500] * w for i in range(h)]
cost[0][0] = 1
wall = 0
for i in range(h):
  for j in range(w):
    if s[i][j] == '#':
      wall += 1
for k in range(h*w):
  for i in range(h):
    for j in range(w):
      if s[i][j] != '#':
        u = cost[i-1][j] + 1 if i > 0 and s[i-1][j] != '#' else 2500
        d = cost[i+1][j] + 1 if i < h-1 and s[i+1][j] != '#' else 2500
        l = cost[i][j-1] + 1 if j > 0 and s[i][j-1] != '#' else 2500
        r = cost[i][j+1] + 1 if j < w-1 and s[i][j+1] != '#' else 2500
        cost[i][j] = min(cost[i][j], u, d, l, r)

if cost[h-1][w-1] == 2500:
  print(-1)
else:
  print(h*w - cost[h-1][w-1] - wall)
### BUGGY CODE ###

n=int(input())
s=[input() for i in range(n)]

ssort=[]

for i in range(n):
  a=s[i]
  b=sorted(a)
  ssort.append(b)

cnt=0
for j in range(0,n):
  for k in range(0,n):
    if j!=k:
      if ssort[j]==ssort[k]:
        cnt+=1

print(cnt//2)

### FIXED CODE ###

import collections
n=int(input())
s=[]
a=0

for i in range(n):
    b=list(input())
    b.sort()
    b=str(b)
    s.append(b)

c=collections.Counter(s)

for i in c.values():
    if i>1:
        a+=i*(i-1)//2

print(a)
### BUGGY CODE ###

N = int(input())
T = sorted(list(set([int(input()) for _ in range(N)])), reverse=True)
ret = []
while len(T) > 1:
  C = int(max(T) ** 0.5)
  f = False
  for c in range(2, C + 1):
    if T[-1] < c:
      ret.append(T[-1])
      T = T[:-1]
    T_ =  T[:]
    for i, t in enumerate(T):
      if t % c == 0:
        T_[i] = t // c
        f = True
    if f:
      ret.append(c)
      T = sorted(list(set(T_[:])), reverse=True)
      break
  else:
    break

ret += T
ans = 1
for r in ret:
  ans *= r
print(ans)

### FIXED CODE ###

from collections import deque
N = int(input())
T = list(set([int(input()) for _ in range(N)]))
ret = T[0]

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

for t in T[1:]:
  ret = ret * t // gcd(ret, t)
  
print(ret)
### BUGGY CODE ###

import sys

r=input().split()
n=int(r[0])
k=int(r[1])
h=sorted([int(x.strip()) for x in sys.stdin.readlines()])

d=[h[x+1]-h[x] for x in range(n-1)]

rui=[0]+[sum(d[:x+1]) for x in range(len(d))]

dd=[rui[x+k-1]-rui[x] for x in range(n-k+1)]
ans=min(dd)
            
print(ans)

### FIXED CODE ###

import sys

r=input().split()
n=int(r[0])
k=int(r[1])
h=sorted([int(x.strip()) for x in sys.stdin.readlines()])

d=[h[x+k-1]-h[x] for x in range(n-k+1)]
ans=min(d)
            
print(ans)
### BUGGY CODE ###

n, k, q = map(int, input().split())
cnt = k-q
a = [int(input()) for i in range(q)]

for j in range(1,n+1):
    if cnt+a.count(j)>0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

n, k, q = map(int, input().split())
b=[k-q]*n

for i in range(q):
    ctn = int(input())
    b[ctn-1]+=1

for j in range(n):
    if b[j]>0:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

from itertools import combinations 

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

def is_triangle(a, b, c):
	return (a+b > c and a+c > b and b+c > a)

count = 0

for a, b, c in combinations(arr, 3):
	if is_triangle(a, b, c):
		count += 1
print(count)

### FIXED CODE ###

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

arr.sort()
count = 0
for i in range(n-1, 0, -1):
	l, r = 0, i - 1
	while l < r:
		if arr[l] + arr[r] > arr[i]:
			count += r - l
			r -= 1
		else:
			l += 1
print(count)
### BUGGY CODE ###

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

reply = []
for i in range(len(a_list)):
    reply.append(str(a_list.index(i+1)+1))

print(' '.join(reply))

### FIXED CODE ###

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

reply = [None for i in range(len(a_list))]

for i,a in enumerate(a_list):
    reply[a-1] = str(i+1)

print(' '.join(reply))
### BUGGY CODE ###

S = input()
n = len(S)
a = int(S)
l = [0]*2019
t = pow(10, n-1)

l[a%2019] += 1

for i in range(n):
    a = a - int(S[i])*t
    l[a%2019] += 1
    t = t // 10

ans = 0
for i in l:
    ans += i*(i-1)//2
print(ans)


### FIXED CODE ###

import sys

input = sys.stdin.readline

S = input().rstrip()
n = len(S)
l = [0]*2019
d = 10

t = int(S[n-1])
l[t%2019] += 1

l[0] += 1

for i in range(n-2, -1, -1):
    t += int(S[i])*d%2019
    l[t%2019] += 1 
    d *= 10
    d %= 2019

ans = 0

for i in l:
    ans += i*(i-1)//2

print(ans)
### BUGGY CODE ###

R, C, K = map(int, input().split())
rcvs = [list(map(int, input().split())) for _ in range(K)]

for i in range(len(rcvs)):
    rcvs[i][0] -= 1
    rcvs[i][1] -= 1

rewards = [[0 for _ in range(C)] for _ in range(R)]

for rcv in rcvs:
    rewards[rcv[0]][rcv[1]] = rcv[2]
    
#%%

dp = [[[0 for _ in range(4)] for _ in range(C+1)] for _ in range(R+1)]
answer = 0

for i in range(R):
    for j in range(C):
        reward = rewards[i][j]
        
        dp[i+1][j+1][0] = max(dp[i][j+1])
        for k in range(4): # move downside without selecting
            if dp[i][j+1][k] + reward > dp[i+1][j+1][1]:
                dp[i+1][j+1][1] = dp[i][j+1][k] + reward
                
        for k in range(4): # move downside without selecting
            if dp[i+1][j][k] > dp[i+1][j+1][k]:
                dp[i+1][j+1][k] = dp[i+1][j][k]
            if k <= 2:
                if dp[i+1][j][k] + reward > dp[i+1][j+1][k+1]:
                    dp[i+1][j+1][k+1] = dp[i+1][j][k] + reward
print(max(dp[-1][-1]))

### FIXED CODE ###

import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
import sys

R, C, K = map(int, input().split())
rcvs = [list(map(int, input().split())) for _ in range(K)]
rcvs = np.array(rcvs, dtype=np.int64)

@njit(i8(i8[:,:]), cache=True)
def main(rcvs):
    rewards = np.zeros((R, C), dtype=np.int64)
    
    for i in range(len(rcvs)):
        rewards[rcvs[i][0]-1][rcvs[i][1]-1] = rcvs[i][2]
    
    dp = np.zeros((R+1, C+1, 4), dtype=np.int64)
    
    for i in range(R):
        for j in range(C):
            reward = rewards[i][j]
            dp[i+1][j+1][0] = max(dp[i][j+1])
            dp[i+1][j+1][1] = dp[i+1][j+1][0] + reward
            
            for k in range(4): # move downside without selecting
                dp[i+1][j+1][k] = max(dp[i+1][j][k], dp[i+1][j+1][k])
            if reward > 0:
                for k in range(3):
                    dp[i+1][j+1][k+1] = max(dp[i+1][j][k]+reward,dp[i+1][j+1][k+1])
    return max(dp[-1][-1])

print(main(rcvs))
### BUGGY CODE ###

from itertools import accumulate
N, M, K = map(int, input().split())
A = [0] + list(accumulate([int(i) for i in input().split()]))
B = [0] + list(accumulate([int(i) for i in input().split()]))
ans = 0
for n in range(N+1):
    a = A[n]
    for m in reversed(range(M+1)):
        if a + B[m] <= K:
            ans = max(ans, n+m)
print(ans)

### FIXED CODE ###

import itertools
N,M,K = map(int,input().split())
A = [0]+list(map(int,input().split()))
B = [0]+list(map(int,input().split()))
SA = list(itertools.accumulate(A))
SB = list(itertools.accumulate(B))
ans = 0
j = len(B)-1
for i in range(len(SA)):
    while(j>=0):
        if SA[i] + SB[j] <= K:
            ans = max(ans,i+j)
            break
        j-=1
print (ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

import heapq

INF = 10 ** 10

class Edge():
    def __init__(self, end, cost):
        self.end = end
        self.cost = cost

def dijkstra(n, G, s):
    dist = [INF] * n
    dist[s] = 0
    h = []
    heapq.heappush(h, (0, s))

    while h:
        # 使っていない頂点のうち、現時点で最も距離の近いものを選びvとする
        d, v = heapq.heappop(h)
        if dist[v] < d:
            continue
        # vから到達可能な頂点について、距離が短くなれば更新
        for e in G[v]:
            if dist[e.end] > dist[v] + e.cost:
                dist[e.end] = dist[v] + e.cost
                heapq.heappush(h, (dist[e.end], e.end))
    return dist


H, W = map(int, input().split())
N = H * W
ch, cw = map(lambda x:int(x)-1, input().split())
gh, gw = map(lambda x:int(x)-1, input().split())

s = []
es = [[] for i in range(N)]

for h in range(H):
   s.append(input().rstrip('\n'))

for h in range(H):
    for w in range(W):
        if s[h][w] != '.':
            continue
        for dh in (-2, -1, 0, 1, 2):
            for dw in (-2, -1, 0, 1, 2):
                if dh == 0 and dw == 0:
                    continue
                nh = h + dh
                nw = w + dw
                if 0 <= nh and nh < H and 0 <= nw and nw < W and s[nh][nw] == '.':
                    a = h*W+w
                    b = nh*W+nw
                    if (dh, dw) in [(-1,0),(1,0),(0,-1),(0,1)]:
                        es[a].append(Edge(b, 0))
                    else:
                        es[a].append(Edge(b, 1))

dist = dijkstra(N, es, ch*W+cw)
if dist[gh*W+gw] == INF:
    print(-1)
else:
    print(dist[gh*W+gw])

### FIXED CODE ###

import sys
input = sys.stdin.readline

import heapq

INF = 10 ** 10

def dijkstra(n, G, s):
    dist = [INF] * n
    dist[s] = 0
    h = []
    heapq.heappush(h, (0, s))

    while h:
        # 使っていない頂点のうち、現時点で最も距離の近いものを選びvとする
        d, v = heapq.heappop(h)
        if dist[v] < d:
            continue
        # vから到達可能な頂点について、距離が短くなれば更新
        for end, cost in G[v]:
            if dist[end] > dist[v] + cost:
                dist[end] = dist[v] + cost
                heapq.heappush(h, (dist[end], end))
    return dist


H, W = map(int, input().split())
N = H * W
ch, cw = map(lambda x:int(x)-1, input().split())
gh, gw = map(lambda x:int(x)-1, input().split())

s = []
es = tuple([] for i in range(N))

for h in range(H):
   s.append(input().rstrip('\n'))

for h in range(H):
    for w in range(W):
        if s[h][w] != '.':
            continue
        a = h*W+w
        esappend = es[a].append
        for dh in (-2, -1, 0, 1, 2):
            for dw in (-2, -1, 0, 1, 2):
                if dh == 0 and dw == 0:
                    continue
                nh = h + dh
                nw = w + dw
                if 0 <= nh and nh < H and 0 <= nw and nw < W and s[nh][nw] == '.':
                    b = nh*W+nw
                    if (dh, dw) in [(-1,0),(1,0),(0,-1),(0,1)]:
                        esappend((b, 0))
                    else:
                        esappend((b, 1))

dist = dijkstra(N, es, ch*W+cw)
if dist[gh*W+gw] == INF:
    print(-1)
else:
    print(dist[gh*W+gw])
### BUGGY CODE ###

from itertools import product

h, w = map(int, input().split())
iswall = []
for _ in range(h):
    s = input()
    iswall.append([int(c == '#') for c in s])


def getll():
    ls = [[None] * w for _ in range(h)]
    for ih in range(h):
        l = 0
        for iw in range(w):
            if not iswall[ih][iw]:
                l += 1
            else:
                l = 0
            ls[ih][iw] = l
    return ls


def getlr():
    ls = [[None] * w for _ in range(h)]
    for ih in range(h):
        l = 0
        for iw in range(w - 1, -1, -1):
            if not iswall[ih][iw]:
                l += 1
            else:
                l = 0
            ls[ih][iw] = l
    return ls


def getlu():
    ls = [[None] * w for _ in range(h)]
    for iw in range(w):
        l = 0
        for ih in range(h):
            if not iswall[ih][iw]:
                l += 1
            else:
                l = 0
            ls[ih][iw] = l
    return ls


def getld():
    ls = [[None] * w for _ in range(h)]
    for iw in range(w):
        l = 0
        for ih in range(h - 1, -1, -1):
            if not iswall[ih][iw]:
                l += 1
            else:
                l = 0
            ls[ih][iw] = l
    return ls


ll = getll()
lr = getlr()
lu = getlu()
ld = getld()

m = 0
for ih, iw in product(range(h), range(w)):
    light = ll[ih][iw] + lr[ih][iw] + lu[ih][iw] + ld[ih][iw] - 3
    m = max(m, light)

print(m)



### FIXED CODE ###

from itertools import product
import numpy as np

h, w = map(int, input().split())
notwall = []
for _ in range(h):
    s = input()
    notwall.append([int(c == '.') for c in s])

notwall = np.array(notwall)


def getll():
    ls = np.zeros((h, w + 1), dtype=int)

    for i in range(w):
        ls[:, i + 1] = (ls[:, i] + 1) * notwall[:, i]

    ls = ls[:, 1:]
    return ls


def getlr():
    ls = np.zeros((h, w + 1), dtype=int)

    for i in range(w - 1, -1, -1):
        ls[:, i] = (ls[:, i + 1] + 1) * notwall[:, i]

    ls = ls[:, :-1]
    return ls


def getlu():
    ls = np.zeros((h + 1, w), dtype=int)

    for i in range(h):
        ls[i + 1, :] = (ls[i, :] + 1) * notwall[i, :]

    ls = ls[1:, :]
    return ls


def getld():
    ls = np.zeros((h + 1, w), dtype=int)

    for i in range(h - 1, -1, -1):
        ls[i, :] = (ls[i + 1, :] + 1) * notwall[i, :]

    ls = ls[:-1, :]
    return ls


ll = getll()
lr = getlr()
lu = getlu()
ld = getld()

m = max([0, np.max(ll + lr + lu + ld) - 3])

print(m)
### BUGGY CODE ###

[K, S] = list(map(int, input().split()))
count = 0
total = 0
for X in range(K+1):
  if X > S:
    break
  for Y in range(K+1):
    sub = X + Y
    if sub > S:
      break
    Z = S - X - Y
    if 0 <= Z and Z <= K:
      count +=1
      

            
print(count)

### FIXED CODE ###

[K, S] = list(map(int, input().split()))
count = 0
for X in range(K+1):
  for Y in range(K+1):
    Z = S - X - Y
    if 0 <= Z and Z <= K:
      count +=1

print(count)
### BUGGY CODE ###

import sys
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
s = [i for i in S()]
#print(s)

a = [-1 for i in range(N)]
v = []
for i in range(N)[::-1]:
  v.append(s[i])
  v = list(set(v))
  a[i] = len(v)

finished = []
t = ""
ans = 0
for i in range(N-2):
  for j in range(i+1,N-1):
    t = str(s[i]) + str(s[j])
    if t in finished:
      continue
    else:
      ans += a[j + 1]
    finished.append(t)
print(ans)

### FIXED CODE ###

import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
s = S()

cnt = 0
for a in range(10):
    for b in range(10):
        n = 0
        ab = [a,b]
        for i in range(N):
            if int(s[i]) == ab[n]:
                n += 1
            if n == 2:
                for c in range(10):
                    for j in range(i+1,N):
                        if int(s[j]) == c:
                            cnt += 1
                            break
                else:
                    break
print(cnt)
### BUGGY CODE ###

import bisect
import sys
input = sys.stdin.readline
q=int(input())
A=[]
b=0
def f(A,b,n):
  res=0
  for a in A:
    res+=abs(a-n)
  return res+b
for _ in range(q):
  L=[int(i) for i in input().split()]
  if L[0]==1:
    n=bisect.bisect_left(A,L[1])
    A.insert(n,L[1])
    b+=L[2]
  else:
    n=A[(len(A)-1)//2]
    print(n,f(A,b,n))

### FIXED CODE ###

from heapq import heappop
from heapq import heappush
q=int(input())
L,R=[],[]
b_sum=0
l_sum,r_sum=0,0
count=0
mid=0
for _ in range(q):
  
  Q=list(map(int,input().split()))
  if Q[0]==1:
    a,b=Q[1],Q[2]
    count+=1
    b_sum+=b
    if count==1:
      mid=a
    elif count%2==0:
      if a<=mid:
        heappush(L,-a)
        l_sum+=a
        heappush(R,mid)
        r_sum+=mid
      else:
        heappush(L,-mid)
        l_sum+=mid
        heappush(R,a)
        r_sum+=a
    else:
      l,r=-heappop(L),heappop(R)
      if a<l:
        heappush(L,-a)
        l_sum+=a-l
        mid=l
        heappush(R,r)
      elif r<a:
        heappush(L,-l)
        mid=r
        heappush(R,a)
        r_sum+=a-r
      else:
        heappush(L,-l)
        mid=a
        heappush(R,r)

  else:
    if count%2==1:
      print(mid,r_sum-l_sum+b_sum)
    else:
      l=-heappop(L)
      print(l,r_sum-l_sum+b_sum)
      heappush(L,-l)
### BUGGY CODE ###

R, G, B, N = map(int, input().split())

ans = 0
X = N // R
Y = N // G
Z = N // B

for i in range(X + 1):
    for j in range(Y + 1):
        if (N - i * R - j * G) >= 0 and (N - i * R - j * G) % B == 0:
            ans += 1

print(ans)

### FIXED CODE ###

R, G, B, N = map(int, input().split())

ans = 0
X = N // R
Y = N // G
Z = N // B

for i in range(X + 1):
    for j in range(Y + 1):
        if (N - i * R - j * G) >= 0 and (N - i * R - j * G) % B == 0:
            ans += 1

print(ans)
### BUGGY CODE ###

h, w = map(int, input().split())
S = [list(input()) for _ in range(h)]

toUP = [[0] * w for _ in range(h)]
for i in range(w):
  cnt = 0
  for j in range(h):
    if S[j][i] == ".":
      cnt += 1
      toUP[j][i] = cnt
    else:
      cnt = 0

toDOWN = [[0] * w for _ in range(h)]
for i in range(w):
  cnt = 0
  for j in range(h - 1, -1, -1):
    if S[j][i] == ".":
      cnt += 1
      toDOWN[j][i] = cnt
    else:
      cnt = 0

toLEFT = [[0] * w for _ in range(h)]
for i in range(h):
  cnt = 0
  for j in range(w):
    if S[i][j] == ".":
      cnt += 1
      toLEFT[i][j] = cnt
    else:
      cnt = 0
    
toRIGHT = [[0] * w for _ in range(h)]
for i in range(h):
  cnt = 0
  for j in range(w - 1, -1, -1):
    if S[i][j] == ".":
      cnt += 1
      toRIGHT[i][j] = cnt
    else:
      cnt = 0

ans = 0
for i in range(h):
  for j in range(w):
    if S[i][j] == ".":
      ans = max(ans, toUP[i][j] + toDOWN[i][j] + toLEFT[i][j] + toRIGHT[i][j] - 3)
print(ans)


### FIXED CODE ###

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

# L, R, U, D方向の照らされるマス数を事前に計算
L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]

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

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

for i in range(H):
  for j in range(W):
    if S[i][j] == "#":
      U[i][j] = 0
    elif i == 0:
      U[i][j] = 1
    else:
      U[i][j] = U[i - 1][j] + 1

for i in reversed(range(H)):
  for j in range(W):
    if S[i][j] == "#":
      D[i][j] = 0
    elif i == H - 1:
      D[i][j] = 1
    else:
      D[i][j] = D[i + 1][j] + 1

ans = 0
for i in range(H):
  for j in range(W):
    ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)

print(ans)