Harryxun/stf_run huggingface dataset:
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

if h == 1 and w == 1:
    if s[0][0] == '.':
        print(1)
    else:
        print(0)
    exit()
elif h == 1:
    a = [0] * w
    mode = 0
    for i in range(w):
        if mode == 0:
            if s[0][i] == '.':
                c = 1
                a[i] = c
                mode = 1
        else:
            if s[0][i] == '.':
                c += 1
                a[i] = c
            else:
                mode = 0
    print(max(a))
    exit()
elif w == 1:
    print(s[100000][1000000])
    b = [0] * h
    mode = 0
    for i in range(h):
        if mode == 0:
            if s[i][0] == '.':
                c = 1
                b[i] = c
                mode = 1
        else:
            if s[i][0] == '.':
                c += 1
                b[i] = c
            else:
                mode = 0
    print(max(b))
    exit()

exit()

a = [[0 for _ in range(w)] for _ in range(h)]
b = [[0 for _ in range(w)] for _ in range(h)]

c = 0

for i in range(h):
    mode = 0
    for j in range(w):
        if mode == 0:
            if s[i][j] == '.':
                c = 1
                a[i][j] = 1
                mode = 1
        else:
            if s[i][j] == '.':
                c += 1
                a[i][j] = c
            else:
                mode = 0

    for j in range(w-2, -1, -1):
        if a[i][j+1] > 0 and a[i][j] > 0:
            a[i][j] = a[i][j+1]

ans = 0

for j in range(w):
    mode = 0
    for i in range(h):
        if mode == 0:
            if s[i][j] == '.':
                c = 1
                b[i][j] = c
                mode = 1
        else:
            if s[i][j] == '.':
                c += 1
                b[i][j] = c
            else:
                mode = 0

    #print(b)

    for i in range(h-2, -1, -1):
        if b[i+1][j] > 0 and b[i][j] > 0:
            b[i][j] = b[i+1][j]
            ans = max(ans, a[i][j] + b[i][j] - 1)
        elif b[i][j] > 0:
            ans = max(ans, a[i][j] + b[i][j] - 1)

print(ans)

### FIXED CODE ###

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

L = [[0 for _ in range(w)] for _ in range(h)]
R = [[0 for _ in range(w)] for _ in range(h)]
D = [[0 for _ in range(w)] for _ in range(h)]
U = [[0 for _ in range(w)] for _ in range(h)]

for i in range(h):
    if s[i][0] == '.':
        L[i][0] = 1
    for j in range(1, w):
        if s[i][j] == '.':
            L[i][j] = L[i][j-1] + 1
    if s[i][w-1] == '.':
        R[i][w-1] = 1
    for j in range(w-2, -1, -1):
        if s[i][j] == '.':
            R[i][j] = R[i][j+1] + 1

for j in range(w):
    if s[0][j] == '.':
        U[0][j] = 1
    for i in range(1, h):
        if s[i][j] == '.':
            U[i][j] = U[i-1][j] + 1
    if s[h-1][j] == '.':
        D[h-1][j] = 1
    for i in range(h-2, -1, -1):
        if s[i][j] == '.':
            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)
import sys
n,m = map(int,input().split())
li=[]
cnt_ac = 0
cnt_pn = 0
for i in range(m):
    p,s = input().split()
    li.append([int(p),s])
if m==0:
    print(cnt_pn,cnt_ac)
    sys.exit()
else:
    f = li[0][0]
    g = li[-1][0]+1
    j = 0
    while f != g:
        if li[j][1] != "AC":
            cnt_ac+=1
        else:
            f+=1
            cnt_pn+=1
        j+=1
    print(cnt_pn,cnt_ac)
    


### FIXED CODE ###

n,m = map(int,input().split())
cnt = 0
pena = 0
problem = [0]*n
ac = 0
penalty = 0
for i in range(m):
    p,s = input().split()
    if problem[int(p)-1] == -1:
        continue
    if s == "WA":
        problem[int(p)-1]+=1
    else:
        ac += 1
        penalty += problem[int(p)-1]
        problem[int(p)-1] = -1
print(ac,penalty)
x = input()
s = x % 60
x //= 60
m = x % 60
x //= 60
print("{}:{}:{}".format(x, m, s))


### FIXED CODE ###

