Harryxun/stf_run huggingface dataset:
n = int(input())
l = list(map(int,input().split()))
l1 = [0,0]
from collections import Counter
c = Counter(l)
for i in c:
  while l[i]>=2 and len(l1)<4:
    l1.append(l[i])
print(l1[-1]*l1[-2])

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
l1 = [0,0]
from collections import Counter
c = Counter(l)
for i in c.items():
  if i[1]>=2 :
    l1.append(i[0])
  if i[1]>=4 :
    l1.append(i[0])
l1.sort()
print(l1[-1]*l1[-2])
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


memo1 = {}
memo2 = {}

def ok(y1, y2, x1, x2, yd, yd2, xd, xd2, K):
    global memo1, memo2
    if (y1, y2) in memo1:
        a, b = memo1[(y1, y2)]
    else:
        a = yd2[y1]
        b = yd[y2]
        memo1[(y1, y2)] = (a, b)
    y = b.difference(a)

    if (x1, x2) in memo2:
        c, d =memo2[(x1, x2)]
    else:
        c = xd2[x1]
        d = xd[x2]
        memo2[(x1, x2)] = (c, d)

    x = d.difference(c)
    # print(a, b, c, d)
    # print(y, x)

    n = len(y & x)

    return n >= K


def main():
    N, K = map(int, input().split())
    f = []
    ys, xs = [], []
    for i in range(N):
        x, y = map(int, input().split())
        f.append((y, x))
        ys.append((y, i))
        xs.append((x, i))

    ys.sort()
    yd = defaultdict(set)
    yd2 = defaultdict(set)
    old = set()
    for y, i in ys:
        yd2[y] = old.copy()
        old.add(i)
        yd[y] = old.copy()

    xs.sort()
    xd = defaultdict(set)
    xd2 = defaultdict(set)
    old = set()
    for x, i in xs:
        xd2[x] = old.copy()
        old.add(i)
        xd[x] = old.copy()

    ans = INF

    # print(yd)
    # print(xd)
    #
    # print(ok(1, 4, 1, 8, yd, yd2, xd, xd2, K))
    for i, j in combinations(range(N), 2):
        for k, l in combinations(range(N), 2):
            a, b, c, d = ys[i], ys[j], xs[k], xs[l]
            y1 = min([a[0], b[0]])
            y2 = max([a[0], b[0]])

            x1 = min([c[0], d[0]])
            x2 = max([c[0], d[0]])

            # print(i, j)
            # print(x1, x2, abs(x1 - x2))
            # print(y1, y2, abs(y1 - y2))
            # print(ok(y1, y2, x1, x2, yd, yd2, xd, xd2, K))
            if ok(y1, y2, x1, x2, yd, yd2, xd, xd2, K):
                ans = min(ans, abs(x1 - x2) * abs(y1 - y2))

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def main():
    A, B, C = map(int, input().split())
    if A == B:
        print(C)
    elif A == C:
        print(B)
    elif B == C:
        print(A)



if __name__ == '__main__':
    main()
n = int(input())
x = list(map(int,input().split()))
mod=1e9+7
a = [-1]*(n+1)
def step(i):
    if i>=n-1:
        a[i]=0
        return x[-1]
    if(a[i]!=-1):return x[i]
    a[i] = min(abs(step(i+1)-x[i])%mod+a[i+1]%mod,abs(step(i+2)-x[i])%mod+a[i+2]%mod)%mod;
    return x[i]
c=step(0)
print(int(a[0]%mod))


### FIXED CODE ###

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

dp = [0, abs(h[1]-h[0])]
if n >2:
    for i in range(2,n):
        dp.append(min(abs(h[i]-h[i-2])+dp[-2], abs(h[i]-h[i-1])+dp[-1]))
else:
    print(dp[-1])
    exit()

print(dp[-1])
import math
a,b = map(int,input().split())

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

print(lcm(a,b))

### FIXED CODE ###

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

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

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

