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

#H=4
#W=6
#
#S[0]=["#",".",".","#",".","."]
#S[1]=[".",".",".",".",".","#"]
#S[2]=[".",".",".",".","#","."]
#S[3]=["#",".","#",".",".","."]

H,W=map(int,input().split())
S=[0]*H
for i in range(H):
    S[i]=list(input())


MAP=[[[0,0,0,0] for i in range(W)]for i in range(H)]
#MAP[H][W]

#ue
for i in range(W):
    c=0
    for j in range(H):
        if(S[j][i]=="."):
            c+=1
            MAP[j][i][0]=c
        else:
            c=0
            MAP[j][i][0]=c

#shita
for i in range(W):
    c=0
    for j in range(H-1,-1,-1):
        if(S[j][i]=="."):
            c+=1
            MAP[j][i][1]=c
        else:
            c=0
            MAP[j][i][1]=c

#hidari
for j in range(H):
    c=0
    for i in range(W):
        if(S[j][i]=="."):
            c+=1
            MAP[j][i][2]=c
        else:
            c=0
            MAP[j][i][2]=c

#migi
for j in range(H):
    c=0
    for i in range(W-1,-1,-1):
        if(S[j][i]=="."):
            c+=1
            MAP[j][i][3]=c
        else:
            c=0
            MAP[j][i][3]=c

MAX=0
for i in range(W):
    for j in range(H):
        t=0
        t+=MAP[j][i][0]
        t+=MAP[j][i][1]
        t+=MAP[j][i][2]
        t+=MAP[j][i][3]  
        t-=3              
        MAX=max(MAX,t)
print(MAX)

### FIXED CODE ###

#H=4
#W=6
#
#S[0]=["#",".",".","#",".","."]
#S[1]=[".",".",".",".",".","#"]
#S[2]=[".",".",".",".","#","."]
#S[3]=["#",".","#",".",".","."]

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

S = [[0]*W for i in range(H)]

for i in range(H):
    T=list(input())
    for j in range(W):
        if T[j] == "#":
            S[i][j] = 0
        else:
            S[i][j] = 1
MAP=[[0]*(W+2) for i in range(H+2)]
MAPH=[[0]*(W+2) for i in range(H+2)]
MAPU=[[0]*(W+2) for i in range(H+2)]
MAPL=[[0]*(W+2) for i in range(H+2)]
MAPR=[[0]*(W+2) for i in range(H+2)]

MAX=0

for i in range(1,W+1):
    for j in range(1,H+1):
            MAPH[j][i]=(MAPH[j-1][i]+1)*S[j-1][i-1]
            MAP[j][i]+=MAPH[j][i]
            MAPU[H-j+1][W-i+1]=(MAPU[H-j+2][W-i+1]+1)*S[H-j][W-i]
            MAP[H-j+1][W-i+1]+=MAPU[H-j+1][W-i+1]
for j in range(1,H+1):
    for i in range(1,W+1):
            MAPL[j][i]=(MAPL[j][i-1]+1)*S[j-1][i-1]
            MAP[j][i]+=MAPL[j][i]
            MAPR[H-j+1][W-i+1]=(MAPR[H-j+1][W-i+2]+1)*S[H-j][W-i]
            MAP[H-j+1][W-i+1]+=MAPR[H-j+1][W-i+1]
            MAX=max(MAX,MAP[j][i]-3,MAP[H-j+1][W-i+1]-3)
print(MAX)
### BUGGY CODE ###

# 2020-05-22
from collections import deque