x = int(input())
s = x % 60
x //= 60
m = x % 60
x //= 60
print("{}:{}:{}".format(x, m, s))
import math
N=int(input())
if N==1:
	print(1)
else:
	nmax = math.ceil(math.sqrt(N))
	Bdigimin = 10
	for i in range(nmax):
		if N % (i+1) == 0:
			Bdigi = math.floor(math.log10(N/i))
			if Bdigimin > Bdigi:
				Bdigimin = Bdigi
	print(int(Bdigimin+1))


### FIXED CODE ###

import math
N=int(input())
nmax = math.ceil(math.sqrt(N))
i = 1
Bdigimin = 10
while ( i <= nmax):
	if N % i == 0:
		Bdigi = math.floor(math.log10(N/i))
		if Bdigimin > Bdigi:
			Bdigimin = Bdigi
	i += 1
print(int(Bdigimin+1))
h = int(input())

split_num = math.floor(math.log2(h)) + 1
attack_num = sum([2**s for s in range(1, split_num+1)])

print(attack_num)

### FIXED CODE ###

H = int(input())

h = H
attack = []
division = 0
while h >= 1:
    h /= 2
    attack.append(2**division)
    division += 1
print(sum(attack))
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(a[i], i+1)
b.sort()
ans = []
for i in range(n):
  ans.append(b[i][1])
print(''.join(map(str, ans)))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append([a[i], i+1])
b.sort()
ans = []
for i in range(n):
  ans.append(b[i][1])
print(' '.join(map(str, ans)))
A=input()
if A == AAA or A == BBB:
  print(No)
else:
  print(Yes)

### FIXED CODE ###

A=input()
if A == "AAA" or A == "BBB":
  print("No")
else:
  print("Yes")
visit_list = []
def topological_sort():
    for s in range(n):
        if color[s] == 0:
            dfs(s)

def dfs(u):
    color[u] = 1
    for v in graph[u]:
        if color[v] == 0:
            dfs(v)
    visit_list.append(u)        


n = int(input())
if n > 1:
    color = [0] * n
    graph = [[] * n for _ in range(n)]
    for _ in range(n - 1):
        a, b = map(int, input().split())
        a, b = a - 1, b - 1
        graph[a].append(b)
        graph[b].append(a)    

    topological_sort()
    c = [int(i) for i in input().split()]
    c.sort()
    t_list = [[visit_list[i], c[i]] for i in range(n)]
    t_list.sort()
    print(sum(c[:-1]))
    a_list = [str(t[1]) for t in t_list]
    print(" ".join(a_list))
else:
    k = int(input())
    print(k)
    print(k)

### FIXED CODE ###

n = int(input())
graph = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
c = [int(i) for i in input().split()]
c.sort()
c.reverse()
ans_list = [0 for _ in range(n)]
ans = 0
p_list = [0]
ans_list[0] = c.pop(0)
while len(p_list) > 0:
    p = p_list.pop(0)
    for g in graph[p]:
        if ans_list[g] == 0:
            ans_list[g] = c.pop(0)
            ans += ans_list[g]
            p_list.append(g)
print(ans)
print(' '.join([str(i) for i in ans_list]))
# C - Bridge
# https://atcoder.jp/contests/abc075/tasks/abc075_c

from collections import deque

def dfs(pos):
  visited = [False] * n
  stack = deque()
  stack.append(pos)
  visited[pos] = True
  while stack:
    q = stack.popleft()
    nxts = graph[q]
    for nxt in nxts:
      if not visited[nxt]:
        visited[nxt] = True
        stack.append(nxt)
  return visited

n, m = map(int, input().split())
edge = [list(map(int, input().split())) for _ in range(m)]

ans = 0
for i in range(m):
  graph = [[] for _ in range(n)]
  for itr, (a, b) in enumerate(edge):
    if itr != i:
      graph[a - 1].append(b - 1)
      graph[b - 1].append(a - 1)

  if not all(dfs(i)):
    ans += 1

print(ans)


### FIXED CODE ###

from scipy.sparse.csgraph import dijkstra
N, M = map(int, input().split())
edge = [list(map(int, input().split())) for _ in range(M)]

graph = [[0] * (N + 1) for _ in range(N + 1)]
for a, b in edge:
  graph[a][b] = 1

