Harryxun/stf_run huggingface dataset:
import sys

N_MAX = 100010

dp = [-1]*N_MAX
vec = [0]*N_MAX

def frog(n):
  if dp[n] != -1:
    return dp[n]
  else:
    dp[n] = min(frog(n-1) + abs(vec[n] - vec[n-1]) , frog(n-2) + abs(vec[n] - vec[n-2]))
    return dp[n]
  
N = int(input())
ln = list(map(int, input().split()))

for i in range(N):
  vec[i] = ln[i]

dp[0] = 0
dp[1] = abs(vec[0] - vec[1])

print(frog(N-1))

  

### FIXED CODE ###

import sys

N_MAX = 100010

sys.setrecursionlimit(500000)

dp = [-1]*N_MAX
vec = [0]*N_MAX

def frog(n):
  if dp[n] != -1:
    return dp[n]
  else:
    dp[n] = min(frog(n-1) + abs(vec[n] - vec[n-1]) , frog(n-2) + abs(vec[n] - vec[n-2]))
    return dp[n]
  
N = int(input())
ln = list(map(int, input().split()))

for i in range(N):
  vec[i] = ln[i]

dp[0] = 0
dp[1] = abs(vec[0] - vec[1])

print(frog(N-1))
N,K=list(map(int,input().split()))
l=input()
n=l[0]
cnt=0
ans=[]
for i in l:
   if i != n:
      ans.append(cnt)
      cnt=1
      n=i
   else:
      cnt+=1
ans.append(cnt)
if l[0] == "0":
   sum_n=sum(ans[0:K*2])
   now=1
   end=K*2
else:
   sum_n=sum(ans[0:K*2+1])
   now=0
   end=K*2+1
max_n=sum_n
for i in range(len(ans)-end+1):
   sum_n-=ans[i]
   if now==0:
      now=1
   else:
      try:
         sum_n=sum_n+ans[end]+ans[end+1]
         end+=2
      except IndexError:
         sum_n+=ans[end]
         max_n=max(sum_n,max_n)
         print(max_n)
         exit()
      now=0
   max_n=max(sum_n,max_n)

### FIXED CODE ###

N,K=list(map(int,input().split()))
l=input()
n=l[0]
cnt=0
ans=[]
for i in l:
   if i != n:
      ans.append(cnt)
      cnt=1
      n=i
   else:
      cnt+=1
ans.append(cnt)
if l[0] == "0":
   sum_n=sum(ans[0:K*2])
   now=1
   end=K*2
   plus=0
else:
   sum_n=sum(ans[0:K*2+1])
   now=0
   end=K*2+1
   plus=1
max_n=sum_n
for i in range(len(ans)-end+plus):
   sum_n-=ans[i]
   if now==0:
      now=1
   else:
      try:
         sum_n=sum_n+ans[end]+ans[end+1]
         end+=2
      except IndexError:
         sum_n+=ans[end]
         max_n=max(sum_n,max_n)
         print(max_n)
         exit()
      now=0
   max_n=max(sum_n,max_n)
print(max_n)
N = int(input())
L = list(map(int,input().split()))
L.sort()

ans=0
for a_idx in range(len(L)):
    a = L[a_idx]
    for b_idx in range(a_idx+1,len(L)):
        b = L[b_idx]
        c_low = b - a + 1
        c_up = a + b - 1
        
        c_low_idx = bisect.bisect(L,c_low)
        c_up_idx = bisect.bisect(L,c_up)
        c_low_idx = max(b_idx,c_low_idx)
        
        ans += max(0,c_up_idx-c_low_idx-1)
#         print(a,b,ans,c_up_idx,c_low_idx)
print(ans)

### FIXED CODE ###

import bisect

N = int(input())
L = list(map(int,input().split()))
L.sort()

# print(L)

ans=0
for a_idx in range(len(L)):
    a = L[a_idx]
    for b_idx in range(a_idx+1,len(L)):
        b = L[b_idx]
        c_low = b - a
        c_up = a + b - 1
        
        c_low_idx = bisect.bisect(L,c_low)
        c_up_idx = bisect.bisect(L,c_up)
        
