Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline

n,m=map(int,input().split())
l=[list(input().split()) for _ in range(m)]
 
p=[0]*m
wa=0

for i in range(m):
  if l[i][1]=="AC":
    wa += p[int(l[i][0])]
    p[int(l[i][0])]= -1
  elif l[i][1]=="WA":
    if p[int(l[i][0])] != -1:
      p[int(l[i][0])] += 1
      
print(p.count(-1),wa)

### FIXED CODE ###

n,m=map(int,input().split())
probs = [False]*n
wrongs = [0]*n
for i in range(m):
    p,s=map(str,input().split())
    if probs[int(p)-1] == False:
        if s == "AC":
            probs[int(p)-1] = True
        elif s == "WA":
            wrongs[int(p)-1] += 1

ac=0
wa=0
for i,a in enumerate(probs):
    if a == True:
        ac+=1
        wa+=wrongs[i]
print(ac,wa)
#!/usr/bin/env python3
import numpy as np
import sys


def solve(A: int, B: int):
    print(np.lcm(A, B))

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import fractions
# import numpy as np
import sys


def solve(A: int, B: int):
    ans = (A * B) // fractions.gcd(A, B)
    # print(np.lcm(A, B))
    print(ans)

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()
a, b ＝ map(int, input().split())
tower = []
tmp = 0

for i in range(1, 1000):
    tmp += 1
    tower.append(tmp)
    
count = b - a

print(tower[count - 1] - b)


### FIXED CODE ###

a, b = map(int, input().split())
tower = []
tmp = 0

for i in range(1, 1000):
    tmp += i
    tower.append(tmp)
    
count = b - a

print(tower[count - 1] - b)
import itertools
letters = ['M','A','R','C','H']
N = int(input())
a = []
com_s = []

for i in range(N):
    x = input()
    if x[0] in letters:
        a.append(x)

coms = list(itertools.combinations(a,3))
for com in coms:
    if com[0][0] != com[1][0] and com[1][0] != com[2][0] and com[2][0] != com[0]com[0]:
        com_s.append(com)

print(len(com_s))

### FIXED CODE ###

N = int(input())
_M = [] 
_A = [] 
_R = [] 
_C = [] 
_H = [] 

for i in range(N):
    x = input()
    if x[0] == 'M':
        _M.append(x)
    elif x[0] == 'A':
        _A.append(x)
    elif x[0] == 'R':
        _R.append(x)
    elif x[0] == 'C':
        _C.append(x)
    elif x[0] == 'H':
        _H.append(x)

m = len(_M)
a = len(_A)
r = len(_R)
c = len(_C)
h = len(_H)

x = m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h

print(x)
def fac(n):
    if(n==0 or n==1):
        return 1
    else:
        return (n * fac(n-2))

n = int(input())
string = ""
x = 0
if(n == 0):
    print("1")
elif(n==1):
    print("0")
else:
    x = fac(n)

    string = str(x)
    # print(string)
    count=0
    
    for i in range((len(string)-1),0,-1):
        # print(string[i])
        if(string[i]=="0"):
            count+=1
        else:
            break
    print("Count : ",count)

### FIXED CODE ###

def findTrailingZeros(n): 
      
    if (n%2!=0): 
        return 0

    else: 
        ans = 0
        n //= 2
        while (n): 
            ans += n // 5
            n //= 5
  
        return ans 
  
n = int(input())
  
print(findTrailingZeros(n))
input_list=list(input().split(" "))

#A,B,C,K
a = int(input_list[3]) - int(input_list[0])
b = int(input_list[3]) - int(input_list[1])- int(input_list[0])
c = int(input_list[3]) - int(input_list[2])- int(input_list[1])- int(input_list[0])
if b <= 0:
  calc = input_list[0]
else:
  calc = input_list[0] - input_list[2]


### FIXED CODE ###

S=list(input())
 
T=list(input())
Judge = True 
 
for i in range(len(S)):
  if S[i]==T[i]:
    continue
  else:
    Judge = False

if Judge:
  print("Yes")
else:
  print("No")
import sys

dct = {"b": "d", "d", "b", "p": "q", "q": "p"}
S = sys.stdin.readline().strip()
rev = ""
for s in S[::-1]:
    rev += dct[s]

if rev == S:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import sys