def main():
    n, m, k = [int(x) for x in input().split()]
    friends = [set() for _ in range(n)]
    blocks = [set() for _ in range(n)]
    for _ in range(m):
        a, b = [int(x) - 1 for x in input().split()]
        friends[a].add(b)
        friends[b].add(a)
    for _ in range(k):
        a, b = [int(x) - 1 for x in input().split()]
        blocks[a].add(b)
        blocks[b].add(a)

    ansers = []
    ansers_append = ansers.append
    for person in range(n):
        stack = deque()
        stack_append = stack.append
        stack_pop = stack.popleft
        stack_append(person)
        link = {person}
        link_add = link.add
        while stack:
            new = stack_pop()
            for adj in friends[new]:
                if adj in link:
                    continue
                stack_append(adj)
                link_add(adj)
        # 友達をたどるとブロック対象に着くことがある。積集合 &。
        ans = len(link) - len(friends[person]) - len(link & blocks[person]) - 1
        ansers_append(ans)

    return ' '.join(str(x) for x in ansers)


if __name__ == '__main__':
    print(main())


### FIXED CODE ###

# 2020-05-22
def main():
    n, m, k = [int(x) for x in input().split()]
    friends = [set() for _ in range(n)]
    blocks = [set() for _ in range(n)]
    for _ in range(m):
        a, b = [int(x) - 1 for x in input().split()]
        friends[a].add(b)
        friends[b].add(a)
    for _ in range(k):
        a, b = [int(x) - 1 for x in input().split()]
        blocks[a].add(b)
        blocks[b].add(a)

    networks = {}  # The dict of networks as sets. Keys are leaders.
    net_leaders = [-1] * n  # The leaders of the networks that the ones joined.
    visited = [False] * n
    for person in range(n):
        if visited[person]:
            continue
        network = set()
        network_add = network.add
        stack = [person]
        stack_append = stack.append
        stack_pop = stack.pop
        while stack:
            new = stack_pop()
            visited[new] = True
            net_leaders[new] = person
            network_add(new)
            for adj in friends[new]:
                if visited[adj]:
                    continue
                stack_append(adj)
        networks[person] = network

    answers = []
    answers_append = answers.append
    for person in range(n):
        net = networks[net_leaders[person]]
        ans = len(net) - len(friends[person]) - 1
        for block in blocks[person]:
            if block in net:
                ans -= 1
        answers_append(ans)

    print(*answers)
    return


if __name__ == '__main__':
    main()
### BUGGY CODE ###

def soi(n,s,m):
    if n == 0:
        if s == 0:
            return 1
        else:
            return 0
    else:
        count = 0
        for i in range(m,101):
            if s-i >= 0:
                count += soi(n-1,s-i,i+1)
        return count

while True:
    n, s = map(int, raw_input().split())
    if n == 0:
        break
    print soi(n,s,0)

### FIXED CODE ###

ls = [[0]*1001 for i in range(10)]
ls[0][0] = 1
for i in range(101):
	for j in range(9,0,-1):
		for k in range(i,1000):
			ls[j][k] += ls[j-1][k-i] 
	

while True:
	n,s = map(int, raw_input().split())
	if n == 0: break
	print ls[n][s]
### BUGGY CODE ###

n = int(input())
a = [input() for _ in range(n)]
a_dict = {i:0 for i in set(a)}

for i in a:
    for j in a_dict:
        if i == j:
            a_dict[j] += 1

ans = []
max_value = max(a_dict.values())
for key, value in a_dict.items():
    if value == max_value:
        ans.append(key)

ans.sort()
for i in ans:
    print(i)

### FIXED CODE ###

n = int(input())

# 入力データ受取り時に、辞書に追加していくやり方
s_dict = {}
for i in range(n):
    s = input()    
    if s not in s_dict:
        s_dict[s] = 1
    s_dict[s] += 1

max_value = max(s_dict.values())
ans = []
for key, value in s_dict.items():
    if value == max_value:
        ans.append(key)

ans.sort()
for i in ans:
    print(i)
### BUGGY CODE ###

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

count = 0
for i in range(0, N-1):
    iai  = i + A[i]
    for j in range(iai+1, N):
        if iai == j - A[j]:
            count += 1

print(count)

### FIXED CODE ###