#         print('=====')
#         print(a,b)
#         print(c_low_idx,c_up_idx)
        
        c_low_idx = max(b_idx,c_low_idx)
        
        ans += max(0,c_up_idx-c_low_idx-1)
#         print(ans,c_low_idx,c_up_idx)
print(ans)
n,k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

if k == 1:
  print(0)
else:
  for i in range(1,n):
    if n-i < k-1:
      break
    ans += a[n-i]*cmb(n-i,k-1)
    ans -= a[i-1]*cmb(n-i,k-1)
print(ans%1000000007)

### FIXED CODE ###

n,k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0

from operator import mul
from functools import reduce
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 5
fact = [1, 1]  
factinv = [1, 1]
inv = [0, 1]  

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

if k == 1:
  print(0)
else:
  for i in range(1,n):
    if n-i < k-1:
      break
    ans += a[n-i]*cmb(n-i,k-1,p)
    ans -= a[i-1]*cmb(n-i,k-1,p)
  print(ans%1000000007)
k = int(input())

ans = 0
ai = 0

while True:
    ai = (ai*10 + 7)% k
    ans += 1
    if ai = 0:
        break
print(ans)

### FIXED CODE ###

K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()

i = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % K
    i += 1
    if ai == 0:
        break
print(i)
def Main(N, M, S, C):
    digits = {1:set([]), 2:set([]), 3:set([])}
    for i in range(M):
        digits[S[i]].add(C[i])
    for k, v in digits.items():
        if len(v) >= 2:
            return -1
    if len(digits[1]) > 0 and list(digits[1])[0] == 0:
        return -1
    if len(digits[1]) == 0 and len(digits[2]) > 0 and list(ditis[2])[0] == 0:
        return -1  
    ans_list = []
    for v in digits.values():
        if len(v) == 0:
            ans_list.append('0')
        else:
            ans_list.append(str(list(v)[0]))
    ans_str = "".join(ans_list)
    return eval(ans_str)
        
                

def main():
    N, M = map(int, input().split())
    S = [0]*M
    C = [0]*M
    for i in range(M):
        S[i], C[i] = map(int, input().split())
    print(Main(N, M, S, C))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def Main(N, M, S, C):
    dig = [set([]),set([]),set([])]
    for i in range(M):
        dig[S[i]-1].add(C[i])
    for s in dig:
        if len(s) == 2:
            return -1
    if N == 3:
        if len(dig[0]) > 0 and list(dig[0])[0] == 0:
            return -1
        if len(dig[0]) == 0:
            dig[0].add(1)
        if len(dig[1]) == 0:
            dig[1].add(0)
        if len(dig[2]) == 0:
            dig[2].add(0)
        return list(dig[0])[0]*100+list(dig[1])[0]*10+list(dig[2])[0]
    elif N == 2:
        if len(dig[0]) > 0 and list(dig[0])[0] == 0:
            return -1
        if len(dig[0]) == 0:
            dig[0].add(1)
        if len(dig[1]) == 0:
            dig[1].add(0)
        return list(dig[0])[0]*10+list(dig[1])[0]
    else:
        return list(dig[0])[0]       
        
                

def main():
    N, M = map(int, input().split())
    if M == 0:
        if(N == 3):
            print(100)
        elif(N == 2):
            print(10)
        else:
            print(0)
        exit()
    S = [1]*M
    C = [0]*M
    for i in range(M):
        S[i], C[i] = map(int, input().split())
    print(Main(N, M, S, C))

if __name__ == '__main__':
    main()
N,K = map(int,input().split())
A = list(map(int,input().split()))
L = []
import numpy as np
for i in range(K,N+1):
    L.append(np.prod(A[i-K:i]))
for i in range(len(L)-1):
    if L[i] < L[i+1]:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