dct = {"b": "d", "d": "b", "p": "q", "q": "p"}
S = sys.stdin.readline().strip()
rev = ""
for s in S[::-1]:
    rev += dct[s]

if rev == S:
    print("Yes")
else:
    print("No")
N, K = map(int, input().split())
P = list(map(int, input().split()))
l = []

for i in range(N):
    l.append((P[i] + 1) / 2)

n = 0
for i in range(N):
    n += l[i]
    l[i] = n

ans = l[K]
for i in range(N - K):
    ans = max(ans, l[i + K] - l[i])

print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
P = list(map(int, input().split()))
l = []

for i in range(N):
    l.append((P[i] + 1) / 2)

n = 0
for i in range(N):
    n += l[i]
    l[i] = n

ans = l[K - 1]
for i in range(N - K):
    ans = max(ans, l[i + K] - l[i])

print(ans)
# print(l)
w, h, x, y = map(int,input().split())

if w / 2 == x and h / 2 == y:
    print((w - x) * h,end=" ")
    print(1)
elif x == 0 and y == 0:
    print(w * h / 2,end=" ")
    print(0)
elif x == 0:
    print(max(((h - y) * w) / 2,(y * w) / 2),end=" ")
    print(0)
elif y == 0:
    print(max(((w - x) * h) / 2,(x * h) / 2),end=" ")
    print(0)
elif w / x == h / y:
    print(w * h / 2,end=" ")
    print(0)
elif w / 2 == x:
    print(x * h,end=" ")
    print(0)
elif h / 2 == y:
    print(w * y,end=" ")
    print(0)