answer = 0
INF = 10 ** 9
for a, b in edge:
  # a-bのedgeを取り除いた場合にa-bの距離を測る
  graph[a][b] = INF
  dist = dijkstra(graph, indices = a, directed = False)
  if dist[b] >= INF:
    answer += 1
  # a-bのedgeを戻す
  graph[a][b] = 1

print(answer)
N = int(input())
B = list(map(int, input().split()))
k = [B[0]+B[-1]]
A = [ min(B[i],B[i+1] for i in range (N-2) ]
C = sum(k + A)
print(C)


### FIXED CODE ###

N = int(input())
B = list(map(int, input().split()))
k = B[0]+B[N-2]
for i in range(1, N-1):
    if B[i] < B[i-1]:
        k += B[i]
    else:
        k += B[i-1]
print(k)
t=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
p,q=[0],[0]
w=[]
for i in range(4):
    p.append(p[-1]+a[i%2]*t[i%2])
    q.append(q[-1]+b[i%2]*t[i%2])
    w.append(p[i+1]-q[i+1])
    if i==3:
        if len(set(w))!=4:
            print("infinity")
            exit()
        chk=0
        if (w[0]>0 and w[1]>0) or (w[0]<0 and w[1]<0):]
            print(0)
        elif (w[0]>0 and w[1]<0 and w[2]<0) or (w[0]<0 and w[1]>0 and w[2]>0):
            print(1)

### FIXED CODE ###

T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
 
P = (A1 - B1) * T1
Q = (A2 - B2) * T2
if P > 0:
	P *= -1
	Q *= -1
 
if P + Q < 0:
	print(0)
elif P + Q == 0:
	print("infinity")
else:
	S = (-P) // (P + Q)
	T = (-P) % (P + Q)
	if T != 0:
		print(S * 2 + 1)
	else:
		print(S * 2)
import pandas as pd
import numpy as np

N, D = map(int, input().split(" "))
data = pd.DataFrame()
a = 0
for i in range(N):
    data[i] = list(map(int, input().split(" ")))
for i, j in data.iteritems():
    for k, l in data.iteritems():
        if i < k:
            if np.sqrt(sum((j - l)**2))%1 == 0:
                a += 1
print(a)

### FIXED CODE ###

def solve(X:list, N:int):
    cnt = 0
    for i in range(N):
        for j in range(i):
            dist = 0
            for a, b in zip(X[i], X[j]):
                dist += (a-b)**2
            if dist**.5%1 == 0:
                cnt += 1
    print(cnt)

def main():
    N, D = map(int, input().split(" "))
    X = [list(map(int, input().split(" "))) for i in range(N)]
    solve(X, N)

if __name__ == "__main__":
    main()
a,b=(int(x) for x in input().split())
 
 print(a*b)
                                                                                          
                                                                                          
                                                                                          
        

### FIXED CODE ###

a,b=(int(x) for x in input().split())

print(int(a*b))
s=input()s=input()
if "N" in s and "S" in s and "W" in s and "E" in s:
    print("Yes")
elif "N" in s and "S" in s:
    print("Yes" if "W" in s or "E" in s else "No")
else:
    print("Yes" if "N" in s or "S" in s else "No")

### FIXED CODE ###

s=input()
if "N" in s and "S" in s and "W" in s and "E" in s:
    print("Yes")
elif "N" in s and "S" in s:
    print("No" if "W" in s or "E" in s else "Yes")
elif "W" in s and "E" in s:
    print("No" if "N" in s or "S" in s else "Yes")
else:
    print("No")
N,X=map(int,input().split())
x=list(map(int,input().split()))
x.append(X)
mx=min(x)
x=list(map(lambda t:t-mx,x))
def gcd(a,b):
    while b:
        a,b=b,a%b
    return(a)
a=10**10
for i,j in zip(x,x[1:]):
    a=min(a,gcd(i,j))
print(a)

### FIXED CODE ###

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

if A % 2 != 0 and B % 2 !=0:
    print('Yes')
else:
    print('No')
A,B = int(input().split(' '))
def lcm(x, y):
    return (x * y)
print(lcm(A, B))


### FIXED CODE ###

