Harryxun/stf_run huggingface dataset:
from collections import deque

H, W = map(int, input().split())
S = [input() for _ in range(H)]

table = [[None] * W for _ in range(H)]
table[0][0] = (0 if S[0][0] == '.' else 1)

D = deque([(0, 0)])
new_D = deque()
while D:
    h, w = D.popleft()
    for dh, dw in ((1, 0), (0, 1)):
        if 0 <= h + dh < H and 0 <= w + dw < W and table[h + dh][w + dw] is None:
            if S[h + dh][w + dw] == S[h][w]:
                D.append((h + dh, w + dw))
                table[h + dh][w + dw] = table[h][w]
            else:
                new_D.append((h + dh, w + dw))
                table[h + dh][w + dw] = table[h][w] + 1
    if not D:
        D = new_D.copy()
        new_D.clear()

print((table[H - 1][W - 1] + 1) // 2)


### FIXED CODE ###

from copy import deepcopy
from collections import deque

H, W = map(int, input().split())
S = [input() for _ in range(H)]

table = [[None] * W for _ in range(H)]
table[0][0] = (0 if S[0][0] == '.' else 1)

D = deque([(0, 0)])
new_D = deque()
while D:
    h, w = D.popleft()
    for dh, dw in ((1, 0), (0, 1)):
        if 0 <= h + dh < H and 0 <= w + dw < W and table[h + dh][w + dw] is None:
            if S[h + dh][w + dw] == S[h][w]:
                D.append((h + dh, w + dw))
                table[h + dh][w + dw] = table[h][w]
            else:
                new_D.append((h + dh, w + dw))
                table[h + dh][w + dw] = table[h][w] + 1
    if not D:
        D = deepcopy(new_D)
        new_D.clear()

print((table[H - 1][W - 1] + 1) // 2)
n = int(input())

ans = 0
if n%2 = 0:
    ans = (n//2)*(n-1)
else:
    ans = ((n-1)//2)*n
print(ans)

### FIXED CODE ###

n = int(input())

ans = 0
if n%2 == 0:
    ans = (n//2)*(n-1)
else:
    ans = ((n-1)//2)*n
print(ans)
n,w=map(int,input().split())
wv=[list(map(int,input().split())) for i in range(n)]
s=0
for i in range(n):
    s+=wv[i][1]
x=[0]*(w+1)
for i in range(n):
    x_sub=[0]*(w+1)
    if wv[i][0]<w+1:
        x_sub[wv[i][0]]=wv[i][1]
    for j in range(1,w+1):
        if x[j]!=0 and j+wv[i][0]<w+1:
            x_sub[j+wv[i][0]]=x[j]+wv[i][1]
    for j in range(1,w+1):
        x[j]=max(x_sub[j],x[j])
print(max(x))


### FIXED CODE ###

n,w=map(int,input().split())
wv=[list(map(int,input().split())) for i in range(n)]
wv.sort(key=lambda x:-x[1])
wv.sort(key=lambda x:x[0])
#print(wv)
w0=wv[0][0]
x=[[0],[0],[0],[0]]
for i in range(n):
    if wv[i][0]==w0:
        k=wv[i][1]+x[0][-1]
        l=len(x[0])
        if l*w0<=w:x[0].append(k)
    elif wv[i][0]==w0+1:
        k=wv[i][1]+x[1][-1]
        l=len(x[1])
        if l*(w0+1)<=w:x[1].append(k)
    elif wv[i][0]==w0+2:
        k=wv[i][1]+x[2][-1]
        l=len(x[2])
        if l*(w0+2)<=w:x[2].append(k)
    else:
        k=wv[i][1]+x[3][-1]
        l=len(x[3])
        if l*(w0+3)<=w:x[3].append(k)
#print(x)
ma=0
for i in range(len(x[0])):
    for j in range(len(x[1])):
        for k in range(len(x[2])):
            for l in range(len(x[3])):
                ma_sub=0
                if i*w0+j*(w0+1)+k*(w0+2)+l*(w0+3)<=w:
                    ma_sub+=x[0][i]
                    ma_sub+=x[1][j]
                    ma_sub+=x[2][k]
                    ma_sub+=x[3][l]
                ma=max(ma,ma_sub)
print(ma)
N = int(input())
N = list(range(1,N+1))
A = list(map(int, input().split())

for k in range(1, N+1):
         A = A.remove(A[k])
         ans = 0
         for i in range(1,N+1):
         	n = sum(A[j] == i for j in range(1,N))
         	nc2 = n * (n-1) / 2
         	ans += nc2
         
         print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(max(a)+1)]
for x in a:
    b[x] += 1
c = sum([x*(x-1)//2 for x in b])
for i in range(n):
    print(c-b[a[i]]+1)
S = list(input())

str = ["k","e","y","e","n","c","e"]
false = 0
split = 0

for i in S :
    if i==str[0]:
        str.pop(0)
        if false > 0 :
            split += 1
            false = 0
    else:
        false += 1

if len(str)==0:
    if split <=1 :
        print("YES") 
    else :
        print("NO")
else :
    print("NO")

### FIXED CODE ###

s=input()
n = len(s)

for i in range(n): #文字列の長さ分繰り返す
    for j in range(i,n): #
        tmp = s[:i]+s[j:]
        if tmp == "keyence":
            print("YES")
            quit()

print("NO")
a, b, c= map(int, input().split())
if b <= c:
  print("delicious")
elif c-b<= x:
  print("safe")
else:
  print("dengerous")

### FIXED CODE ###

a, b, c= map(int, input().split())
if b >= c:
  print("delicious")
elif c-b<=a:
  print("safe")
else:
  print("dangerous")
n,x,t = map(int,input().split())
if n%x==0:
    print(int(n/x)*t)
else:
    print(int(n//x)+1)*t)

### FIXED CODE ###

n,x,t = map(int,input().split())
if n%x==0:
    print(int(n/x)*t)
else:
    print((int(n//x)+1)*t)
# -*- coding: utf-8 -*-

import math

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

d=math.gcd(a,b)

if c%d==0:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

# -*- coding: utf-8 -*-

import fractions

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

d=fractions.gcd(a,b)

if c%d==0:
    print('YES')
else:
    print('NO')
from math import gcd
from functools import reduce


def _gcd(*n):
    return reduce(gcd, n)


N, X = map(int, input().split())
x = list(map(int, input().split()))
x = sorted(x + [X])
diff = [x[i+1] - x[i] for i in range(N)]
print(_gcd(*diff))


### FIXED CODE ###

from functools import reduce


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


def _gcd(*n):
    return reduce(gcd, n)


N, X = map(int, input().split())
x = list(map(int, input().split()))
x = sorted(x + [X])
diff = [x[i+1] - x[i] for i in range(N)]
print(_gcd(*diff))
# -*- coding: utf-8 -*-
s = input()

while len(s):
    if s[-5:] == 'deram' or s[-5:] == 'erase:
        s = s[:-5]
        continue
    elif s[-6:] == 'eraser':
        s = s[:-6]
        continue
    elif s[-7:] == 'dreamer':
        s = s[:-7]
        continue
    else:
        break
    
if len(s) == 0:
    print('YES')
else:
    print('NO')



### FIXED CODE ###

s = input()

while len(s) > 4:
    if s[-5:] == 'dream' or s[-5:] == 'erase':
        s = s[:-5]
        continue
    elif s[-6:] == 'eraser':
        s = s[:-6]
        continue
    elif s[-7:] == 'dreamer':
        s = s[:-7]
        continue
    else:
        break
        
if len(s) == 0:
    print('YES')
else:
    print('NO')
n, x = map(int, input().split())
print(n*800-n//15*200)

### FIXED CODE ###

n = int(input())
print(n*800-n//15*200)
s=input();print(int(s[:2])+int(s[2:])//2)

### FIXED CODE ###

a,b=map(int,input().split());print(a+b//2)
N, Q = map(int, input().split())
s1 = input()
ls = []
rs = []
for _ in range(Q):
    l, r = map(int, input().split())
    ls.append(l)
    rs.append(r)

lr = []
for i in range(Q):
    lr.append([ls[i], rs[i], i])
    
lr_sort = sorted(lr, key=lambda x: x[1]-x[0], reverse=True)
for i in range(len(lr_sort)):
    l, r = lr_sort[i][0], lr_sort[i][1]
    #print(l, r)
    if i == 0:
        s2 = s1[l-1:r]
        flag = 0
        for j in range(len(s2)-1):
            if s2[j]=='A' and s2[j+1]=='C':
                flag += 1
        lr_sort[i].append(flag)
    else:
        l_p, r_p = lr_sort[i-1][0], lr_sort[i-1][1]
        #print(l_p, r_p)
        
        for j in range(min(l,l_p), max(l,l_p)):
            if s2[j]=='A' and s2[j+1]=='C':
                flag -= 1
        for j in range(min(r,r_p), max(r,r_p)):
            if s2[j]=='A' and s2[j+1]=='C':
                flag -= 1
        lr_sort[i].append(flag)
lr_sort2 = sorted(lr_sort, key=lambda x: x[2])
for ans in lr_sort2:
    print(ans[3])

### FIXED CODE ###

N, Q = map(int, input().split())
s1 = input()
t = [0 for _ in range(N+1)]
for i in range(N):
    t[i+1] = t[i] + (1 if s1[i:i+2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])
a, b, c, d = map(int, input().split())

while:
  c = c - b
  if c <= 0:
    print("Yes")
    break
  a = a - d
  if a <= 0:
    print("No")
    break

### FIXED CODE ###

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

while True:
  c = c - b
  if c <= 0:
    print("Yes")
    break
  a = a - d
  if a <= 0:
    print("No")
    break
a = int(input())
b = int(input())
if a < b:
 print("a < b")
elif a > b:
 print("a > b")
else:
 print("a == b")

### FIXED CODE ###

a, b = map(int, input().split())
if a < b:
 print("a < b")
elif a > b:
 print("a > b")
else:
 print("a == b")
a=10**9+7
n,k=map(int,input().split())
from math import factorial 
def c(t, r):
    return factorial(t)//(factorial(t-r)*factorial(r))

for _ in range(1,k+1):
  print((c(n-k+1,_)%a*c(k-1,_-1)%a))

### FIXED CODE ###

mod=10**9+7
n,k=map(int,input().split())

from scipy.misc import comb

for i in range(1,k+1):
  print(comb(n-k+1,i,exact=True)*comb(k-1,i-1,exact=True)%mod)
import copy,bisect

s=input()
N=len(s)
t=input()
M=len(t)

dp=[[0 for i in range(0,M)] for i in range(0,N)]

for i in range(0,N):
    if s[0:i+1].count(t[0])>0:
        dp[i][0]=1

for i in range(0,M):
    if t[0:i+1].count(s[0])>0:
        dp[0][i]=1

for i in range(1,N):
    for j in range(1,M):
        if s[i]==t[j]:
            dp[i][j]=dp[i-1][j-1]+1
        else:
            if len(dp[i][j-1])>len(dp[i-1][j]):
                dp[i][j]=dp[i][j-1]
            else:
                dp[i][j]=dp[i-1][j]

print(dp[N-1][M-1])


### FIXED CODE ###

s=input()
N=len(s)
t=input()
M=len(t)

alphabetlist=['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']
def al(str):
    return alphabetlist.index(str)+1

dp=[[0 for i in range(0,M+1)] for i in range(0,N+1)]

for i in range(0,N):
    for j in range(0,M):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            if dp[i+1][j]>dp[i][j+1]:
                dp[i+1][j+1]=dp[i+1][j]
            else:
                dp[i+1][j+1]=dp[i][j+1]

ans=[]
i=N
j=M
while i>0 and j>0:
    if dp[i][j]==dp[i-1][j]:
        i-=1
    elif dp[i][j]==dp[i][j-1]:
        j-=1
    else:
        ans.append(s[i-1])
        i-=1
        j-=1

ans=ans[::-1]
print(''.join(ans))
from sys import stdin

N, M, *A = map(int, stdin.read().split())
req = {1: 2,
       2: 5,
       3: 5,
       4: 4,
       5: 5,
       6: 6,
       7: 3,
       8: 7,
       9: 6}

B = sorted([(a, req[a]) for a in A], key=lambda x: x[0], reverse=True)
a_min, n_min = min(B, key=lambda x: x[1])
g = [(a, n-n_min) for a, n in B if a > a_min and n > n_min]
l = [(a, n-n_min) for a, n in B if a < a_min and n > n_min]
l.sort(key=lambda x: x[1], reverse=True)

def dp(rem, C):
    ret = None
    if rem == 0:
        ret = []
    elif rem > 0:
        for a, m in C:
            nxt = dp(rem-m, C)
            if nxt is not None:
                ret = [a] + nxt
                break
    return ret


lst = dp(N % n_min, g + l)
lst = sorted(lst + [a_min] * (N//n_min - len(lst)), reverse=True)
print(''.join(map(str, lst)))

### FIXED CODE ###

from sys import stdin

N, M, *A = map(int, stdin.read().split())
req = {1: 2,
       2: 5,
       3: 5,
       4: 4,
       5: 5,
       6: 6,
       7: 3,
       8: 7,
       9: 6}

B = sorted([(a, req[a]) for a in A], key=lambda x: x[0], reverse=True)
a_min, n_min = min(B, key=lambda x: x[1])
g = [(a, n-n_min) for a, n in B if a > a_min and n > n_min]
l = [(a, n-n_min) for a, n in B if a < a_min and n > n_min]
l.sort(key=lambda x: x[1], reverse=True)
C = g + l

def dp(rem, C):
    ret = None
    if rem == 0:
        ret = []
    elif rem > 0:
        for i in range(len(C)):
            a, m = C[i]
            nxt = dp(rem-m, C[i:])
            if nxt is not None:
                ret = [a] + nxt
                break
    return ret


i = 0
while True:
    quo = N // n_min - i
    rem = N % n_min + i * n_min
    lst = dp(rem, C)
    if lst is not None:
        lst = sorted(lst + [a_min] * (quo-len(lst)), reverse=True)
        print(''.join(map(str, lst)))
        break
    i += 1
n, m = input().split()

if n = m:
  return 'Yes'
else:
  return 'No'

### FIXED CODE ###

n, m = input().split()

if n == m:
  print('Yes')
else:
  print('No')
n, k = list(map(int, input().split()))
d = []
for _ in range(k):
  x = int(input())
  y = int(map(int, input().split()))
  for i in y:
    d.append(i)

d = set(d)
d = list(d)
print(n - len(d))
  

### FIXED CODE ###

n, k = list(map(int, input().split()))
d = []
for _ in range(k):
    x = int(input())
    y = list(map(int, input().split()))
    for i in y:
        d.append(i)

d = set(d)
d = list(d)
print(n - len(d))
n,m = map(int,input().split())

par = [[] for i in range(n)]
op = [[]for i in range(n)]
for i in range(n+m-1):
    x,y = map(int,input().split())
    x-=1
    y-=1
    par[y].append(x)
    op[x].append(y)

res = [-1]*n
x = -1


for i in range(n):
    if len(par[i])==0:
        res[i] = 0
        x = i
        break


used = [0]*n
used[x]=1

#不使用の親がいるか
def g(y):
    for pe in par[y]:
        if used[pe]==0:
            return False
    return True
    
#xの下のusedとresを埋める
def f(z):
    for e in op[z]:
        if used[e]==0:
            if g(e):
                used[e]=1
                res[e]=z+1
                f(e)

f(x)

for i in range(n):
    print(res[i])


### FIXED CODE ###

from collections import deque

n,m = map(int,input().split())

up = [[] for i in range(n)]
down= [[]for i in range(n)]
for i in range(n+m-1):
    a,b = map(int,input().split())
    a -=1
    b -=1
    up[b].append(a)
    down[a].append(b)

res = [-1]*n
root = -1

for i in range(n):
    if len(up[i])==0:
        res[i] = 0
        root = i
        break

#0なら不使用
used = [0]*n
used[root]=1

#yの親に不使用が一つも存在しなければTrue
def g(y):
    for pe in up[y]:
        if used[pe]==0:
            return False
    return True
    
#zの下のusedとresを埋める
def f(z):
    for e in down[z]:
        if used[e]==0 and g(e):
            res[e]=z+1
            tank2.append(e)
            usedtank.append(e)
c = 1
tank = deque([root])
tank2 = deque([root])
usedtank = []
while c != n:
    tank = tank2
    tank2 = deque([])
    usedtank = []
    while len(tank)!=0:
        f(tank.popleft())
    for usede in usedtank:
        used[usede]=1
    c += len(tank2)
    
for i in range(n):
    print(res[i])
def main():
  from collections import Counter
  from sys import stdin
  readline = stdin.readline()
  N = int(readline())
  t = Counter([''.join(sorted(readline()[:-1])) for _ in range(N)])
  print(sum(t[k] * (t[k] - 1) // 2 for k in t))
main()


### FIXED CODE ###

n = int(input())
s = [input() for _ in range(n)]
for i in range(n):
  s[i] = ''.join(sorted(s[i]))
t = {}
for i in range(n):
  if s[i] in t:
    t[s[i]] += 1
  else:
    t[s[i]] = 1
print(sum(t[k] * (t[k] -1) // 2 for k in t))
n = int(input())
print(len(set(map(int,[input() for i in range(n)])))

### FIXED CODE ###

n = int(input())
print(len(set(map(int,[input() for i in range(n)]))))
import math
a = int(input())
b = int(input())
x = (a + b)/2
print(math.ceil(x))

### FIXED CODE ###

import math
a, b = map(int, input().split())
x = (a + b)/2
print(math.ceil(x))
N, X = map(int, input().split())
L = list(map(int, input().split()))
c = 0
for i in L:
  if L <= X:
    c = c + 1
  elif L > X:
    print(c)
    

### FIXED CODE ###

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

cnt = 1
D = 0
for i in L:
    D += i
    if D > X:
        break
    else:
        cnt += 1
print(cnt)
s, w = map(int, input().strip())
if s > w:
  print("safe")
else:
  print("unsafe")
        


### FIXED CODE ###

s, w = map(int, input().split())
if s > w:
  print("safe")
else:
  print("unsafe")
a,b=map(int,input().split())
print(a*b (a+b)*2)


### FIXED CODE ###

a,b=map(int,input().split())
print(a*b,(a+b)*2)
MOD=10**9+7
import bisect
N,K=[int(s) for s in input().split()]
ls=[int(s) for s in input().split()]
ans=set()
if 0 in ls:
  ans.add(0)

als=sorted(ls, key=lambda x: -abs(x))
mul=1
for i in range(K):
  mul*=als[i]
if mul>0:
  print(mul%MOD)
else:
  ls2=als[:K]
  ls3=als[K:]
  M2=max(ls2)
  m2=min(ls2)
  M3=max(ls3)
  m3=max(ls3)
  ans=set()
  ans.add(mul*m3//M2)
  ans.add(mul*m3//m2)
  ans.add(mul*M3//M2)
  ans.add(mul*M3//m2)
  print(max(ans)%MOD)


### FIXED CODE ###

MOD=10**9+7
N,K=[int(s) for s in input().split()]
ls=[int(s) for s in input().split()]
ans=set()
ls=sorted(ls, key=lambda x: -abs(x))
mul=1
sign=0
zeroflag=0
flag=[0 for _ in range(N)]
for i in range(K):
  flag[i]=1
  if ls[i]<0:
    sign=(sign+1)%2
if sign==1:
  if 0 in ls:
    zeroflag=1
  a=[0,0,0,0]
  b=[0,0,0,0]
  for j in range(K,N):
    if ls[j]>0:
      for k in range(K):
        if ls[K-1-k]<0:
          a[0]=ls[j]
          b[0]=j
          a[1]=ls[K-1-k]
          b[1]=K-1-k
          break
      break
  for j in range(K,N):
    if ls[j]<0:
      for k in range(K):
        if ls[K-1-k]>0:
          a[2]=ls[j]
          b[2]=j
          a[3]=ls[K-1-k]
          b[3]=K-1-k
          break
      break
  if a==[0,0,0,0]:
    flag.reverse()
  elif b[0]==0 and b[1]==0:
    flag[b[2]]=1
    flag[b[3]]=0
  elif b[2]==0 and b[3]==0:
    flag[b[0]]=1
    flag[b[1]]=0
  elif abs(a[0]*a[3])>abs(a[1]*a[2]):
    flag[b[0]]=1
    flag[b[1]]=0
  else:
    flag[b[2]]=1
    flag[b[3]]=0
if sign==1 and a==[0,0,0,0] and zeroflag==1:
  print(0)
else:
  mul=1
  for i in range(N):
    if flag[i]==1:
      mul=mul*ls[i]%MOD
  print(mul)
class BigCombination(object):
    __slots__ = ["mod", "factorial", "inverse"]

    def __init__(self, mod: int = 10**9+7, max_n: int = 10**6):
        fac, inv = [1], []
        fac_append, inv_append = fac.append, inv.append

        for i in range(1, max_n+1):
            fac_append(fac[-1] * i % mod)

        inv_append(pow(fac[-1], mod-2, mod))

        for i in range(max_n, 0, -1):
            inv_append(inv[-1] * i % mod)

        self.mod, self.factorial, self.inverse = mod, fac, inv[::-1]

    def get_combination(self, n, r):
        return self.factorial[n] * self.inverse[r] * self.inverse[n-r] % self.mod

    def get_permutation(self, n, r):
        return self.factorial[n] * self.inverse[n-r] % self.mod
import math
Big = BigCombination()
n,k = map(int,input().split())
s = 0
for i in range(k):
    if N - K + 1 < i + 1:
      	print('0')
      	continue
	print((Big.get_combination(n-k+1,i+1) *Big.get_combination(k-1,i))%(10**9+7))



### FIXED CODE ###

class BigCombination(object):
    __slots__ = ["mod", "factorial", "inverse"]

    def __init__(self, mod: int = 10**9+7, max_n: int = 10**6):
        fac, inv = [1], []
        fac_append, inv_append = fac.append, inv.append

        for i in range(1, max_n+1):
            fac_append(fac[-1] * i % mod)

        inv_append(pow(fac[-1], mod-2, mod))

        for i in range(max_n, 0, -1):
            inv_append(inv[-1] * i % mod)

        self.mod, self.factorial, self.inverse = mod, fac, inv[::-1]

    def get_combination(self, n, r):
        return self.factorial[n] * self.inverse[r] * self.inverse[n-r] % self.mod

    def get_permutation(self, n, r):
        return self.factorial[n] * self.inverse[n-r] % self.mod
import math
Big = BigCombination()
n,k = map(int,input().split())
s = 0
for i in range(k):
    if n - k + 1 < i + 1:
      	print('0')
      	continue
    print((Big.get_combination(n-k+1,i+1) *Big.get_combination(k-1,i))%(10**9+7))
N = int(input())
A = input().split()
B = input().split()

L = {}
for i in range(len(A)):
    for j in range(len(B)):
        c = int(A[i]) + int(B[j])
        if c in L:
            del L[c] 
        else:
            L[c] = c
a = 0
for i in L.values():
    a = a ^ i
print(a)

### FIXED CODE ###

S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
a = 'No'
if C <= A + B:
    a = 'Yes'
print(a)
a=int(input)
print(a+a**2+a**3)

### FIXED CODE ###

a=int(input())
print(a+a**2+a**3)
s=list(input())
D=[s[0]]
i=0
while i < len(s) - 1:
  if s[i+1] == D[-1]:
    D.append(s[i+1]+s[i+2])
    i+=2
  else:
    D.append(s[i + 1])
    i+=1

print(len(D)-(1 if i == len(s) else 0))

### FIXED CODE ###

s=list(input())
D=[s[0]]
i=0
while i < len(s) - 1:
  if s[i+1] == D[-1]:
    D.append(s[i+1:i+3])
    i+=2
  else:
    D.append(s[i + 1])
    i+=1

print(len(D)-(1 if i == len(s) else 0))
import sys
N = int(input())
S = list(map(str,input().split()))
if N % 2 == 0:
	T_1 = S[:int(len(S)/2)]
	T_2 = S[int(len(S)/2):]
	for i in range(len(T_1)):
		if T_1[i] != T_2[i]:
	 		print("No")
	 		sys.exit()
		
	 print("Yes")
	 sys.exit()
else:
	print("No")

### FIXED CODE ###

import sys
N = int(input())
# S = list(map(str,input().split()))
S = list(input())
if N % 2 == 0:
	T_1 = S[:int(len(S)/2)]
	T_2 = S[int(len(S)/2):]
	# print(T_1)
	# print(T_2)
	for i in range(len(T_1)):
		if T_1[i] != T_2[i]:
			print("No")
			sys.exit()	
	print("Yes")
	sys.exit()
else:
	print("No")
import bisect
N = int(input())
A = list(map(int, input().split()))
A.sort()
x = [0]*(N-1)
y = [0]*(N-1)
start_bool = 1 if N % 2 == 0 else -1
for i in range(N-1):
    print(A)
    l = A.pop(0)
    r = A.pop(-1)
    if start_bool < 0:
        if l > r:
            ret = r - l
            x[i] = r
            y[i] = l
        else:
            ret = l - r
            x[i] = l
            y[i] = r
    else:
        if l > r:
            ret = l - r
            x[i] = l
            y[i] = r
        else:
            ret = r - l
            x[i] = r
            y[i] = l
    if ret > 0:
        bisect.insort(A, ret)
    else:
        bisect.insort(A, ret)
    start_bool *= -1
print(A[0])
for i in range(N-1):
    print(x[i], y[i])

### FIXED CODE ###

from collections import deque
N = int(input())
A = list(map(int, input().split()))
plus = 0
minus = 0
for i in range(N):
    if A[i] >= 0:
        plus += 1
    else:
        minus += 1
bb = deque(sorted(A))
x = [0]*(N-1)
y = [0]*(N-1)
for i in range(N-1):
    if len(bb) == 2:
        l = bb.popleft()
        r = bb.pop()
        if l > r:
            ret = l-r
            x[i] = l
            y[i] = r
        else:
            ret = r - l
            x[i] = r
            y[i] = l
    else:
        l = bb.popleft()
        r = bb.pop()

        if plus > minus:
            ret = l - r
            x[i] = l
            y[i] = r
            plus -= 1
        else:
            ret = r - l
            x[i] = r
            y[i] = l
            minus -= 1
    if ret > 0:
        bb.append(ret)
    else:
        bb.appendleft(ret)
print(bb.pop())
for i in range(N-1):
    print(x[i], y[i])
n,k=map(int, input().split())
xlist=list(map(int, input().split()))
num0=0
nump=0
numm=0
for i in xlist:
  if i>0:
    nump+=1
  elif i<0:
    numm+=1
  else:
    num0+=1
listp=[0]*(nump+1)
listm=[0]*(numm+1)
for i in range(1,nump+1):
  listp[i]=xlist[numm+num0+i-1]
for i in range(1,numm+1):
  listm[i]=-xlist[numm-i]
cnt=k-num0
ans=10**30
for i in range(cnt):
  if i<=numm and cnt-i<=nump:
    ans=min(ans,listm[i]+listp[cnt-i]+min(listm[i],listp[cnt-i]))
if numm==0:
  ans=listp[cnt+1]
if nump==0:
  ans=listm[cnt+1]
print(ans)

### FIXED CODE ###

n,k=map(int, input().split())
xlist=list(map(int, input().split()))
ans=10**20
for i in range(n-k+1):
  ans=min(abs(xlist[i]-xlist[i+k-1])+min(abs(xlist[i]),abs(xlist[i+k-1])),ans)
print(ans)
from itertools import accumulate
n, k = map(int, input().split())
l = list(map(int, input().split()))
l = list(map(lambda x: (((x + 1) * x) / 2) / x, l))
s = list(accumulate(l))
l_2 = [s[k - 1]]
for i in range(len(l) - (k - 1) - 1):
    l_2 += [s[i + k] - s[i]]
print(max(l_2)

### FIXED CODE ###

from itertools import accumulate
n,k=map(int, input().split())
A=[((int(i)*(int(i)+1))/2)/int(i) for i in input().split()]
al = list(accumulate(A))
ans = al[k-1]
for i in range(k, n):ans=max(ans, al[i]-al[i-k])
print(ans)
a,b = map(int,input().split())

if (a > 8 or b>8):
    print(":(")
else
    print("Yay!")

### FIXED CODE ###

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

if (a > 8 or b>8):
    print(":(")
else:
    print("Yay!")
n=int(input())
s=list(input())
a=""
for c in s:
  a+=chr((ord(c)-ord(a)+n)%26+ord(a))
print(a)
  

### FIXED CODE ###

n=int(input())
s=list(input())
a=""
for c in s:
  a+=chr((ord(c)-ord("A")+n)%26+ord("A"))
print(a)