else:
    print(max(w * y,x * h,((w-x)*(h-y))/2,end=" ")
    print(0)

### FIXED CODE ###

w, h, x, y = map(int,input().split())

if w / 2 == x and h / 2 == y:
    print(w * h / 2, 1)
else:
    print(w * h / 2, 0)
import sys
input = sys.stdin.readline

X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

AB=[]
for a in A:
    for b in B:
        AB.append(a+b)

C.sort(reverse=True)
AB.sort(reverse=True)


ABX=[AB[0]-ab for ab in AB]
CX=[C[0]-c for c in C]

ABX.append(float("inf"))
CX.append(float("inf"))

j=0
for i in range(X*Y):
    while j<Z-1 and CX[j]<ABX[i]:
        j+=1

    if (i+1)*(j+1)>K:
        break

print(i,j)

MIN=AB[i]+C[j]
MAX=AB[0]+C[0]-MIN
LIST=[]

for ii in range(X+Z):
    if AB[0]-AB[ii]>MAX:
        break
    for jj in range(Y):
        if AB[ii]+C[jj]>=MIN:
            LIST.append(AB[ii]+C[jj])
        else:
            break

LIST.sort(reverse=True)

for j in range(K):
    print(LIST[j])

### FIXED CODE ###

import sys
input = sys.stdin.readline

X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

AB=[]
for a in A:
    for b in B:
        AB.append(a+b)

AB.sort(reverse=True)
AB=AB[:K]

ALL=[]

for ab in AB:
    for c in C:
        ALL.append(ab+c)

ALL.sort(reverse=True)

for k in range(K):
    print(ALL[k])
a=input().split()
b=input().split()
h=input().split()

ans=((a + b) * h) / 2

print(ans)

### FIXED CODE ###

x = [input() for i in range(3)]

a = int(x[0])
b = int(x[1])
h = int(x[2])

y=((a + b) * h) / 2
ans=int(y)
print(ans)
N = int(input())
A = list(map(int, input().split()))

import math
from functools import reduce

def gcd(numbers):
    return reduce(math.gcd, numbers)
ans = 0
for idx, num in enumerate(A):
  result = gcd(A[:idx:]+A[idx+1::])
  if result > ans:
    ans = result
print(ans)


### FIXED CODE ###

import fractions

N = int(input())
A = list(map(int, input().split()))
L = [0] * (N+1)
R = [0] * (N+2)
M = [0] * (N+1)

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

for i in range(1, N+1):
  M[i] = fractions.gcd(L[i-1], R[i+1])
print(max(M[1:]))
from sys import stdin
h, w = [int(x) for x in stdin.readline().rstrip().split()]
matrix = [stdin.readline().rstrip() for _ in range(h)]
for i in range(h):
    matrix[i] = [matrix[i][x:x+1] for x in range(len(matrix[i]))]
    #matrix[i] = [0 if x == '.' else x for x in matrix[i]]
print(matrix)
for i in range(h):
    for j in range(w):
        if matrix[i][j] == '#':
            flag = 0
            for n in list[-1, 1]:
                i_n = i + n
                j_m = j + m
                if matrix[i_n][j] == '#' and i_n >= 0 and i_n < h:
                    flag = 1
                    break
                if matrix[i][j_m] == '#' and j_m >= 0 and j_m < w:
                    flag = 1
                    break
            if flag == 0:
                print('No')
                exit()
print('Yes')
#print(*matrix, sep = '\n')


### FIXED CODE ###

from sys import stdin
h, w = [int(x) for x in stdin.readline().rstrip().split()]
matrix = [stdin.readline().rstrip() for _ in range(h)]
for i in range(h):
    matrix[i] = [matrix[i][x:x+1] for x in range(len(matrix[i]))]
    #matrix[i] = [0 if x == '.' else x for x in matrix[i]]
#print(matrix)
for i in range(h):
    for j in range(w):
        if matrix[i][j] == '#':
            flag = 0
            for n in list([-1, 1]):
                i_n = i + n
                j_n = j + n
                if i_n >= 0 and i_n < h:
                    if matrix[i_n][j] == '#':
                        flag = 1
                        break
                if j_n >= 0 and j_n < w:
                    if matrix[i][j_n] == '#':
                        flag = 1
                        break
            if flag == 0:
                print('No')
                exit()
print('Yes')
#print(*matrix, sep = '\n')
#リストAの丸太を全てx以下にK回以内の切る回数で揃えることができるかを判断する関数。
def can_or_cannot(A,K,x):
    kaisuu_sum = 0
    for i in range(len(A)):
        if A[i]%x == 0:
            temp = (A[i]%x) - 1
            kaisuu_sum += temp
        else:
            temp = A[i]//x
            kaisuu_sum += temp

        if kaisuu_sum > K:
            return 'No'

    return 'Yes'

def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    A.sort()
    #二分探索するよ
    left = 0
    right = A[N-1]
    mid = 0
    while True:
        mid = int( (left + right)/2 )
        judge = can_or_cannot(A,K,mid)
        if judge == 'No':
            left = mid+1
        elif judge == 'Yes':
            right = mid

        if left == right:
            return right

print(main())


### FIXED CODE ###

#リストAの丸太を全てx以下にK回以内の切る回数で揃えることができるかを判断する関数。
def can_or_cannot(A,K,x):
    kaisuu_sum = 0
    for i in range(len(A)):
        if A[i]%x == 0:
            temp = (A[i]//x) - 1
            kaisuu_sum += temp
        else:
            temp = A[i]//x
            kaisuu_sum += temp

        if kaisuu_sum > K:
            return 'No'

    return 'Yes'

def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    A.sort()
    #二分探索するよ
    left = 0
    right = A[N-1]

    if right == 1:
        return 1

    mid = 0
    while True:
        if right == 1:
            return 1
            
        mid = int( (left + right)/2 )
        #print(left,mid,right)
        judge = can_or_cannot(A,K,mid)
        #print(left,mid,right,judge)
        if judge == 'No':
            left = mid+1
        elif judge == 'Yes':
            right = mid

        if left == right:
            #print(left,mid,right)
            return right

print(main())
import math
import sys

def cmb(n, r):
	if n - r < r: r = n - r
	if r == 0: return 1
	if r == 1: return n

	numerator = [n - r + k + 1 for k in range(r)]
	denominator = [k + 1 for k in range(r)]

	for p in range(2,r+1):
		pivot = denominator[p - 1]
		if pivot > 1:
			offset = (n - r) % p
			for k in range(p-1,r,p):
				numerator[k - offset] /= pivot
				denominator[k] /= pivot

	result = 1
	for k in range(r):
		if numerator[k] > 1:
			result *= int(numerator[k])
			result %= MOD

	return result

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

min_xy = min(x,y)
max_xy = max(x,y)

MOD = 10**9+7

if max_xy / min_xy == 2.0:
	print(1)
	sys.exit()
if max_xy / min_xy > 2.0:
	print(0)
	sys.exit()
if max_xy == min_xy and max_xy % 3 != 0:
	print(0)
	sys.exit()
if max_xy == min_xy and max_xy % 3 == 0:
	print(cmb(2 * max_xy//3, max_xy//3))
	sys.exit()

iter_num = math.ceil(max_xy / 3)
ans = 2 ** iter_num
xy = 3 * iter_num
if (xy - min_xy) / (xy - max_xy) == 2.0:
	ans = cmb(2*iter_num-(xy - max_xy),iter_num-(xy - max_xy))
else:
	ans = 0

print(ans%MOD)



### FIXED CODE ###

import sys

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

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

MOD = 10**9 + 7

MAX = max(x,y)
MIN = min(x,y)

if (2*MAX - MIN) % 3 != 0 or MAX / MIN > 2:
	print(0)
	sys.exit()

c1 = (2*MAX - MIN) // 3
c2 = MAX - 2*c1

c1 %= MOD
c2 %= MOD

ans = cmb(c1 + c2 , c1)
print(ans%MOD)
N = int(input())
A = sorted(map(int, input().split()))
Q = int(input())
B = []
C = []
for _ in range(Q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)

nums = [A.count(num) for num in range(10 ** 5)]
ans = sum(i * num for i, num in enumerate(nums))

for i in range(Q):
    ans += (C[i] - B[i]) * nums[B[i]]
    nums[C[i]] += nums[B[i]]
    nums[B[i]] = 0
    print(ans)

### FIXED CODE ###

import collections

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

cnt = collections.defaultdict(int)
for a in A:
    cnt[a] += 1
ans = sum(A)

Q = int(input())
for _ in range(Q):
    B, C = map(int, input().split())
    ans += (C - B) * cnt[B]
    cnt[C] += cnt[B]
    cnt[B] = 0
    print(ans)
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
r.sort()
pcount=0
qcount=0
rcount=0
ans=[]
for i in range(x):
  ans.append(p[-1-i])
for i in range(y):
  ans.append(q[-1-i])
ans.sort()
for i in range(r):
  if ans[i]<=r[-1-rcount]:
    ans[i]=r[-1-rcount]
    rcount+=1
print(sum(ans))
  

### FIXED CODE ###

x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
r.sort(reverse=True)
rcount=0
ans=[]
for i in range(x):
  ans.append(p[-1-i])
for i in range(y):
  ans.append(q[-1-i])
ans.sort()
for i in range(min(len(ans),c)):
  if ans[i]<=r[rcount]:
    ans[i]=r[rcount]
    rcount+=1
print(sum(ans))
a, b, c = str(input()).split()

if a * b < c:
    print(a * b)
else:
    print(c)

### FIXED CODE ###

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

if a * b < c:
    print(a * b)
else:
    print(c)
N = int(input())
XY = []
for i in range(N):
    XY.append(list(map(int,input().split())))

pqs = []
for i in range(N):
    for j in range(i+1,N):
        X1 = XY[i][0]
        Y1 = XY[i][1]
        X2 = XY[j][0]
        Y2 = XY[j][1]
        pqs.append(str(X1-X2)+","+str(Y1-Y2))
        pqs.append(str(X2-X1)+","+str(Y2-Y1))

from collections import Counter
C = dict(Counter(pqs))
out = N - max(C.values())
print(out)

### FIXED CODE ###

N = int(input())
XY = []
for i in range(N):
    XY.append(list(map(int,input().split())))

if N!=1:
    pqs = []
    for i in range(N):
        for j in range(i+1,N):
            X1 = XY[i][0]
            Y1 = XY[i][1]
            X2 = XY[j][0]
            Y2 = XY[j][1]
            pqs.append(str(X1-X2)+","+str(Y1-Y2))
            pqs.append(str(X2-X1)+","+str(Y2-Y1))

    from collections import Counter
    C = dict(Counter(pqs))
    out = N - max(C.values())
    print(out)
else:
    print(1)
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k > sum(a):
    print(-1)
    exit()

mod = 1000000007
dp = [[0 for _ in range(k+1)]for __ in range(n+1)]
for i in range(n+1):
    dp[i][0] = 1
    dp[0][i] = 0

for i in range(1,n+1):
    for j in range(1,k+1):
        if j > a[i-1]:
            if i is 1:
                break
        dp[i][j] = dp[i-1][j] + dp[i][j-1]
        if j > a[i-1]:
            dp[i][j] -= dp[i-1][j-1-a[i-1]]
        dp[i][j] %= mod
print(dp[n][k])

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
if k > sum(a):
    print(0)
    exit()

mod = 1000000007
dp = [[0 for _ in range(k+1)]for __ in range(n+1)]
for i in range(n+1):
    dp[i][0] = 1
for i in range(k+1):
    dp[0][i] = 0

for i in range(1,n+1):
    for j in range(1,k+1):
        if j > a[i-1]:
            if i is 1:
                break
        dp[i][j] = dp[i-1][j] + dp[i][j-1]
        if j > a[i-1]:
            dp[i][j] -= dp[i-1][j-1-a[i-1]]
        dp[i][j] %= mod
print(dp[n][k])
X = int(input())
mod = X % 100
q = int(X //100)
sum = 0
ans = 0
if q => 20:
    ans = 1
else:
    for i in range (0,q+1):
        for j in range (0,q+1-i):
            for k in range (0,q+1-i-j):
                for l in range (0,q+1-i-k-j):
                    for m in range (0,q+1-i-j-k-l):
                        sum = i+(2*j)+(3*k)+(4*l)+(5*m)
                        if sum == mod:
                            ans = 1
print(ans)


### FIXED CODE ###

X = int(input())
mod = X % 100
q = int(X //100)
sum = 0
ans = 0
if q >= 20:
    ans = 1
else:
    for i in range (0,q+1):
        for j in range (0,q+1-i):
            for k in range (0,q+1-i-j):
                for l in range (0,q+1-i-k-j):
                    for m in range (0,q+1-i-j-k-l):
                        sum = i+(2*j)+(3*k)+(4*l)+(5*m)
                        if sum == mod:
                            ans = 1
print(ans)
# import itertools
# import math

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

ans_p = [0] * N
ans_s = [0] * N

for i in range(M):
    input_sp = input().split()
    P = int(input_sp[0]) - 1
    S = input_sp[1]

    if S == 'AC':
        ans_s[P] = 1
    elif S == 'WA' and ans_s[P] == 0:
        ans_p[P] += 1

for i in ans_p:
    if ans_s[i] == 0 and ans_p[i] != 0:
        ans_p[i] = 0


print(str(sum(ans_s)) + " " + str(sum(ans_p)))


### FIXED CODE ###

# import itertools
# import math

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

ans_p = [0] * N
ans_s = [0] * N

for i in range(M):
    input_sp = input().split()
    P = int(input_sp[0]) - 1
    S = input_sp[1]

    if S == 'AC':
        ans_s[P] = 1
    elif S == 'WA' and ans_s[P] == 0:
        ans_p[P] += 1

for i in range(len(ans_p)):
    if ans_s[i] == 0 and ans_p[i] != 0:
        ans_p[i] = 0

print(str(sum(ans_s)) + " " + str(sum(ans_p)))
import sys
for e in sys.stdin.readlines():
 print(len(sum(map(int,e.split()))))


### FIXED CODE ###

import sys
for e in sys.stdin.readlines():
 print(len(str(sum(map(int,e.split())))))
S = input()
a = len(S)
print(S[0]+ (str)a + S[-1])

### FIXED CODE ###

S = input()
a = len(S)
print(S[0]+ str(a-2) + S[-1])
a,op,b= map(int,onput().split())

func = lambda x,y:x + y if op =="+" else lambda x,y:x-y

print(func(a,b))

### FIXED CODE ###


a,op,b= input().split()
a,b=int(a),int(b)


func = (lambda x,y:x+y) if op =="+" else (lambda x,y:x-y)
print(func(a,b))
inputs = input().split(" ")
decimal = int(float(inputs[1])*100)
product = int(inputs[0])*(decimal)
print(product//100)

### FIXED CODE ###

count = int(input())
nums = input().split(" ")

product = 1

if ("0" in nums):
    print(0)
else:
    for i in nums:
        product *= int(i)
        if (product > 10**18):
            print(-1)
            exit()
    print(product)
A = list(map(int, input().split()))
i = 0
ans = 0
while i < N:
    if (A[i] == ans+1):
        ans += 1
    i += 1
if ans == 0:
    ans = N + 1
print(N - ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
i = 0
ans = 0
while i < N:
    if (A[i] == ans+1):
        ans += 1
    i += 1
if ans == 0:
    ans = N + 1
print(N - ans)
import sys

readline = sys.stdin.readline

H, W = map(int, readline().split())
S = [readline().rstrip() for i in range(H)]

vert = [[0]*W for i in range(W)]
hori = [[0]*W for i in range(W)]

for y in range(H):
    for x in range(W):

        if x > 0 and S[y][x - 1] != '#':
            hori[y][x] = hori[y][x - 1]
        elif S[y][x] == '#':
            hori[y][x] = 0
        else:
            # hori
            count = 1
            while x + count < W and S[y][x + count] == '.':
                count += 1
            hori[y][x] = count

        if y > 0 and S[y - 1][x] != '#':
            vert[y][x] = vert[y - 1][x]
        elif S[y][x] == '#':
            vert[y][x] = 0
        else:
            # hori
            count = 1
            while y + count < H and S[y + count][x] == '.':
                count += 1
            vert[y][x] = count

ans = 0
for y in range(H):
    for x in range(W):
        a = hori[y][x] + vert[y][x] - 1
        ans = max(a, ans)

print(ans)

### FIXED CODE ###

import sys

readline = sys.stdin.readline

H, W = map(int, readline().split())
S = [readline().rstrip() for i in range(H)]

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

for y in range(H):
    for x in range(W):

        if x > 0 and S[y][x - 1] != '#':
            hori[y][x] = hori[y][x - 1]
        elif S[y][x] == '#':
            hori[y][x] = 0
        else:
            # hori
            count = 1
            while x + count < W and S[y][x + count] == '.':
                count += 1
            hori[y][x] = count

        if y > 0 and S[y - 1][x] != '#':
            vert[y][x] = vert[y - 1][x]
        elif S[y][x] == '#':
            vert[y][x] = 0
        else:
            # hori
            count = 1
            while y + count < H and S[y + count][x] == '.':
                count += 1
            vert[y][x] = count

ans = 0
for y in range(H):
    for x in range(W):
        a = hori[y][x] + vert[y][x] - 1
        ans = max(a, ans)

print(ans)
[H,W]=map(int,input().split())
if (H*W)%2==0:
    B=int((H*W)/2)
    print (B)
else:
    if (H+W)%2==0:
        C=int((H*W+1)/2)
        print (C)
    else:
        D=int((H*W-1)/2)
        print(D)


### FIXED CODE ###

K=int(input())
A=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A[K-1])
C1 = input()
C2 = input()
C3 = input()
print(C[0]+C[1]+C[2])

### FIXED CODE ###

C1 = input()
C2 = input()
C3 = input()
print(C1[0]+C2[1]+C3[2])
N=input()
list=map(int,input().split())
sum+=0
for i in range(1,N+1)
sum+=abs(i-list)
print(min(sum**2))


### FIXED CODE ###

N = int(input())
men=list(map(int,input().split()))
for i in range(1,101):
  suu=0
  if i==1:
    for n in range(N):
      suu+=(1-men[n])**2
      ans=suu
  else:
    for h in range(N): 
      suu+=(i-men[h])**2
  if suu<ans:
      ans=suu
print(ans)
import sys
sys.setrecursionlimit(100000)
n,m = map(int,input().split())
diff = abs(n-m)
def saiki(n):
    if n<=1:
        return 1
    return n * saiki(n-1)
if diff >= 2:
    print(0)
elif diff == 1:
    print((saiki(max(n,m))*saiki(min(n,m)))%(10**9+7))
else:
    print((saiki(n)*saiki(m)*2)%(10**9+7))


### FIXED CODE ###

import math
n,m = map(int,input().split())
diff = abs(n-m)
count1 = 1
count2 = 1
a = 1

if diff >= 2:
    print(0)
elif diff == 1:
    ans = math.factorial(max(n,m))
    print(ans*(ans//max(n,m))%(10**9+7))
else:
    ans = math.factorial(n)
    print(ans*ans*2%(10**9+7))
c = 1
while True:
    x = input()
    print("Case ", c, ": ", ) if x != 0 else return
    c += 1


### FIXED CODE ###

c = 1
while True:
    x = int(input())
    if x == 0: break
    print("Case {}: {}".format(c, x))
    c += 1
#coding:utf-8
s = input()
a = 0
for c in s:
  a = a + 1 if c = "+" else a = a - 1
print(a)

### FIXED CODE ###

#coding:utf-8
s = input()
a = 0
for c in s:
  a = a + 1 if c == "+" else a - 1
print(a)