import fractions
a = list(map(int, input().split()))
print(a[0]*a[1] // fractions.gcd(a[0], a[1]))
def fact(n):
    if n == 0:
        return 1
    else:
        return n*fact(n-1)
def conb(n,r):
    return fact(n)//(fact(r)*fact(n-r))

N,A,B = map(int,input().split())
v = list(map(int,input().split()))
v.sort()
v.reverse()
d_all = {}
for i in range(N):
    if v[i] not in d_all:
        d_all[v[i]] = 0
    d_all[v[i]] += 1
import numpy as np
avg = np.cumsum(np.array(v))
for i in range(N):
    avg[i]=int(avg[i])/(i+1)
avg = avg[A-1:B]
ans = max(avg)
print(ans)
indices = np.where(avg==ans)[0]
ans = 0
for index in indices:
    d_use = {}
    use = A + index
    v_use = v[:use]
    choose=1
    for item in v_use:
        if item not in d_use:
            d_use[item] = 0
        d_use[item] += 1
    for item in d_use:
        choose *= conv(d_all[item],d_use[item])
    ans += choose

print(ans)

### FIXED CODE ###

def fact(n):
    if n == 0:
        return 1
    else:
        return n*fact(n-1)
def conb(n,r):
    return fact(n)//(fact(r)*fact(n-r))

N,A,B = map(int,input().split())
v = list(map(int,input().split()))
v.sort()
v.reverse()
d_all = {}
for i in range(N):
    if v[i] not in d_all:
        d_all[v[i]] = 0
    d_all[v[i]] += 1
import numpy as np
avg = np.cumsum(np.array(v))
avg = [0]*N
avg[0]=v[0]
for i in range(N-1):
    avg[i+1]=avg[i]+v[i+1]
for i in range(N):
    avg[i]=avg[i]/(i+1)
    
avg = avg[A-1:B]
ans = max(avg)
print(ans)
avg=np.array(avg)
indices = np.where(avg==ans)[0]
ans = 0
for index in indices:
    d_use = {}
    use = A + index
    v_use = v[:use]
    choose=1
    for item in v_use:
        if item not in d_use:
            d_use[item] = 0
        d_use[item] += 1
    for item in d_use:
        choose *= conb(d_all[item],d_use[item])
    ans += choose

print(ans)
# -*- coding: utf-8 -*-
S = str(input())
L = ["abcdefghijklmnopqrstuvwxyz"]
T = L-S
print(T[0])

### FIXED CODE ###

S = input()

unko =["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

for i in unko:
    if S.count(i) == 0:
        print(i)
        exit()

print("None")
import copy

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

    def lcm(a, b):
        return int(a / gcd(a, b)) * b

    n, m = map(int, input().split())
    # A = set([int(x) for x in input().split()])
    A = [int(x) for x in input().split()]
    A_ = copy.deepcopy(A)
    a_lcm = A.pop()
    # Aにまだ値が残っていれば
    if len(A) >= 1:
        for a in A:
            a_lcm = lcm(a_lcm, a)
    # 元のAの値とlcmの半分の値を割り切れるものがあったら終了
    for i in A_:
        if (a_lcm / 2) % i != 0:
            continue
        else:
            print(0)
            exit()
    if a_lcm / 2 > m:
        print(0)
    else:
        ans = int((m - (a_lcm / 2))) // a_lcm + 1
        print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
# from math import gcd


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

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # mがlcmの半分よりも小さかったら0
        if (a_lcm / 2) > m:
            print(0)
            exit()
    for a in A:
        if (a_lcm / 2) % a == 0:
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()
N=int(input())
P = list(map(int,input().split()))
ans=0
 
 
for i in range(N):
    if min(P[:i+1])==P[i]:
        ans+=1
print(ans)

### FIXED CODE ###

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

if N==M:
    print('Yes')
else:
    print('No')
n, m = map(int, input().split())
if m >= n:
  print("Yes")
elses:
  print("No")

### FIXED CODE ###

n, m = map(int, input().split())
if m >= n:
  print("Yes")
else:
  print("No")
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))
def prime_decomposition(n):
    i = 2
    table = []
    while i*i <= n:
        while n%i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table
def prime_decomposition2(n):
    i = 2
    table = defaultdict(int)
    while i*i <= n:
        while n%i == 0:
            n //= i
            table[i] += 1
        i += 1
    if n > 1:
        table[n] += 1
    return table