N = int(input())
A = tuple(map(int, input().split()))
AI = tuple(i + a for i, a in enumerate(A))
AJ = tuple(i - a for i, a in enumerate(A))

cai = {}
caj = {}
vali = set()
valj = set()
for ai, aj in zip(AI, AJ):
    if not ai in cai:
        cai[ai] = 0
    if not aj in caj:
        caj[aj] = 0

    cai[ai] += 1
    vali.add(ai)

    caj[aj] += 1
    valj.add(aj)

count = 0
for val in vali & valj:
    count += cai[val] * caj[val]

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

n = int(input())

G = [1]
while True:
	g = G[-1] * 3 + 1
	if g > n:
		break
	G.append(g)
G.reverse()

A = [int(input()) for _ in range(n)]
cnt = 0
for g in G:
	for j, v in enumerate(A[g:]):
		while j >= 0 and A[j] > v:
			A[j+g] = A[j]
			j = j - g
			cnt += 1
		A[j+g] = v

print(len(G))
print(*G)
print(cnt)
for a in A:
	print(a)


### FIXED CODE ###

import sys

n = int(input())
if n == 1:
	G = [1]
else:
	G = [g for g in [1, 4, 10, 23, 57, 132, 301, 701] if g < n]
	while True:
		g = int(2.25 * G[-1])
		if g > n:
			break
		G.append(g)
	G.reverse()

A = list(map(int, sys.stdin))
cnt = 0
for g in G:
	for j, v in enumerate(A[g:]):
		while j >= 0 and A[j] > v:
			A[j+g] = A[j]
			j -= g
			cnt += 1
		A[j+g] = v

print(len(G))
print(*G)
print(cnt)
for a in A:
	print(a)
### BUGGY CODE ###

n = int(input())
a = [int(i) for i in input().split()]
for i in range(n):
    y = [0] + a[:i] + a[i+1:] + [0]
    sm = 0
    
    for j in range(1,n+1):
        sm += abs(y[j]-y[j-1])
    print(sm)

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
a = [0] + a + [0]
dist = 0

for i in range(1,n+2):
    dist = dist + abs(a[i]-a[i-1])

for i in range(1,n+1):
    ans = dist + abs(a[i+1]-a[i-1]) - (abs(a[i-1]-a[i])+abs(a[i]-a[i+1]))
    print(ans)
### BUGGY CODE ###

N = int(input())
list_P = [int(x) for x in input().split()]

ans = 1

for i in range(1, len(list_P)) :
    if list_P[i] < min(list_P[:i]) :
        ans += 1

print(ans)


### FIXED CODE ###

N = int(input())
list_P = [int(x) for x in input().split()]

ans = 0
min = N+1

for i in list_P :
    if i < min :
        ans += 1
        min = i

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

from copy import deepcopy


def solve(road, num, ans, n):
    pattern = 0
    test = deepcopy(road)
    if ans.count(str(num)) > 1:
        return 0
    if len(ans) is n:
        return 1
    if len(road[num - 1]) == int(0):
        return 0
    else:
        for i in range(len(road[num - 1])):
            tmp = test[num - 1][-1]
            if tmp is not 0:
                word = ans + str(tmp)
            test[num - 1].pop()
            pattern += solve(test, tmp, word, n)
    return pattern


N, M = [int(i) for i in input().split()]
town = []
for i in range(N):
    town.append(deepcopy([]))

for i in range(M):
    a, b = [int(i) for i in input().split()]
    town[a - 1].append(b)
    town[b - 1].append(a)
print(solve(town, 1, '1', N))


### FIXED CODE ###

from copy import deepcopy


def solve(road, num, ans, n):
    pattern = 0
    test = deepcopy(road)
    for s in test:
        if num in s:
            s.remove(num)
    if len(ans) is n:
        return 1
    if len(test[num - 1]) == int(0):
        return 0
    else:
        for i in range(len(test[num - 1])):
            tmp = test[num - 1][i]
            if tmp is not 0:
                word = ans + str(tmp)
            pattern += solve(test, tmp, word, n)
    return pattern