for i in range(K,N):
    if A[i-K] < A[i]:
        print('Yes')
    else:
        print('No')
X = input()
A = input()

if X < A:
    print(0)

elif A <= X:
    print(10)


### FIXED CODE ###

c = input()
l = c.split()

x = int(l[0])
a = int(l[1])

if x < a:
    print(0)

elif a <= x:
    print(10)
H,W=map(int,input().split())
h,w=map(int,input().split())
print((H-h)*（W-w）)

### FIXED CODE ###

H,W=map(int,input().split())
h,w=map(int,input().split())
print((H-h)*(W-w))
N, Q = map(int, input().split())
A = [[] for _ in range(N)]
for _ in range(N-1):
    i, k = map(int, input().split())
    A[i-1].append(k-1)
    A[k-1].append(i-1)
n_P = [0] * N
for _ in range(Q):
    k, n = map(int, input().split())
    n_P[k-1] += n
ans = [0] * N
visited = [0] * N
def make(num, p):
    ans[num] += n_P[num] 
    ans[num] += p
    visited[num] = 1
    for i in A[num]:
        if visited[i] == 0:
            make(i,ans[num])
    return
make(0, ans[0])
print(*ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(2*10**9)
N, Q = map(int, input().split())
A = [[] for _ in range(N)]
for _ in range(N-1):
    i, k = map(int, input().split())
    A[i-1].append(k-1)
    A[k-1].append(i-1)
n_P = [0] * N
for _ in range(Q):
    k, n = map(int, input().split())
    n_P[k-1] += n
ans = [0] * N
visited = [0] * N
def make(num, p):
    ans[num] += n_P[num] 
    ans[num] += p
    visited[num] = 1
    for i in A[num]:
        if visited[i] == 0:
            make(i,ans[num])
    return
make(0, ans[0])
print(*ans)
n = (int,raw_input())

numlist = map(int, raw_input().split())
numlist = sorted(numlist)
for x in numlist
 print x,

### FIXED CODE ###

n = input()
for i in sorted(map(int, raw_input().split())):
 print i ,
N,K = list(map(int,input().split()))
A = input()
A = list(A)
A = list(map(int,A))
count =0
def serch (x,A,K,count1,count0):
    if x<0 or len(A)<=x:
        return count1
    if A[x] == 0:
        if A[x-1]==0 and x!=0:
            count1 +=1
            count1 = serch(x+1,A,K,count1,count0)
        elif count0==K:
            return count1
        elif A[x-1]!=0:
            count0 +=1
            count1 +=1
            count1 = serch(x+1,A,K,count1,count0)
    else:
        count1 +=1
        count1 = serch(x+1,A,K,count1,count0)
    return count1
for i in range(len(A)):
    count1 =0
    count0 =0
    count1 = serch(i,A,K,count1,count0)
    count = max(count1,count)
print(count)

### FIXED CODE ###

N,K = list(map(int,input().split()))
A = input()
A = list(A)
A = list(map(int,A))
l = [0]
s = []

for i in range(N-1):
    if A[i] != A[i+1]:
        l.append(i+1)
        s.append(l[len(l)-1]-l[len(l)-2])
l.append(N)
s.append(l[len(l)-1]-l[len(l)-2])
a = 0
right = 0
left = 0
g = 0
su = 0
if A[0] == 0:
    for i in range(len(s)):
        su +=s[right]
        if right%2==0:
            g += 1
        right +=1
        if g<=K:
            a = max(a,su)
        else:
            while g>K:
              su -= s[left]
              if left%2==0:
                  g -=1
              left +=1
        a = max(a,su)
else:
    for i in range(len(s)):
        su +=s[right]
        if right%2==1:
            g += 1
        right +=1
        if g<=K:
            a = max(a,su)
        else:
            while g>K:
              su -= s[left]
              if left%2==1:
                  g -=1
              left +=1
        a = max(a,su)

print(a)
N,A,B = map(int,input().split())
Q = N//(A + B)
if N - Q * (A + B) > A:
  print(Q * A + A)
else:
  print(Q * A + N - Q * (A + B))

### FIXED CODE ###

S = input()
if S[0] == S[1] and S[1] == S[2]:
  print('No')
else:
  print('Yes')
n,m = map(int,input().split())
l1 = list(map(int,input().split()))

for i in range(m):
  l1 = sorted(l1)
  l1[-1] //= 2
print(sum(l1))
  

### FIXED CODE ###

a = input()
s = "Sunny"
c = "Cloudy"
r = "Rainy"
 
if a == s:
		print(c)
elif a == c:
		print(r)
		
else:
		print(s)
n=int(input())
a=[int(i) for i in input().split()]
#dp=[[0]*(n+1) for i in range(n+1)]
dp=[[0]*(n+1) for i in range(n)]

for w in range(1,n+1):
#for w in range(1,3,1):
#    print(dp[1])
    for l in range(n-w+1):
        print("#",l)
        r=l+w
        dpl=-dp[l+1][r]+a[l]
        dpr=-dp[l][r-1]+a[r-1]
        dp[l][r]=max(dpl,dpr)
#print()
#for i in dp:
#    print(i)
print(dp[0][n])


### FIXED CODE ###

n=int(input())
a=[int(i) for i in input().split()]
dp=[[0]*(n+1) for i in range(n+1)]

for w in range(1,n+1):
#for w in range(1,3,1):
#    print(dp[1])
    for l in range(n-w+1):
        r=l+w
        dpl=-dp[l+1][r]+a[l]
        dpr=-dp[l][r-1]+a[r-1]
        dp[l][r]=max(dpl,dpr)
#print()
#for i in dp:
#    print(i)
print(dp[0][n])
_input = [i for i in open(0).read().split('\n') if i]
n, k = [int(i) for i in _input[0].split()]
edge = [[int(p) for p in i.split()] for i in _input[1:n]]

if not edge:
    print(k)
else:
    import collections
    import math

    all_edge_map = collections.defaultdict(list)
    for e in edge:
        all_edge_map[e[0]].append(e[1])
        all_edge_map[e[1]].append(e[0])

    root = edge[0]
    visit  = list(all_edge_map[root[0]])
    tree_edge_map = collections.defaultdict(list)
    colored = []
    total = (math.factorial(k) // math.factorial(k - len(all_edge_map[root[0]]) - 1))
    total %= 1000000007
    colored.append(root[0])
    colored.extend(all_edge_map[root[0]])


### FIXED CODE ###

import sys
sys.setrecursionlimit(4100000)

_input = [i for i in open(0).read().split('\n') if i]
n, k = [int(i) for i in _input[0].split()]
edge = tuple([tuple([int(p) for p in i.split()]) for i in _input[1:n]])

factorial = [0] * (k + 1)
inverse = [0] * (k + 1)
MOD = 1000000007

# Ref: http://keita-matsushita.hatenablog.com/entry/2016/12/05/175024
def mod_pow1(n, k, mod):
    a = 1
    while k:
        if (k & 1) == 1:
            a = (a * n) % mod
        n = (n * n) % mod
        k >>= 1
    return a

# Ref: https://www.smartbowwow.com/2018/10/mod1097.html
def mod_pow2(n, k, mod):
    if k == 0:
        return 1
    if k % 2 == 0:
        a = mod_pow2(n, k // 2, mod)
        return (a * a) % mod
    else:
        return (n * mod_pow2(n, k - 1, mod)) % mod

#mod_pow = mod_pow1
# It's better to use built-in function for speed.
mod_pow = pow

def mod_factorial_inverse(k, mod):
    factorial[0] = 1
    inverse[0] = 1

    # Ref: http://keita-matsushita.hatenablog.com/entry/2016/12/05/184011
    for i in range(1, k + 1):
        factorial[i] = ((i * factorial[i - 1]) % mod) # factrial[i]
        inverse[i] = mod_pow(factorial[i], mod - 2, mod) # inverse[i]
 
total = 1

if not edge:
    print(k)
else:
    all_edge = tuple([[] for _ in range(n + 1)])
    for e in edge:
        all_edge[e[0]].append(e[1])
        all_edge[e[1]].append(e[0])
    all_edge = [set(v) for v in all_edge]

    if [v for v in all_edge if len(v) >= k]:
        print(0)
    else:
        mod_factorial_inverse(k, MOD)

        root = edge[0]
        total = (factorial[k] * inverse[k - len(all_edge[root[0]]) - 1]) % MOD

        def dfs(current, from_):
            global total
            child = all_edge[current]
            if len(child) - 1 > 0:
                total = (total * factorial[k - 2] * inverse[k - 2 - (len(child) - 1)]) % MOD
            for c in child:
                if c != from_:
                    dfs(c, current)
        for c in all_edge[root[0]]:
            dfs(c, root[0])
        print(total)
x,y = map(int,input().split())
flag = 0
for i in range (100):
  for j in range (100):
    if ((i+j == x) and(2*i+4*j == y))  :
      print("Yes")
      flag = 1
if flag == 0:
print("No")

### FIXED CODE ###

x,y = map(int,input().split())
flag = 0
for i in range (100):
  for j in range (100):
    if ((i+j == x) and(2*i+4*j == y)):
      print("Yes")
      flag = 1
if (flag == 0):
    print("No")
s = input()
if s == "hi" * len(s) // 2:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = input()
if s == "hi" * (len(s) // 2):
    print("Yes")
else:
    print("No")
# Here your code !
# -*- coding:utf-8 -*-
import sys

def init():
    data = []
    while(True):
        line = raw_input()
        if not line: break
        data.append(line)
    return data

def main():
    n = int(init().pop)
    if 1 <= n <= 100:
        print n**3
    else:
        print "Error / Invalid input (%d)" % n

if __name__ == '__main__':
    main()

### FIXED CODE ###

# coding: utf-8
# Here your code !
# -*- coding:utf-8 -*-
import sys

def init():
    data = []
    try:
        while(True):
            line = raw_input()
            if not line: break
            data.append(line)
    except EOFError:
        pass
    return data

def main():
    n = int(init().pop())
    if 1 <= n <= 100:
        print n**3
    else:
        print "Error / Invalid input (%d)" % n

if __name__ == '__main__':
    main()
nums = input() 
N = 3
for i in range(2**N):
    equation = ''
    for j in range(N+1):
        equation += nums[j]
        if ((i >> j) & 1):
            equation += '+'
        else:
            equation += '-'
    if eval(equation) == 7:
        print(equation + '=7')
        exit()

### FIXED CODE ###

n = input()
s = len(n)-1


for i in range(2**s):
  op = ""
  for j in range(s):
    if (i>>j)&1:
      op += "+"
    else:
      op += "-"
  ans =int(n[0])
  for j in range(len(op)):
    if op[j]=="+":
      ans += int(n[j+1])
    else:
      ans -= int(n[j+1])
  if ans == 7:
      ret = ""
      for k in range(len(op)):
        ret += n[k]
        ret += op[k]
      ret += n[-1]
      ret += "=7"
      print(ret)
      exit(0)
L,R = map(int, input().split())
d = int(input())
ans = 0
for n in range(L, R+1):
  if n % d == 0:
    ans += 1
print(ans)

### FIXED CODE ###

L,R,d = map(int, input().split())
ans = 0
for n in range(L, R+1):
  if n % d == 0:
    ans += 1
print(ans)
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [float('inf') for _ in range(n)]
dp[0] = 0

for i in range(1, n):
    if i- k > 0:
        s = i - k
    else:
        s = 0
    dp[i] = min(d + abs(h[i] - h) for d, h in zip(dp[s:i], h[s:i]))

print(dp[-1])

### FIXED CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [float('inf')] * n

dp[0] = 0

for i in range(1, n):
    for j in range(1, k+1):
        if i - j < 0:
            continue
        dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]))

print(dp[n-1])
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
S = 0
for i in range(N):
    D = V[i] - C[i]
    if D >0:
    S = S + D
    
print(S)



### FIXED CODE ###

N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
S = 0
for i in range(N):
    D = V[i] - C[i]
    if D >0:
        S = S + D
    
print(S)
n = input()
l = 0
s = []
while len(s) < 2*n-1:
    s = s+[' ']+list(input())
    
a = {}
for i in range(1,int(n)+1):
    a[i] = int(s[2*i-2])

result = 0
for i in range(1,int(n)+1):
    if a[a[i]] == i:
        result = result+1
result = int(result/2)
print(result)

### FIXED CODE ###

n = input()
a = input()
a = a.split(sep=' ')

result = 0
for i in range(1,int(n)+1):
    if int(a[int(a[i-1])-1]) == i:
        result = result+1
result = int(result/2)
print(result)
a,b = map(int,input().split())

z = a % b

if z > b/2:
    print(abs(z-k))
else:
    print(z)

### FIXED CODE ###

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


z = a % b


if z > b/2:
    print(abs(z-b))
else:
    print(z)
def main():
	n, k = map(int, input().split())
	P = list(map(int, input().split()))
	sorted_p = sorted(P)
	ans = sum(sorted_p[:k])
	print(ans)
	return

if __name__ == "__main__":
	main(

### FIXED CODE ###

def main():
	n, k = map(int, input().split())
	P = list(map(int, input().split()))
	sorted_p = sorted(P)
	ans = sum(sorted_p[:k])
	print(ans)
	return

if __name__ == "__main__":
	main()
n = int(input())
a = list(map(int,input()))

money = 1000
stock = 0

for i in range(n-1):
  if a[i+1] > a[i]:
    stock = money // a[i]
    money = money - stock*a[i] + stock*a[i+1]

print(money)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
 
money = 1000
stock = 0
 
for i in range(n-1):
  if a[i+1] > a[i]:
    stock = money // a[i]
    money = money - stock*a[i] + stock*a[i+1]
 
print(money)
n=int(input())
a=[int(input()) for i in range(n)]
for _ in range(n):
  #b=a[0:_]+a[_+1:n]
  #print(max(b))
  print(max(a[0:_]),max(a[_+1:n]))


### FIXED CODE ###

n=int(input())
a=[int(input()) for i in range(n)]
b=sorted(a)
f=b[-1]
s=b[-2]
for ans in a:
  if ans < f:
    print(f)
  else:
    print(s)
#ABC065.B
N = int(input())
a = [int(input() for i in range(N))]
x = 0
for i in range(N):
    x = a[x]
    if a[x] == 2:
        print(i+1)
        break
else:
    print(-1)

### FIXED CODE ###

#ABC065.B
N = int(input())
a = [int(input()) for i in range(N)]
x = 1
for i in range(N):
    x = a[x-1]
    if x == 2:
        print(i+1)
        break
else:
    print(-1)
n = int(input())
h = list(map(int,input().split()))
cnt = 0; res = []
for i in range(n-1):
    if h[i] >= h[i+1]:
        cnt += 1
    else:
        res.append(cnt)
        cnt = 0
    if i == n-2:
        res.append(cnt)
        break
print(max(res))

### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
cnt = 0; res = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        cnt += 1
    else:
        cnt = 0
    res = max(res,cnt)
print(res)
h, w = map(int, input().split())
s = [input() + '#' for _ in range(h)]
s.append('#' * w)

yoko = [[0] * w for _ in range(h)]
for i in range(h):
  si = s[i]
  for j in range(w):
    if si[j] == '.':
      start = j
      break
  for j in range(start + 1, w + 1):
    if si[j] == '#':
      if start != -1:
        for k in range(start, j):
          yoko[i][k] = j - start
        start = -1
    else:
      if start == -1:
        start = j

tate = [[0] * w for _ in range(h)]
for i in range(w):
  if s[0][i] == '.':
    start = 0
  else:
    start = -1
  for j in range(1, h + 1):
    if s[j][i] == '#':
      if start != -1:
        for k in range(start, j):
          tate[k][i] = j - start
        start = -1
    else:
      if start == -1:
        start = j

result = 0
for i in range(h):
  yokoi = yoko[i]
  tatei = tate[i]
  for j in range(w):
    t = yokoi[j] + tatei[j] - 1
    if t > result:
      result = t

print(result)


### FIXED CODE ###

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

yoko = [[0] * w for _ in range(h)]
for i in range(h):
  if s[i][0] == '.':
    start = 0
  else:
    start = -1
  for j in range(1, w + 1):
    if s[i][j] == '#':
      if start != -1:
        for k in range(start, j):
          yoko[i][k] = j - start
        start = -1
    else:
      if start == -1:
        start = j

tate = [[0] * w for _ in range(h)]
for i in range(w):
  if s[0][i] == '.':
    start = 0
  else:
    start = -1
  for j in range(1, h + 1):
    if s[j][i] == '#':
      if start != -1:
        for k in range(start, j):
          tate[k][i] = j - start
        start = -1
    else:
      if start == -1:
        start = j
result = 0
for i in range(h):
  for j in range(w):
    t = yoko[i][j] + tate[i][j] - 1
    if t > result:
      result = t

print(result)
import sys

N = int(sys.stdin.readline().rstrip())
S = sys.stdin.readline().rstrip()
Q = int(sys.stdin.readline().rstrip())
k = [int(x) for x in sys.stdin.readline().rstrip().split(' ')]

def counter(S, ki):
	count = 0
	for i in range(0, len(S)): 
	  for j in range( i+2, len(S)):
	  	if j - i <=1 or j - i >= ki:
	  		continue
	  	for l in range(i+1, j):
	  		if (S[i], S[l], S[j]  ) == ('D', 'M', 'C'):
	  			count += 1
	return count
  
for ki in k:
	print(counter(S, ki))

### FIXED CODE ###

import sys
N = int(sys.stdin.readline().rstrip())
a = [int(x) for x in sys.stdin.readline().rstrip().split(' ')]
d = [abs(sum(a)/float(N) - ai) for ai in a]

if len(set(d))==1:
  print(0)
else:
  print(d.index(min(d)))
N = input()

print(N*N)


### FIXED CODE ###

N = int(input())

print(N*N)
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

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

print(lcm(A, B))


### FIXED CODE ###

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

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

ans = lcm(A, B)
print(int(ans))
import math

str_list = input().split(' ')
int_list = [int(x) for x in str_list]
A, B = int_list[0], int_list[1]

print( (A*B)//math.gcd(A, B) )


### FIXED CODE ###

import fractions

str_list = input().split(' ')
int_list = [int(x) for x in str_list]
A, B = int_list[0], int_list[1]

print( (A*B)//fractions.gcd(A, B) )
N = map(str, input())
if N[0]==N[2]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N = str(input())
if N[0]==N[2]:
  print('Yes')
else:
  print('No')
import sys
#入力
N, M = map(int, input().split())

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

lst.sort()

if M == 1:
    print (0)
    sys.exit()

sa = []

for i in range(M-1):
    sa += [abs(lst[i] - lst[i+1])]

sa.sort(reverse = True)

ans = -(lst[0] - lst[M-1])
#print (ans)
for j in range(N-1):
    ans -= sa[j]
print (ans)

### FIXED CODE ###

import sys
#入力
N, M = map(int, input().split())

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

lst.sort()
#print (lst)

sa = []

for i in range(M-1):
    sa += [abs(lst[i] - lst[i+1])]

sa.sort(reverse = True)
#print(sa)

ans = -(lst[0] - lst[M-1])
#print (ans)
if not sa ==[]:
    if N <= M:
        for j in range(N-1):
            ans -= sa[j]
    else:
        ans = 0
print (ans)