print(lcm(a,b))
N = int(input())
edges = [list(map(int,input().split())) for _ in range(N-1)]
A = [[]for _ in range(N+1)]
ans = [-1]*(N+1)
for u,v,w in edges:
    A[u].append([v,w])
    A[v].append([u,w])

ans[1] = 0
def dfs(r):
    for a in A[r].copy():
        n = a[0]
        d = a[1]
        if ans[n] == -1:
            ans[n] = (ans[r] + d) % 2
            dfs(n)
dfs(1)
for a in ans[1:]:
    print(a)


### FIXED CODE ###

import sys
sys.setrecursionlimit(500*500)
N = int(input())
edges = [list(map(int,input().split())) for _ in range(N-1)]
A = [[]for _ in range(N+1)]
ans = [-1]*(N+1)
for u,v,w in edges:
    A[u].append([v,w%2])
    A[v].append([u,w%2])

ans[1] = 0
def dfs(r):
    for a in A[r].copy():
        n = a[0]
        d = a[1]
        if ans[n] == -1:
            ans[n] = (ans[r] + d) % 2
            dfs(n)
dfs(1)
for a in ans[1:]:
    print(a%2)
def main()
    x, y =[int(i) for i in input().split()]

    while y != 0 :
        x, y = y, x%y
    print(x)

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

### FIXED CODE ###

def main() :
    x, y = [int(i) for i in input().split()]
    while y != 0 :
        x, y = y, x%y

    print(x)

if __name__ == '__main__':
    main()
s=input()
if s[:4]==2019 and s[5]==0 and s[6]<=4 or s[:4]<2019:
  print("Heisei")
else:
  print("TBD")

### FIXED CODE ###

s = input()
 
if s <= '2019/04/30':
    print('Heisei')
else:
    print('TBD')
import fractions

a, b = map(int, input().split())
print(a * b / gcd(a, b))


### FIXED CODE ###

import fractions
 