N, M = [int(i) for i in input().split()]
town = []
for i in range(N):
    town.append(deepcopy([]))

for i in range(M):
    a, b = [int(i) for i in input().split()]
    if a is not 1 or b is not 1:
        town[a - 1].append(b)
        town[b - 1].append(a)
print(solve(town, 1, '1', N))
### BUGGY CODE ###

n,m = map(int,input().split())
X = list(map(int,input().split()))
X.sort()
if m <= n:
  print(0)
else:
  Dif_X = []
  for i in range(m-1):
    Dif_X += [X[i+1]-X[i]]
  while Dif_X.count(0)<n-1:
    Dif_X[Dif_X.index(max(Dif_X))] = 0
  print(sum(Dif_X))

### FIXED CODE ###

n,m = map(int,input().split())
X = list(map(int,input().split()))
X.sort()
if m <= n:
  print(0)
else:
  Dif_X = []
  for i in range(m-1):
    Dif_X += [X[i+1]-X[i]]
  Sum_Dif_X = sum(Dif_X)  
  Sorted_Dif_X = sorted(Dif_X, reverse = True)
  count = 0  
  while count < n-1:
    Sum_Dif_X -= Sorted_Dif_X[count]
    count += 1
  print(Sum_Dif_X)
### BUGGY CODE ###

N = int(input())
t_list = list(map(int, input().split()))
a_list = list(map(int, input().split()))

t_max = -1
t_i = 0
a_max = -1
a_i = 0
ans = 1
mod = 10 ** 9 + 7

for i in range(N):
    t = t_list[i]
    a = a_list[i]
    if t > t_max:
        t_max = t
        t_i = i
    if a >= a_max:
        a_max = a
        a_i = i
if a_max == t_max and t_i <= a_i:
    prev_a = a_list[-1]
    prev_t = t_list[0]
    for i in range(1, t_i):
        t = t_list[i]
        if t == prev_t:
            ans *= prev_t
        prev_t = t
    for i in range(N-2, t_i, -1):
        a = a_list[i]
        if a == prev_a:
            ans *= prev_a
        prev_a = a
    print(ans % mod)
else:
    print(0)


### FIXED CODE ###

N = int(input())
t_list = list(map(int, input().split()))
a_list = list(map(int, input().split()))

t_max = -1
t_i = 0
a_max = -1
a_i = 0
ans = 1
mod = 10 ** 9 + 7

for i in range(N):
    t = t_list[i]
    a = a_list[i]
    if t > t_max:
        t_max = t
        t_i = i
    if a >= a_max:
        a_max = a
        a_i = i
if a_max == t_max and t_i <= a_i:
    prev_a = a_list[-1]
    prev_t = t_list[0]
    for i in range(1, t_i):
        t = t_list[i]
        if t == prev_t:
            ans *= prev_t
            ans %= mod
        prev_t = t
    for i in range(N-2, t_i, -1):
        a = a_list[i]
        if a == prev_a:
            ans *= prev_a
            ans %= mod
        prev_a = a
    print(ans % mod)
else:
    print(0)
### BUGGY CODE ###


import sys
# 小さすぎても怒られるので
from collections import defaultdict
n = int(input())
sys.setrecursionlimit(max(1000, 2*n))

cs = [0] + [int(c) for c in input().split()]
ns = defaultdict(set)
for _ in range(n-1):
    a,b = [int(c) for c in input().split()]
    ns[a].add(b)
    ns[b].add(a)