def make_divisor(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n%i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    return divisors

N = int(input())
list_pd1 = make_divisor(N)
list_pd1.sort()
dict_pd2 = prime_decomposition2(N-1)
#print(N, ':', list_pd1)
#print(N-1, ':', dict_pd2)

cnt = 1

# -1 nohou
for val in dict_pd2.values():
    cnt *= (val+1)
cnt -= 1
#print(cnt)

for k in list_pd1[1:]:
    #print('k:', k)
    sN = N
    while sN >= k:
        if sN%k==0:
            sN //= k
        else:
            sN %= k
    if sN == 1:
        cnt += 1

print(cnt)

### FIXED CODE ###

import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))
def prime_decomposition(n):
    i = 2
    table = []
    while i*i <= n:
        while n%i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table
def prime_decomposition2(n):
    i = 2
    table = defaultdict(int)
    while i*i <= n:
        while n%i == 0:
            n //= i
            table[i] += 1
        i += 1
    if n > 1:
        table[n] += 1
    return table
def make_divisor(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n%i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    return divisors

N = int(input())
list_pd1 = make_divisor(N)
list_pd1.sort()
dict_pd2 = prime_decomposition2(N-1)
#print(N, ':', list_pd1)
#print(N-1, ':', dict_pd2)

cnt = 1

# -1 nohou
for val in dict_pd2.values():
    cnt *= (val+1)
cnt -= 1
#print(cnt)

for k in list_pd1[1:]:
    #print('k:', k)
    sN = N
    while sN >= k:
        if sN%k==0:
            sN //= k
        else:
            sN %= k
    if sN == 1:
        cnt += 1

print(cnt)
import sys
a=input().strip()
b=input().strip()

if a==b:
  print("EQUAL")
elif len(a)>len(b):
  print("GREATER")
elif len(b)>len(a):
  print("LESS")
else: #same len
  for i in range(len(a)):
    if int(a[i])>int(b[i])
      print("GREATER")
      sys.exit()
    elif int(a[i])<int(b[i])
      print("LESS")
      sys.exit()

### FIXED CODE ###

import sys
a=input().strip()
b=input().strip()

if a==b:
  print("EQUAL")
elif len(a)>len(b):
  print("GREATER")
elif len(b)>len(a):
  print("LESS")
else: #same len
  for i in range(len(a)):
    if int(a[i])>int(b[i]):
      print("GREATER")
      sys.exit()
    elif int(a[i])<int(b[i]):
      print("LESS")
      sys.exit()
import networkx as nx


def is_inside(x, y, W, H, G):
    return (x <= H-1 and y <= W-1 and
            x >= 0 and y >= 0 and
            G[x][y] != "#")


def main():
    graph = nx.Graph()
    H, W = map(int, input().split())
    Ch, Cw = map(int, input().split())
    Dh, Dw = map(int, input().split())
    G = [list(input()) for _ in range(H)]

    for h in range(H):
        for w in range(W):
            if not is_inside(h, w, W, H, G):
                continue

            v = h * W + w
            for step_h in range(-2, 3):
                for step_w in range(-2, 3):
                    h_, w_ = h+step_h, w+step_w
                    v_ = h_ * W + w_
                    if is_inside(h_, w_, W, H, G):
                        if ((max(abs(step_h), abs(step_w)) == 1) and
                                (min(abs(step_h), abs(step_w)) == 0)):
                            graph.add_edge(v, v_, weight=0)

                        else:
                            graph.add_edge(v, v_, weight=1)
    start = (Ch - 1) * W + (Cw - 1)
    end = (Dh - 1) * W + (Dw - 1)
    try:
        ans = nx.dijkstra_path_length(graph, start, end)
    except nx.NetworkXNoPath:
        ans = -1

    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import deque


def is_inside(x, y, W, H, G):
    return (x <= H-1 and y <= W-1 and
            x >= 0 and y >= 0 and
            G[x][y] != "#")


def main():
    H, W = map(int, input().split())
    Cx, Cy = map(int, input().split())
    Dx, Dy = map(int, input().split())

    G = [list(input()) for _ in range(H)]
    INF = int(1e9)
    q = deque()
    q.append((Cx-1, Cy-1, -INF, Cx-1, Cy-1))
    warps = [[INF] * W for _ in range(H)]
    while q:
        x, y, warp, prev_x, prev_y = q.popleft()

        if warps[x][y] != INF:
            continue

        num_warps = warps[prev_x][prev_y] + warp
        warps[x][y] = num_warps

        for step_x in range(-2, 3):
            for step_y in range(-2, 3):
                x_, y_ = x+step_x, y+step_y
                if is_inside(x_, y_, W, H, G) and warps[x_][y_] == INF:
                    if ((max(abs(step_x), abs(step_y)) == 1) and
                            (min(abs(step_x), abs(step_y)) == 0)):

                        q.appendleft((x_, y_, 0, x, y))
                    else:
                        q.append((x_, y_, 1, x, y))

    ans = warps[Dx-1][Dy-1]
    if ans == INF:
        print(-1)
    else:
        print(ans)


if __name__ == '__main__':
    main()
n = int(input())
a = [int(num) for num in input().split()]
m = 0
for i in range(n):
  for j in range(n):
    m = max(max,abs(a[i]-a[j]))
print(m)

### FIXED CODE ###

n = int(input())
a = [int(num) for num in input().split()]
m = 0
for i in range(n):
  for j in range(n):
    m = max(m,abs(a[i]-a[j]))
print(m)
H,W=map(int,input().split())
S=[list(input()) for i in range(H)]
for i in range(H):
    for j in range(W):
        if s[i][j]=='#':
            continue
            #もし見ている文字が#だったら通過
        cnt=0
        for k in [-1,0,1]:
            if i+k<0 or H<=i+k:
                continue
                #iが端の時通過
            for l in [-1,0,1]:
                if j+l<0 or j+l>=w:
                    continue
                    #jが端の時通過
                cnt+=1*(s[i+k][j+l]=='#')
                #一個前一個上~一個下一個右までの#の数を足す
        s[i][j]=str(cnt)
        #見ていた数を足した数字に変更
for i in range(h):
    print("".join(s[i]))


### FIXED CODE ###

H,W=map(int,input().split())
S=[list(input()) for i in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j]=='#':
            continue
            #もし見ている文字が#だったら通過
        cnt=0
        for k in [-1,0,1]:
            if i+k<0 or H<=i+k:
                continue
                #iが端の時通過
            for l in [-1,0,1]:
                if j+l<0 or j+l>=W:
                    continue
                    #jが端の時通過
                cnt+=1*(S[i+k][j+l]=='#')
                #一個前一個上~一個下一個右までの#の数を足す
        S[i][j]=str(cnt)
        #見ていた数を足した数字に変更
for i in range(H):
    print("".join(S[i]))
import copy

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


def cal(i, dst):
  if i == -1:
    return 0

  result = None
  for j in range(n):
    if dst[j]:
      continue
    dst[j] = i
    val = arr[i] * abs(i - j) + cal(i - 1, dst)
    dst[j] = None
    result = max(result, val) if result else val

  return result

print(cal(n - 1, [None for _ in range(n)]))


### FIXED CODE ###


def main():

  n = int(input())
  arr = map(int, input().split())
  arr = tuple(sorted(enumerate(arr), key=lambda tpl: -tpl[1]))

  dp = [[0] * (n + 1) for _ in range(n + 1)]
  for i, (p, a) in enumerate(arr):
    for l in range(i + 1):
      dp[i + 1][l] = max(dp[i + 1][l], dp[i][l] + a * abs(p - (n - (i - l) - 1)))
      dp[i + 1][l + 1] = max(dp[i + 1][l + 1], dp[i][l] + a * abs(p - l))

  print(max(dp[n]))

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

if a==b and b!=c:
  print("Yes")
elif c==b! and b=a:
  print("Yes")
elif a!=b and b==c:
  print("Yes"):
else:
  print("No")

### FIXED CODE ###

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

if a==b and b==c:
  print("No")
elif a==b or b==c or c==a :
  print("Yes")
  
else:
  print("No")
n = int(input())
a = list(map(int, input()))
s = round(sum(a)/n)
ans = 0
for i in a:
  ans += (i-s)**2
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
s = round(sum(a)/n)
ans = 0
for i in a:
  ans += (i-s)**2
print(ans)