a, b = map(int, input().split())
print(a * b // fractions.gcd(a, b))
import numpy as np

N = int(input())
A = np.array([int(i) for i in input().split()])
A = A[A<=2*(10**5)]

H = [0]*(5*(10**5))
L = [0]*(5*(10**5))

for i in range(N):
    H[A[i]+i] += 1
    if i-A[i] >= 0:
        L[i-A[i]] += 1

ans = 0

for i in range(5*(10**5)):
    ans += H[i]*L[i]

print(ans)


### FIXED CODE ###

import numpy as np

N = int(input())
A = np.array([int(i) for i in input().split()])

H = [0]*(5*(10**5))
L = [0]*(5*(10**5))

for i in range(N):
    if A[i] <= 2*(10**5):
        H[A[i]+i] += 1
    if i-A[i] >= 0:
        L[i-A[i]] += 1

ans = 0

for i in range(5*(10**5)):
    ans += H[i]*L[i]

print(ans)
print('Possible' if (sum(list(map(int, input().split()))) % 3 == 0 else 'Impossible')

### FIXED CODE ###

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

if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
    print('Possible')
else:
    print('Impossible')
def gcd(a,b):
    if(b == 0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b):
    return (a*b)//gcd(a,b)
n = int(input())
mod = 1e9 + 7
a = [int(i) for i in input().split()]
ans = 1    
for i in a:
    ans = lcm(ans,i)

print("%d" %(sum(ans//i for i in a)%mod))


### FIXED CODE ###

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
n=int(input())
mod=1000000007
s=[int(i) for i in input().split()]
ans=1
for i in s:
    ans*=i//gcd(ans,i)
print(sum(ans//i for i in s)%mod)
from collections import deque


def main():
    N, M = list(map(int, input().split()))
    graphs = [[] for i in range(N)]
    for i in range(M):
        a, b = list(map(int, input().split()))
        graphs[a-1].append(b-1)
        graphs[b-1].append(a-1)

    INF = 100000000

    distance = [INF for i in range(N)]
    visited = [False] * N
    #    distance = [[None]*field_x_length]*field_y_length
    visited[0] = True
    distance[0] = 0

    def bfs():
        queue = deque([0])
        distance[0] = 0

        while queue:
            x = queue.popleft()
            for y in graphs[x]:
                if visited[y]:
                    continue
                else:
                    distance[y] = x
                    visited[y] = True
                    queue.append(y)
        return distance

    d = bfs()
    for i in range(N):
        if not visited[i]:
            print("No")
            exit()
    print("Yes")
    for i in range(1, N):
        print(d[i]+1)

if __name__ == "__main__":
    main()

### FIXED CODE ###

N = int(input())
import math
sin_dic = {}
mod = 1000000007

zero_num = 0
for i in range(N):
    a, b = list(map(int, input().split()))
    if a == 0 and b == 0:
        zero_num += 1
        continue
    if a == 0:
        b = -1
    elif b == 0:
        a = 1
    else:
        c = math.gcd(a, b)
        a, b = a//c, b//c
        if a < 0 and b < 0:
            a, b = -a, -b
        elif a < 0 and b > 0:
            a, b = -a, -b
    if (a,b) in sin_dic:
        sin_dic[(a, b)].append(i)
    else:
        sin_dic[(a, b)] = [i]

ans = 1
skip_dic = {}
for (key, _key) , values in sin_dic.items():
    if (key, _key) in skip_dic:
        continue
    oth_len = 0
    norm_len = 0
    norm_len += len(values)
    if (-key, -_key) in sin_dic:
        norm_len += len(sin_dic[(-key, -_key)])
    if (_key, -key) in sin_dic:
        oth_len += len(sin_dic[(_key, -key)])
    if (-_key, key) in sin_dic:
        oth_len += len(sin_dic[(-_key, key)])

    p = pow(2, oth_len, mod) - 1 + pow(2, norm_len, mod)
    ans = (ans * p) % mod
    skip_dic[(key, _key)] = True
    skip_dic[(-key, -_key)] = True
    skip_dic[(_key, -key)] = True
    skip_dic[(-_key, key)] = True
print((ans-1 + zero_num) % mod)
S= int(input())
W= int(input())
if(W>=S):
  print("unsafe")
else:
  print("safe")

### FIXED CODE ###

S,W =map(int,input().split())
if(W>=S):
  print("unsafe")
else:
  print("safe")
n = int(input())
cap_list = [int(input()) fot i in range(5)]
min_cap = min(cap_list)
c = (n + min_cap - 1) // min_cap
print(c + 4)


### FIXED CODE ###

n = int(input())
cap_list = [int(input()) for i in range(5)]
min_cap = min(cap_list)
c = (n + min_cap - 1) // min_cap
print(c + 4)
N = int(input())
ps = list(map(int, input().split()))
ans = 0
for i in range(N):
    if ps[i] == i+1:
        ps[i] = ps[i+1]
        ps[i+1] = i+1
        ans += 1
print(ans)

### FIXED CODE ###

N = int(input())
ps = list(map(int, input().split()))
state = 0
ans = 0
for i in range(N):
    if state:
        state = 0
        continue
    if ps[i] == i+1:
        ans += 1
        state = 1
print(ans)
n=input()
a=list(map(int,input().split()))
ans=0
for i in range(n):
  if a[a[i]-1]-1==i:
    ans+=1
print(ans//2)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  if a[a[i]-1]-1==i:
    ans+=1
print(ans//2)
MOD = 10**9+7
x, y = map(int, input().split())
if (x+y)%3 != 0 or 3*x < x+y or 3*y < x+y:
    print(0)
    exit()
n = (x+y)//3
x -= n
y -= n
fact = [0, 1]
for i in range(2,n+1):
    fact.append(fact[i-1] * i)
factX = fact[x]
factY = fact[y]
factN = fact[n]

inv_t = [0, 1]
for i in range(2,n+1):
    inv_t.append(inv_t[MOD % i] * (MOD - int(MOD / i)) % MOD)

c = factN * inv_t[factX] * inv_t[factY]
c %= MOD
print(c)



### FIXED CODE ###

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

MOD = 10**9+7
x, y = map(int, input().split())
if (x+y)%3 != 0 or 3*x < x+y or 3*y < x+y:
    print(0)
    exit()
n = (x+y)//3
x -= n
y -= n
fact = [1, 1]
for i in range(2,n+1):
    fact.append(fact[i-1] * i % MOD)
factX = fact[x]
factY = fact[y]
factN = fact[n]
# print(x,y,n)
# print(factX,factY,factN)

c = factN * modinv(factX, MOD) * modinv(factY, MOD)
c %= MOD
print(c)
s = input()
w = input().split()
for i in range(int(s)):
  sum += int(w[i])
average = sum / int(s)
for i in range(int(s)):
    if abs(int(w[i]) - average) < limit:
        limit = abs(int(w[i]) - average)
print(limit)


### FIXED CODE ###

# coding: utf-8
# Your code here!

s = input()
w = input().split()
sum = 0
for i in range(int(s)):
    sum += int(w[i])
average = sum / int(s)
limit = 100
index = 0
for i in range(int(s)):
    if abs(int(w[i]) - average) < limit:
        limit = abs(int(w[i]) - average)
        index = i
print(index)
import heapq
import sys
N,M=map(int,input().split())
A=sorted(list(map(int,input().split())))
lst=[[0,0] for _ in range(M)]
h=[]
for i in range(M):
  lst[i]=list(map(int,input().split()))
  heapq.heappush(h,[-1*lst[i][1],lst[i][0]])

tmp=0
while len(h)!=0:
  v=heapq.heappop(h)
  v1,v2=-1*v[0],v[1]
  if A[0]>v1:
    print(sum(A))
    sys.exit()
  else:
    while v2!=0 and A[0]<v1:
      A.pop(0)
      tmp+=v1
      v2-=1
    if v2>=1:
      print(sum(A)+tmp)
      sys.exit()
print(sum(A)+tmp)

### FIXED CODE ###

import heapq
import sys
N,M=map(int,input().split())
A=sorted(list(map(int,input().split())))
lst=[[0,0] for _ in range(M)]
h=[]
for i in range(M):
  lst[i]=list(map(int,input().split()))
  heapq.heappush(h,[-1*lst[i][1],lst[i][0]])
i=0
while len(h)!=0:
    v=heapq.heappop(h)
    v1,v2=-1*v[0],v[1]
    while i<=N-1 and A[i]<v1 and v2!=0:
        A[i]=v1
        i+=1
        v2-=1
    if v2>=1:
        print(sum(A))
        sys.exit()
print(sum(A))
N = input()
tmp = N[0]
for i in range(1,4):
    if tmp == N[i]:
        print("Bad")
        exit(1)
    tmp = N[i]
print("Good")

### FIXED CODE ###

def sec(N):
    tmp = N[0]
    for i in range(1, 4):
        if tmp == N[i]:
            print("Bad")
            return 0
        tmp = N[i]
    print("Good")


sec(input())
import math
a,b,x = list(map(int,input().split()))
if a*b*0.5*a > x:
    c = (2*x) / (a*b)
    ans = 90 - math.degrees(math.atan(c/b))
    print(ans)
else:
    c = (2*x) / a**2 - b
    ans = 90 - math.degrees(math.atan(a/(b-c)))
    print(ans)

### FIXED CODE ###

import math
a,b,x = list(map(int,input().split()))
if a*b*0.5*a > x:
    c = (2*x) / (a*b)
    ans = 90 - math.degrees(math.atan(c/b))
    print(ans)
else:
    c = (2*x) / a**2 - b
    if b-c == 0:
        ans = 0
    else:
        ans = 90 - math.degrees(math.atan(a/(b-c)))
    print(ans)
n = int(raw_input())
maxv = int(raw_input())
minv = int(raw_input())
maxv = -10**9

 for j in range(0,n-1):
   nums = int(raw_input())
   diff = nums - minv
   maxv = max(maxv,diff)
   minv = min(minv,nums)
 print maxv

### FIXED CODE ###

n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9
  
for j in range(n-1):
  nums = int(raw_input())  
  diff = nums - minv
  if maxv < diff:
    maxv = diff
  if nums < minv:
    minv = nums
  
print maxv
number = str(input())
list = list(map(int, input().split())
for i in list:
	if i%2==0:
		if i%3==0 or i%5==0:
            print("APPROVED")
        else:
            print("DENIED")

### FIXED CODE ###

number = input()
list1 = list(map(int, input().split()))
han = 0
count = 0
for i in range(0, len(list1)):
    if list1[i]%2 == 0:
        count += 1
        if list1[i]%3 == 0 or list1[i]%5 == 0:
            han += 1
if han == count:
    print("APPROVED")
else:
    print("DENIED")
import itertools as it  
n=input()
n=int(n)
if n>=1 and n<=9:
	li=[i for i in range(1,n+1)]
	li=li*3
	print(len(set(itertools.combinations(li,3))))
else:
  pass

### FIXED CODE ###

import itertools
n=input()
n=int(n)
if n>=1 and n<=9:
	li=[i for i in range(1,n+1)]
	li=li*3
	print(len(set(itertools.combinations(li,3))))
else:
  pass
import numpy as np
from sys import stdin
N,K=[int(x) for x in stdin.readline().rstrip().split()]
data=[]
for i in range(N):
    data.append(int(input()))
data.sort()
data.reverse()
ans=float("inf")
for i in range(N-K+1):
    tmp=data[i]-data[i+K-1]
    if ans > tmp:

### FIXED CODE ###

import numpy as np
from sys import stdin
N,K=[int(x) for x in stdin.readline().rstrip().split()]
data=[]
for i in range(N):
    data.append(int(input()))
data.sort()
data.reverse()
ans=float("inf")
for i in range(N-K+1):
    tmp=data[i]-data[i+K-1]
    if ans > tmp:
        ans=tmp
print(ans)
import sys
sys.setrecursionlimit(10000)
n,m=map(int,input().split())
bra=[set() for _ in range(m)]
for i in range(m):
    a,b=map(int,input().split())
    bra[a-1].add(b-1)
    bra[b-1].add(a-1)

visit=[1]+[0]*(n-1)
#print(bra)
cnt=[]
def dfs(a,visit):
    if visit==[1]*n:
        cnt.append(1)
        return 
    else:
        for e in bra[a]:
            if visit[e]==0:
                visit[e]=1
#                print(visit)
                dfs(e,visit)
                visit[e]=0   
dfs(0,visit)
print(len(cnt))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10000)
n,m=map(int,input().split())
bra=[set() for _ in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    bra[a-1].add(b-1)
    bra[b-1].add(a-1)

visit=[1]+[0]*(n-1)
#print(bra)
cnt=[]
def dfs(a,visit):
    if visit==[1]*n:
        cnt.append(1)
        return 
    for e in bra[a]:
        if visit[e]==0:
            visit[e]=1
#            print(visit)
            dfs(e,visit)
            visit[e]=0  
    return 
dfs(0,visit)
print(len(cnt))
N = int(input())
X = list(map(int, input().split()))

m = min(X)
M = max(X)

min_val = 100 * 100 * 100 * 100
for p in range(m, M+1):
    score = 0
    for x in X:
         score += (x-p)*(x-p)
    if score < min_val: min_val = score
print(min_val)


### FIXED CODE ###

N, R_disp = map(int, input().split())
print(R_disp + 100 * (10 - N) if N < 10 else R_disp)
import itertools

x = list(map(int, input().split()))
y = []

for i in range(x[2]):
    y.append(list(map(int, input().split())))

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

def get_score(arr: list):
    score = 0
    for yy in y:
        if arr[yy[1]] - arr[yy[0]] == yy[2]:
            score += yy[3]
    return score

scores = []
for t in itertools.combinations_with_replacement(range(1, 11), x[0]):
    isError = False
    for i in range(x[0] -1):
        if t[i] > t[i+1]:
            isError = True
    if isError == True:
        continue
    scores.append(get_score(t))

print(max(scores))

### FIXED CODE ###

a = int(input())
args = list(map(int, input().split()))

# main
result = "NG"
for i in range(args[0], args[1] + 1):
    if i % a == 0:
        result = "OK"

# /main

print(result)
import sys
n = int(input())
pret = 0
prex = 0
prey = 0
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - pret - abs(x - prex) - abs(y - prey)
        #print(t, x, y, tmp)
        if tmp >= 0 and tmp % 2 == 0:
            pret = t
            prex = x
            prey = y
        else:
            print('No')
            sys.exit()
print('Yes')

### FIXED CODE ###

n = int(input())
pret = 0
prex = 0
prey = 0
flag = True
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - pret - abs(x - prex) - abs(y - prey)
        #print(t, x, y, tmp)
        if tmp >= 0 and tmp % 2 == 0:
            pret = t
            prex = x
            prey = y
        else:
            flag = False
if flag:
    print('Yes')
else:
    print('No')
a,b=map(input().split())
a=int(a)
b=int(float(b)*100)
a,b=int(a),int(b)
print(int((a*b)//100))

### FIXED CODE ###

s=input()
a,b=s.split(' ')
a=int(a)
b=100*int(b[0])+int(b[2:])
s=a*b
print(int(s//100))
s=input()+"O"
tmp=""
ans=[]
for i in s:
  if i in ["A","T","G","C"]:
    tmp=tmp+i
  else:
    ans.append(tmp)
    tmp=""
res=0
for i in ans:
  if len(i)>len(res):
    res=len(i)
print(res)


### FIXED CODE ###

s=input()
n=len(s)
ans=0
for i in range(n):
  for j in range(i,n):
    if all(["ACGT".count(c) == 1 for c in s[i:j+1]]):
      ans=max(ans,j+1-i)
print(ans)
import math
n, m = map(int, input().split()) X=1
for i in range(1,32000):
	if m%i==0:
		if i*n<=m:
			X=max(X, i)
		if (m//i)*n<=m:
			X=max(X, m//i)
print(X)

### FIXED CODE ###

import math
n, m = map(int, input().split())
kotae=1

for i in range(1,int(math.sqrt(m))+1):
	if m%i==0:
		if i*n<=m:
			kotae=max(kotae, i)
		if (m//i)*n<=m:
			kotae=max(kotae, m//i)
print(kotae)
x=input().split()
a,b=int(x[0]),int(x[1])
print(a*b+" "+(a*2+b*2))

### FIXED CODE ###

x=input().split()
a=int(x[0])
b=int(x[1])
print(a*b,(a*2+b*2))
from collections import deque
import copy

H, W = map(int, input().split())
s=(0,0)
g=(H-1,W-1)
maze = [list(input()) for line in range(H)]
copied_maze = copy.deepcopy(maze)

def search(x, y):
  dq = deque()
  dq.append([x, y])
  copied_maze[x][y] = 0
  while len(dq) > 0:
    x,y = dq.popleft()
    if x==g[0] and y==g[1]:
      break
    for dx, dy in [[1,0], [0,1], [-1,0], [0,-1]]:
      nx,ny=[x+dx,y+dy]
      if 0 <= nx < H and 0 <= ny < W and copied_maze[nx][ny] != '#' and type(copied_maze[nx][ny]) is str:
        dq.append([nx,ny])
        copied_maze[nx][ny] = copied_maze[x][y]+1
search(s[0],s[1])
x,y=g
cost = copied_maze[g[0]][g[1]]
path = {s, g}
for i in range(copied_maze[g[0]][g[1]]):
  for dx, dy in [[1,0], [0,1], [-1,0], [0,-1]]:
    nx,ny=[x+dx,y+dy]
    if 0 <= nx < H and 0 <= ny < W and copied_maze[nx][ny] == cost - 1:
      path.add((nx,ny))
      x,y=nx,ny
      cost -= 1
      break
count = 0
for i in range(H):
  for j in range(W):
    if maze[i][j] == '.' and (i, j) not in path:
      count += 1
print(count)

### FIXED CODE ###

from collections import deque
import copy

H, W = map(int, input().split())
s=(0,0)
g=(H-1,W-1)
maze = [list(input()) for line in range(H)]
copied_maze = copy.deepcopy(maze)

def search(x, y):
  dq = deque()
  dq.append([x, y])
  copied_maze[x][y] = 0
  while len(dq) > 0:
    x,y = dq.popleft()
    if x==g[0] and y==g[1]:
      break
    for dx, dy in [[1,0], [0,1], [-1,0], [0,-1]]:
      nx,ny=[x+dx,y+dy]
      if 0 <= nx < H and 0 <= ny < W and copied_maze[nx][ny] != '#' and type(copied_maze[nx][ny]) is str:
        dq.append([nx,ny])
        copied_maze[nx][ny] = copied_maze[x][y]+1
search(s[0],s[1])
x,y=g
cost = copied_maze[g[0]][g[1]]
if type(cost) is str:
  print(-1)
  exit()
path = {s, g}
for i in range(copied_maze[g[0]][g[1]]):
  for dx, dy in [[1,0], [0,1], [-1,0], [0,-1]]:
    nx,ny=[x+dx,y+dy]
    if 0 <= nx < H and 0 <= ny < W and copied_maze[nx][ny] == cost - 1:
      path.add((nx,ny))
      x,y=nx,ny
      cost -= 1
      break
count = 0
for i in range(H):
  for j in range(W):
    if maze[i][j] == '.' and (i, j) not in path:
      count += 1
print(count)
n,k = map(int,input().split())
a = list(map(int,input().split()))

r=[]
h=-1
i=0
while i+1 not in r:
    r.append(i+1)
    i = a[i]-1
    h += 1
    if k == h:
        print(i+1)
        sys.exit()
r.append(i+1)

p = r.index(r[len(r)-1])
q = len(r)-1-r.index(r[len(r)-1])
r_q = r[p:p+q]


if k+1<p:
    print(r[k])
else:
    j = (k+1-p)%q
    print(r_q[j-1])

### FIXED CODE ###

s = input()
t = input()

if t.startswith(s):
    print("Yes")
else:
    print("No")
##======================================python3
import sys
import collections
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

class Run:
    def build(gv):
        gv.s = input()
    
    def string_reverse_chk(gv, s:str):
        rev_s :_= ''.join(reversed(s))
        if s == rev_s:
            return True
        return False
    
    def solve(gv):
        pass
        
if __name__ == '__main__':
    run = Run()
    run.build()
    run.solve()



### FIXED CODE ###

##======================================python3
import sys
import collections
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

class Run:
    def build(gv):
        gv.s = input().strip()
    
    def string_reverse_chk(gv, s:str):
        rev_s = "".join(list(reversed(s))[0:len(s)])
        if s == rev_s:
            return True
        return False
    
    def solve(gv):
        
        ans = "No"
        
        while True:
            slen = len(gv.s)
            reversed_s = "".join(list(reversed(gv.s))[0:slen])
            
            if gv.string_reverse_chk(gv.s) is False : break
            if gv.string_reverse_chk(gv.s[0:int((slen -1)/2)]) is False : break
            if gv.string_reverse_chk(reversed_s[0:int((slen -1)/2)]) is False : break
            
            if gv.string_reverse_chk(gv.s[int((slen +3)/2 -1):slen]) is False : break
            if gv.string_reverse_chk(reversed_s[int((slen +3)/2 -1):slen]) is False : break
            
            
            ans = "Yes"
            break
        
        print(ans)
        
if __name__ == '__main__':
    run = Run()
    run.build()
    run.solve()