def dfs(ns, prev, now, toru, results):
    end = defaultdict(int)
    k = cs[now]
    end[k] = 1
    s = 1 # nowで終わるパスの種類
    for u in ns[now]:
        if u==prev:
            continue
        tmp_end, tmp_toru, tmp_s = results[u]  # dfs(ns, now, u, toru)
        # toruの更新
        for kk, vv in tmp_end.items():
            if kk not in end:
                toru[kk] += vv * s
            else:
                toru[kk] += vv * s + end[kk] * (tmp_s+1) - ((vv+1) * end[kk])
        for kk, vv in end.items():
            if kk not in tmp_end:
                toru[kk] += vv * tmp_s
        # end, sの更新
        end[k] += tmp_s
        for kk,vv in tmp_end.items():
            if k!=kk:
                end[kk] += tmp_end[kk]
        s += tmp_s
    toru[k] += 1
#     print(now, prev, end, toru, s)
    results[now] = end, toru, s

toru = [0] * (n+1)
q = [(1, -1)] # now, prev
args = []
while q:
    u, prev = q.pop()
    args.append((u,prev))
    for v in ns[u]:
        if prev==v:
            continue
        q.append((v, u))
results = {}
for arg in args[::-1]:
    dfs(ns, arg[1], arg[0], toru, results)

for item in toru[1:]:
    print(item)

### FIXED CODE ###


import sys
# 小さすぎても怒られるので
from collections import defaultdict
n = int(input())
sys.setrecursionlimit(max(1000, 2*n))

cs = [0] + [int(c) for c in input().split()]
ns = defaultdict(set)
for _ in range(n-1):
    a,b = [int(c) for c in input().split()]
    ns[a].add(b)
    ns[b].add(a)

ans = [0] * (n+1) # kを通らないパスの総数
minus = [0] * (n+1) # uの部分木のうち
minus0 = defaultdict(int)
st = {k: [] for k in range(1, n+1)}
nextu = {}
def dfs(u, prev, ans):
    global minus, st, minus0
    k = cs[u]
    st[k].append(u)
    ss = 1
    for v in ns[u]:
        if v==prev:
            continue
        nextu[u] = v
        s = dfs(v, u, ans)
        ss += s
        tmp = s - minus[v]
        ans[k] += (int(tmp * (tmp - 1) / 2) + tmp)
    st[k].pop()
    if st[k]:
        minus[nextu[st[k][-1]]] += ss
    else:
        minus0[k] += ss
#     print(ss)
    return ss

dfs(1, -1, ans)
for k in range(1, n+1):
    tmp = n - minus0[k]
    ans[k] += (int(tmp * (tmp - 1) / 2) + tmp)
    
total = int(n * (n+1) / 2)
for i in range(1, n+1):
    print(total - ans[i])
### BUGGY CODE ###

import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial
from fractions import gcd
div = 10**9 + 7

sys.setrecursionlimit(10**7)
N = int(input())
A = list(map(int, input().split()))
sA = list(set(A))

val = 1
def lcm(a, b):
    ret = gcd(a, b)
    ret = a*b//ret
    return ret

val = sA[0]
for a in sA[1:]:
    val = lcm(val, a)

sumB = 0
B = [val//a for a in A]
sumB = sum(B)
sumB %= div

print(sumB)



### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
from fractions import gcd
div = 10**9 + 7

def main():
    N = int(input())
    A = list(map(int, input().split()))
    sA = list(set(A))

    val = 1
    def lcm(a, b):
        ret = gcd(a, b)
        ret = a*b//ret
        return ret

    val = sA[0]
    for a in sA[1:]:
        val = lcm(val, a)

    B = [val//a for a in A]
    sumB = sum(B)
    sumB %= div

    print(sumB)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

S = list(str(input()))
Q = int(input())
reverse = False
for i in range(Q):
    query = list(map(str,input().split()))
    if query[0] == '1':
        if reverse == True:
            reverse = False
        else:
            reverse = True
    if query[0] == '2':
        if query[1] == '1':
            if reverse == False:
                S.insert(0, query[2])
            else:
                S.append(query[2])
        else:
            if reverse == True:
                S.insert(0, query[2])
            else:
                S.append(query[2])
if reverse == True:
    S.reverse()
print(*S, sep = '')

### FIXED CODE ###

S = str(input())
Q = int(input())
s1 = ''
s2 = ''
reverse = False
for i in range(Q):
    query = list(map(str,input().split()))
    if query[0] == '1':
        if reverse == True:
            reverse = False
        else:
            reverse = True
    if query[0] == '2':
        if query[1] == '1':
            if reverse == False:
                s1 = query[2] + s1
            else:
                s2 = s2 + query[2]
        else:
            if reverse == True:
                s1 = query[2] + s1
            else:
                s2 = s2 + query[2]
S = s1 + S + s2
if reverse == True:
    S = S[::-1]
print(S)
### BUGGY CODE ###

s = input()[::-1]
counts = [0] * 2019
counts[0] = 1
digit = 1
sum = 0
for c in s:
  sum += int(c) * digit
  digit = digit * 10 
  amari = sum % 2019
  counts[amari] += 1

result = 0
for c in counts:
  result += c * (c - 1) // 2

print(result)

### FIXED CODE ###

s = input()[::-1]
counts = [0] * 2019
counts[0] = 1
digit = 1
sum = 0
for c in s:
  sum = (sum + int(c) * digit) % 2019
  digit = digit * 10 % 2019
  counts[sum] += 1

result = 0
for c in counts:
  result += c * (c - 1) // 2

print(result)
### BUGGY CODE ###

# 常にi < jを考える

N = int(input())
H = [0]
H.extend(list(map(int, input().split())))

plus = [H[i] + i for i in range(1,N+1)]
minus = [i - H[i] for i in range(1, N+1)]

cnt = 0
for i in range(N):
    for j in range(i+1, N):
        if plus[i] == minus[j]:
            cnt += 1

print(cnt)


### FIXED CODE ###

# 常にi < jを考える
from collections import Counter

N = int(input())
H = [0]
H.extend(list(map(int, input().split())))

plus = [H[i] + i for i in range(1,N+1)]
minus = [i - H[i] for i in range(1, N+1)]
ans = 0

# 独立というのがよくわからなかったが，
# i > jで成り立つと仮定すると，
# aj -ai = Ai + Aj > 0　で，
# j > i となり，矛盾する。
# 連想配列で調べれば良い

cnt = Counter(minus)

for i in plus:
    ans += cnt.get(i, 0)

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

import heapq

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

que=[(-B[i],i) for i in range(N)]
heapq.heapify(que)
count=0
while que:
    val,index=heapq.heappop(que)
    if val>0:
        break
    if index!=N-1:
        a,b,c=B[index-1],B[index],B[index+1]
        if a==A[index-1] and c==A[index+1]:
            if B[index]%(a+c)==A[index]%(a+c):
                count+=(B[index]-A[index])//(a+c)
                B[index]=A[index]
            else:
                count=-1
                break
        else:
            if B[index]>a+c:
                count+=B[index]//(a+c)
                B[index]%=a+c
                heapq.heappush(que,(-B[index],index))
    else:
        a,b,c=B[index-1],B[index],B[0]
        if a==A[index-1] and c==A[0]:
            if B[index]%(a+c)==A[index]%(a+c):
                count+=(B[index]-A[index])//(a+c)
                B[index]=A[index]
            else:
                count=-1
                break
        else:
            if B[index]>a+c:
                count+=B[index]//(a+c)
                B[index]%=a+c
                heapq.heappush(que,(-B[index],index))

if A==B:
    print(count)
else:
    print(-1)

### FIXED CODE ###

import heapq

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

que=[(-B[i],i) for i in range(N)]
heapq.heapify(que)
count=0
while que:
    val,index=heapq.heappop(que)
    if val>0:
        break
    if index!=N-1:
        a,b,c=B[index-1],B[index],B[index+1]
        if a==A[index-1] and c==A[index+1]:
            if B[index]%(a+c)==A[index]%(a+c):
                count+=(B[index]-A[index])//(a+c)
                B[index]=A[index]
            else:
                count=-1
                break
        else:
            if B[index]>a+c:
                count+=B[index]//(a+c)
                B[index]%=a+c
                heapq.heappush(que,(-B[index],index))
    else:
        a,b,c=B[index-1],B[index],B[0]
        if a==A[index-1] and c==A[0]:
            if B[index]%(a+c)==A[index]%(a+c):
                count+=(B[index]-A[index])//(a+c)
                B[index]=A[index]
            else:
                count=-1
                break
        else:
            if B[index]>a+c:
                count+=B[index]//(a+c)
                B[index]%=a+c
                heapq.heappush(que,(-B[index],index))

if A==B:
    print(count)
else:
    print(-1)
### BUGGY CODE ###

R, G, B, N = map(int, input().split())
counter = 0
r_max = N//R+1
g_max = N//G+1
for r in range(r_max+1):
  for g in range(g_max+1):
    temp = N - R*r - G*g
    if temp% B == 0 and temp//B >= 0:
      counter +=1
print(counter)

### FIXED CODE ###

R, G, B, N = map(int, input().split())
counter = 0
r_max = N//R+1
for r in range(r_max+1):
  temp = N - R*r
  for g in range(temp//G+1):
    now = temp - G*g
    if now% B == 0 and now//B >= 0:
      counter +=1
print(counter)
### BUGGY CODE ###

cnt = 0

l = []
l = input().split()
k = int(l[0])
s = int(l[1])

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 CODE ###

cnt = 0
l = []
l = input().split()
k = int(l[0])
s = int(l[1])

for x in range(k + 1):
  for y in range(k + 1):
      if 0 <= s - (x + y) <= k:
        cnt += 1
        
print(cnt)
### BUGGY CODE ###

import sys
input = sys.stdin.readline


def main():
    R, G, B, N = map(int, input().split())
    ans = 0
    for r in range(N+1):
        if r*R > N:
            continue
        for g in range(N+1):
            if r*R + g*G > N:
                continue
            if (N - r*R - g*G) % B == 0:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline


def main():
    R, G, B, N = map(int, input().split())
    ans = 0
    for r in range(N+1):
        if r*R > N:
            continue
        for g in range(N+1):
            if r*R + g*G > N:
                continue
            if (N - r*R - g*G) % B == 0:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

h,w=map(int,input().split())
l=[list(input()) for i in range(h)]
cl=[[0]*w for i in range(h)]
for i in range(h):
    s=0
    for j in range(w):
        if l[i][j]=="#":
            for x in range(s,j):
                cl[i][x]+=j-s
            s=j+1
        elif j==w-1:
            for x in range(s,j+1):
                cl[i][x]+=j-s+1
for i in range(w):
    s=0
    for j in range(h):
        if l[j][i]=="#":
            for x in range(s,j):
                cl[x][i]+=j-s
            s=j+1
        elif j==h-1:
            for x in range(s,j+1):
                cl[x][i]+=j-s+1
print(max([max(x) for x in cl])-1)

### FIXED CODE ###

h,w=map(int,input().split())
l=[list(input()) for i in range(h)]
cl=[[0]*w for i in range(h)]
for i in range(h):
    s=0
    for j in range(w):
        if l[i][j]=="#":
            for x in range(s,j):
                cl[i][x]+=j-s
            s=j+1
        elif j==w-1:
            for x in range(s,j+1):
                cl[i][x]+=j-s+1
for i in range(w):
    s=0
    for j in range(h):
        if l[j][i]=="#":
            for x in range(s,j):
                cl[x][i]+=j-s
            s=j+1
        elif j==h-1:
            for x in range(s,j+1):
                cl[x][i]+=j-s+1
print(max([max(x) for x in cl])-1)