Harryxun/stf_run huggingface dataset:
s=list(input())
#s=['a','b','a','d','a','b','a']
L=int((len(s)-1)/2)
f1=0
for i in range(L-1):
    if s[0+i]==s[len(s)-i]:
    else:
        f1+=1
        
LL=L//2
f2=0
if f1==0:
    for j in range(LL-1):
        if s[0+j]==s[len(L)-i]:
    else:
        f2+=1

if f1==0&f2==0:
    print('Yes')
else:
    print('No')
    

### FIXED CODE ###

s=list(input())
#s=['l','e','l','v','l','e','l']
L=int((len(s)-1)/2)
f1=0
for i in range(L):
 #   print(s[0+i])
  #  print(s[len(s)-i-1])
    if s[0+i]==s[len(s)-i-1]:
        pass
   #     print('here1')
    else:
        f1+=1
    #    print('here2')

#print(f1)
LL=L//2
f2=0
if f1==0:
    for j in range(LL):
     #   print(s[0+j])
      #  print(s[L-j-1])
        if s[0+j]==s[L-j-1]:
            pass
 #           print('here3')
        else:
            f2+=1
  #          print('here4')
else:
    f2=1

#print(f1)
#print(f2)
if f1==0 and f2==0:
    print('Yes')
else:
    print('No')
from collections import deque
N, M = map(int, input().split())
X = deque(map(int, input().split()))
if N >= M:
	print(0)
else:
	X.sort()
	x = 0
	y = deque([0] * (N - 1))
	for i in range(M - 1):
		a = X[i+1] - X[i]
		b = min(y)
		if a > b:
			y.remove(b)
			y.append(a)
			x += b
		else:
			x += a
	print(x)

### FIXED CODE ###

N, M = map(int, input().split())
X = list(map(int, input().split()))
if N >= M:
	print(0)
else:
	X.sort()
	Y = [0] * (M - 1)
	for i in range(M - 1):
		Y[i] = X[i+1] - X[i]
	Y.sort(reverse = True)
	print(max(X) - min(X) - sum(Y[:N - 1]))
n,y=map(int,input().split())
a=0
for i in range(n+1):
    for j in range(n-i+1):
        k=n-(i+j)
        if 10000*i + 5000*j + 1000*k == y:
            a+=1
        else:
            pass
        if a == 1:
            print(i,j,k)
            break
        else:
            pass
    if a >= 1:
        break
if a ==0:
    print(-1, -1, -1)
else:
    pass
n,y=map(int,input().split())
a=0
for i in range(n+1):
    for j in range(n-i+1):
        k=n-(i+j)
        if 10000*i + 5000*j + 1000*k == y:
            a+=1
        else:
            pass
        if a == 1:
            print(i,j,k)
            break
        else:
            pass
    if a >= 1:
        break
if a ==0:
    print(-1, -1, -1)
else:
    pass



### FIXED CODE ###

n,y=map(int,input().split())
a=0
for i in range(n+1):
    for j in range(n-i+1):
        k=n-(i+j)
        if 10000*i + 5000*j + 1000*k == y:
            a+=1
        else:
            pass
        if a == 1:
            print(i,j,k)
            break
        else:
            pass
    if a >= 1:
        break
if a ==0:
    print(-1, -1, -1)
else:
    pass
while A > 0 and C > 0:
    C -= B
    if C <= 0:
        print("Yes")
        exit()
    A -= D
    if A <= 0:
        print("No")
        exit()

### FIXED CODE ###

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


while A > 0 and C > 0:
    C -= B
    if C <= 0:
        print("Yes")
        exit()
    A -= D
    if A <= 0:
        print("No")
        exit()
letters = list(S)
a = letters[0]
if letters.count(a) == 2:
  if letters[1] == a:
    if letters[2] == letters[3]:
      return "Yes"
    else return "No"
  else:
    b = letters[1]
    if letters.count(b) == 2:
      return "Yes"
    else:
      return "No"
    

### FIXED CODE ###

letters = list(input())
x = 1
for letter in letters:
        if letters.count(letter) == 2:
            x *= 1
        else:
            x *= 0
print(["No","Yes"][x])
N=int(input())
A=list(map(int,input().split()))

for i in range(1,N+1):
    print(A.count(i))

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=[0]*N

for i in A:
    B[i-1]+=1

for i in B:
    print(i)
#!/usr/bin/env python3
import sys

def make_divisors(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)
    # divisors.sort()
    return divisors

def lef(a, b):
    return a*a*a*a + a*a*a*b + a*a*b*b + a*b*b*b + b*b*b*b

def solve(X: int):
    divs = make_divisors(X)
    for d in divs:
        base = 0
        upper = X // d
        while(lef(base+d,base) < upper):
            base+=1
        if lef(base+d,base) == upper:
            print(base+d,base)
            return

        base = -d//2
        while(lef(base+d,base) < upper) and (base > d//2):
            base -= 1
        if lef(base+d, base) == upper:
            print(base+d, base)
            return

        base = -d
        while(lef(base+d,base) < upper) and (base+d < 0):
            base += 1
        if lef(base+d, base) == upper:
            print(base+d, base)
            return


        base = -d
        while(lef(base+d,base) < upper):
            base -= 1
        if lef(base+d, base) == upper:
            print(base+d, base)
            return
    raise
    return


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

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

def solve(X: int):

    for i in range(-150, 150):
        for j in range(-150, 150):
            if j**5 - i**5 == X:
                print(j, i)
                return
    return


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

if __name__ == '__main__':
    main()
from __future__ import division, print_function
from sys import stdin, maxint
 
 
def main():
    num = int(stdin.readline())
 
    y = []
    for _ in xrange(num):
        it = iter(int(s) for s in stdin.readline().split()[1:])
        y.append([(next(it), next(it)) for _ in xrange(next(it))])
    weight = [maxint] * num
    weight[0] = 0
    t = set(xrange(1, num))
    index = 0
 
    while t:
        for v, cost in y[index]:
            if v not in t:
                continue
            weight[v] = min(weight[v], cost + weight[index])

        index = min(t, key=lambda i: weight[i])
        t.remove(index)

    for i, d in enumerate(weight):
        print(i, d)
 
 
main()

### FIXED CODE ###

from __future__ import division, print_function
from sys import stdin, maxint
 
 
def main():
    x = int(stdin.readline())
 
    y = []
    for _ in xrange(x):
        y.append([int(s) for s in stdin.readline().split()])
 
    g = set(xrange(1, x+1))
    index = g.pop()
    h = {index}
    leng = 0
 
    while g:
        minimum = maxint

        for j in h:
            mj = y[j-1]
            for i in g:
                if 0 <= mj[i-1] < minimum:
                    index = i
                    minimum = mj[i-1]

        h.add(index)
        g.remove(index)
        leng += minimum
 
    print(leng)
 
 
main()
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
rage=range #lol
for i in rage(1,n):
    dp[i]=10**9;
    for j in range(1,k+1):
        if i-j<0:
            break;
        dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[-1])


### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
rage=range #lol
for i in rage(1,n):
    if i==1: dp[i]=dp[i-1]+abs(h[i]-h[i-1])
    else: dp[i]+=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
print(dp[-1])
import numpy as np
(h,w,m),*e=[[*map(int,i.split())]for i in open(0)]
a=np.zeros((h,w),int)
for y,x in e:
    a[y-1][x-1]=1
y=np.sum(a,axis=1)
x=np.sum(a,axis=0)
ans=max(y)+max(x)
b=sum(y[i-1]+x[j-1]==ans for i,j in e)
b-=len(np.where(y==max(y))[0])*len(np.where(x==max(x))[0])
print(ans-(b>=0))

### FIXED CODE ###

(h,w,m),*e=[[*map(int,i.split())]for i in open(0)]
a,b=[0]*h,[0]*w
for y,x in e:
    a[y-1]+=1
    b[x-1]+=1
ans=max(a)+max(b)
c=a.count(max(a))*b.count(max(b))-sum(a[y-1]+b[x-1]==ans for y,x in e)
print(ans-(c<=0))
def gcd(x,y):
    if y==0:
        return x
    while y!=0:
        return gcd(y,x%y)

n=int(input())

a=int(input())
b=int(input())
x=a*b//gcd(a,b)
for i in range(n-2):
    c=int(input())
    x=c*x//gcd(c,x)
print(x)

### FIXED CODE ###

def gcd(x,y):
    if y==0:
        return x
    else:
        return gcd(y,x%y)

n=int(input())

x=1
for i in range(n):
    c=int(input())
    x=c*x//gcd(c,x)
print(x)
N, T = map(int, input().split())
A = list(map(int, input().split()))

n = T // 2

d = -float("inf")
cnt = 1
l = 0
for r in range(1, N - 1):
    if A[l] < A[r]:
        if A[r] > A[r + 1]:
            if d == A[r] - A[l]:
                cnt += 1
            elif d < A[r] - A[l]:
                d = A[r] - A[l]
                cnt = 1
    else:
        l = r
        r += 1
else:
    if d == A[r] - A[l]:
        cnt += 1
    elif d < A[r] - A[l]:
        d = A[r] - A[l]
        cnt = 1
    print(cnt)

### FIXED CODE ###

import numpy as np

N, T = map(int, input().split())
A = np.array(input().split(), dtype=np.int32)

# 自分より左にある最安値
A_cummin = np.minimum.accumulate(A)
# 差額
profit = A - A_cummin

ans = (profit == profit.max()).sum()
print(ans)
while(True):
    m,f,r = [int(i) for i in input().split()]
    if(m == -1 and f == -1 and r == -1):
        break
    if(m == -1 or f == -1):
        print('F')
    elif(m + f >= 80):
        print('A')
    elif(65 <= m + f <= 80):
        prin('B')
    elif(50 <= m + f <= 65):
        print('C')
    elif(30 <= m + f <= 50):
        print('D')
        if(r >=50):
            print('C')
    else:
        print('F')

### FIXED CODE ###

while(True):
    m,f,r = [int(i) for i in input().split()]
    if(m == -1 and f == -1 and r == -1):
        break
    if(m == -1 or f == -1):
        print('F')
    elif(m + f >= 80):
        print('A')
    elif(65 <= m + f <= 80):
        print('B')
    elif(50 <= m + f <= 65):
        print('C')
    elif(30 <= m + f <= 50 and r < 50):
        print('D')
    elif(r >= 50):
        print('C')
    else:
        print('F')
N = int(input()) 
A = list(map(int,input().split()))
c = 1
i = 0
for i in N-1:
  c *= A[i]
   if c >= 10**18:
      print(-1)
  
print(c)



### FIXED CODE ###

n=int(input())
ls=[int(s) for s in input().split(" ")]

if 0 in ls:
  print(0)
else:
  num=1
  for i in ls:
    num*=i
    if num>10**18:
      num=-1
      break

  print(num)
import math
import sys
sys.setrecursionlimit(100000)

n = int(input())
s = int(input())

up = math.sqrt(n)

def colsum(num, base):
    if num < base:
        return num
    else:
        return num%base + colsum(num//base,base)

#s = n(n<b)
if s == n:
    print(n+1)
    exit()


#sqrt(n)まで探索
for i in range(2,int(up)+1):
    if s == colsum(n,i):
        print(i)
        exit()

#2桁しかあり得ない場合(sqrt(n)<b<n)
for j in range(2,int(up)+1):
    if (n-s)%j == 0:
        b = (n-s)/j + 1
        if s == colsum(n,b) and b > 1:
            print(i)
            exit()



print(-1)

### FIXED CODE ###

import math
import sys

n = int(input())
s = int(input())

up = math.sqrt(n)

def colsum(num, base):
    if num < base:
        return num
    else:
        return num%base + colsum(num//base,base)

#s >= n
if s == n:
    print(n+1)
elif s > n:
    print(-1)
else:
    #sqrt(n)まで探索
    for i in range(2,int(up)+1):
        if colsum(n,i) == s:
            print(i)
            sys.exit()

    #2桁しかあり得ない場合(sqrt(n)<b<n)
    for j in range(int(up),0,-1):
        if (n-s)%j == 0:
            b = (n-s)/j + 1
            if colsum(n,b) == s and b > 1:
                print(int(b))
                sys.exit()

    print(-1)
from bisect import bisect
a,b,c,d,e,f=map(int,input().split())
g=f//100
lst=[0]*(g+1)
i=0
for i in range(31):
    for j in range(31):
        h=a*i+b*j
        if h<=g:
            lst[h]=1
data=[]
for i in range(g*e//c):
    for j in range(g*e//d):
        data.append(c*i+d*j)
data.sort()
ans=0
z=[]
for i in range(1,g+1):
    if lst[i]==0:
        continue
    k=100*i
    m=bisect(data,i*e)
    o=data[m-1]
    if k+o<=f:
        if ans<=100*o/(k+o):
            z=[k+o,o]
            ans=100*o/(k+o)
print(*z)

### FIXED CODE ###

from bisect import bisect
a,b,c,d,e,f=map(int,input().split())
g=f//100
lst=[0]*(g+1)
i=0
for i in range(31):
    for j in range(31):
        h=a*i+b*j
        if h<=g:
            lst[h]=1
data=[]
for i in range(g*e//c):
    for j in range(g*e//d):
        data.append(c*i+d*j)
if not data:
    data=[0]
data.sort()
ans=-1
z=[]
for i in range(1,g+1):
    if lst[i]==0:
        continue
    k=100*i
    m=bisect(data,i*e)
    if m==0:
        continue
    o=data[m-1]
    if k+o<=f:
        if ans<=100*o/(k+o):
            z=[k+o,o]
            ans=100*o/(k+o)
    else:
        m=bisect(data,f-k)
        o=data[m-1]
        if ans<=100*o/(k+o):
            z=[k+o,o]
            ans=100*o/(k+o)
print(*z)
s1 = int(raw_input())
s2 = int(raw_input())
if s1>s2:
    print "GREATER"
elif s1 == s2:
    print "EQUAL"
else:
    print "LESS"


### FIXED CODE ###

strs = raw_input()
strs = strs.split()
print strs[0][0].upper() + strs[1][0].upper() + strs[2][0].upper()
from collection import Counter
S = Counter(list(input()))
for k, v in S.items():
  if v % 2 == 1:
    print("No")
    exit()
print("Yes")

### FIXED CODE ###

from collections import Counter
S = Counter(list(input()))
for k, v in S.items():
  if v % 2 == 1:
    print("No")
    exit()
print("Yes")
def dfs(v, p, g, color, c = 0):
	color[v] = c
	for nv in g[v]:
		if nv[0] == p:
			continue
		nc = c if nv[1] % 2 == 0 else 1 - c
		dfs(nv[0], v, g, color, nc)

def resolve():
	n = int(input())
	color = [-1]*n
	g = [[] for _ in range(n)]
	for i in range(n-1):
		u, v, w = map(int, input().split())
		g[u-1].append([v-1, w])
		g[v-1].append([u-1, w])
	for v in range(n):
		dfs(v, -1, g, color)
	for i in color:
		print(i)
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(100**4)

class Edge():
	def __init__(self, v, w):
		self._v = v
		self._w = w
	def v(self):
		return self._v
	def w(self):
		return self._w

def dfs(v, g, colors, color = 0):
	colors[v] = color
	if not len(g[v]):
		return
	for nv in g[v]:
		if colors[nv.v()] != -1:
			continue
		nc = color if nv.w() % 2 == 0 else 1 - color
		dfs(nv.v(), g, colors, nc)

def resolve():
	n = int(input())
	colors = [-1]*n
	g = [list() for _ in range(n)]
	for _ in range(n-1):
		u, v, w = map(int, input().split())
		g[v-1].append(Edge(u-1, w))
		g[u-1].append(Edge(v-1, w))
	for i in range(n):
		if colors[i] != -1:
			continue
		dfs(i, g, colors)
	for c in colors:
		print(c)
resolve()
A, B, C, D = map(int,input().split())
x = max(A, B)
y = min(C, D)
if(y-x > 0):
  print(y - x)
else:
  print(0)


### FIXED CODE ###

N = input()
if(N == N[::-1]):
  print("Yes")
else:
  print("No")
t=input()
s=[0]*len(t)
for i in range(len(t)):
  
    if t[i]=='?':
        if i==0:
            if t[i+1]=='D':
                s[i]='P'
            else:
                s[i]='D'
      
      
        elif i==len(t)-1:
            s[i]='D'
        
    
        else:
            if s[i-1]=='P':s[i]='D'
            elif t[i+1]=='P':s[i]='D'
            else:s[i]='P'

    elif t[i]=='D' or t[i]=='P':s[i]=t[i]
    else:continue
#print(s)
print(''.join(s))

### FIXED CODE ###

t=input()
s=[0]*len(t)

for i in range(len(t)):
  
    if t[i]=='?':
        if i==0:
            if len(t)>=2:
                if t[i+1]=='D':
                    s[i]='P'
                else:
                    s[i]='D'
            else:s[i]='D'
      
      
        elif i==len(t)-1:
            s[i]='D'
        
    
        else:
            if s[i-1]=='P':s[i]='D'
            elif t[i+1]=='P':s[i]='D'
            else:s[i]='P'

    elif t[i]=='D' or t[i]=='P':s[i]=t[i]
    else:continue
#print(s)
print(''.join(s))
N = int(input())

ALL = 800 * N
TIMES = N //15

print(All - (200*TIMES))

### FIXED CODE ###

N = int(input())
sum = 800 * N
otsuri = (N // 15) * 200

print(sum - otsuri)
N=int(input())
A=sorted(list(map(int,input().split())))
M=A[0]
for i in range(N):
  if i==M:
    print(A[1])
  else:
    print(M)
 
    

### FIXED CODE ###

N=int(input())
A = []
for _ in range(N):
    A.append(int(input()))
A2=sorted(A,reverse=True)
M=A2[0]
M2=A2[1]
for i in range(N):
  #print(A[i])
  
  if A[i]==M:
    print(M2)
  else:
    print(M)
N=int(input())
S,T=input().split()
result=''
for i in range N:
  result=S[i]+T[i]
print(result)

### FIXED CODE ###

N=int(input())
S,T=input().split()
result=''
for i in range(N):
  result+=S[i]+T[i]
print(result)
import sys
import numpy as np
input = sys.stdin.readline

n, k = map(int, input().split())
parr = list(map(int, input().split()))
carr = list(map(int, input().split()))
scores = []

for i in range(n):
  cur = i
  # 1ループで通るノードの数とスコア
  roop_num = 0
  roop_score = 0
  while True:
    cur = parr[cur] - 1
    roop_num += 1
    roop_score += carr[cur]
    if cur == i:
      break
  tmp_max = -10**9
  # ループしたときにスコアが減るとき
  # kが1ループの回数より小さいとき
  if roop_score <= 0 or roop_num > k:
    score = 0
    max_iter = min(roop_num, k)
  else:
    # ループする回数
    n = k // roop_num
    score = roop_score*n
    max_iter = k - roop_num*n
  for _ in range(max_iter):
      cur = parr[cur] - 1
      score += carr[cur]
      if score > tmp_max:
        tmp_max = score
  scores += [tmp_max]

print(max(scores))

### FIXED CODE ###

import sys
input = sys.stdin.readline

n, k = map(int, input().split())
parr = list(map(int, input().split()))
carr = list(map(int, input().split()))
scores = []

for i in range(n):
  cur = i
  # 1ループで通るノードの数とスコア
  roop_num = 0
  roop_score = 0
  while True:
    cur = parr[cur] - 1
    roop_num += 1
    roop_score += carr[cur]
    if cur == i:
      break
  tmp_max = -10**9
  # ループしたときにスコアが減るとき
  # kが1ループの回数より小さいとき
  if roop_score <= 0:
    score = 0
    max_iter = roop_num
  elif k <= roop_num:
    score = 0
    max_iter = k
  else:
    # ループする回数
    num = k // roop_num - 1
    score = roop_score*num
    max_iter = k - roop_num*num
  cur = i
  for _ in range(max_iter):
      cur = parr[cur] - 1
      score += carr[cur]
      if score > tmp_max:
        tmp_max = score
  scores += [tmp_max]

print(max(scores))
l = list()
n = int(input())
original_list = list(range(1,n))

for x in original_list:
      ans = 0
      while x % 2 == 0:
        x = x / 2
        ans = ans + 1
      l.append(ans)
 
print(max(l))


### FIXED CODE ###

l = list()
n = int(input())
original_list = list(range(1,n+1))
for x in original_list:
      ans = 0
      while x % 2 == 0:
        x = x / 2
        ans = ans + 1
      l.append(ans)

a = l.index(max(l))
print(original_list[a])
def is_substring(s_char_map, t):
    for char in t:
        if char not in s_char_map:
            return False
    return True


def get_impurity(s, t):
    s_char_map = {}
    
    s_len = len(s)
    for char_idx in range(s_len):
        if s[char_idx] not in s_char_map:
            s_char_map[s[char_idx]] = [char_idx + 1]
        else:
            s_char_map[s[char_idx]].append(char_idx + 1)
    last_idx = -1
    s_length = len(s)
    full_length = 0
    
    if not is_substring(s_char_map, t):
        return -1
    
    for char in t:
        if s_char_map[char][-1] >= last_idx:
            last_idx = list(filter(lambda i: i > last_idx, s_char_map[char]))[0]
            full_length += last_idx - (full_length % s_length)
        else:
            last_idx = s_char_map[char][0]
            full_length += (s_length - (full_length % s_length)) + last_idx
    return full_length

s = input()
t = input()
print(get_impurity(s, t))

### FIXED CODE ###

s = input()
t = input()
d = {i:[] for i in "abcdefghijklmnopqrstuvwxyz"}
for i in range(len(s)):
    d[s[i]].append(i)
for i in t:
    if len(d[i]) == 0:
        print(-1)
        exit()

def binary_search(arr, k):
    l, r = 0, len(arr)-1
    while l <= r:
        m = l+r >> 1
        if arr[m] < k:
            l = m+1
        else:
            r = m-1
    return l

a, b = 0, 0
for i in t:
    j = binary_search(d[i], a)
    if len(d[i]) <= j:
        a = 0
        b += 1
        j = binary_search(d[i], 0)
    a = d[i][j] + 1
print(b * len(s) + a)
n = input()
n = list(n)
#5行目のエラーを防ぐためにstrからlistに変換
if n[-2] != '9' and n[-1] != '9':
  n[-2] = '9'
  n[-1] = str(int(n[-1])+1)

N = [int(i) for i in n]
#listをstrからintに変換
print(sum(N))



### FIXED CODE ###

N = list(map(str, input().rstrip()))
print(max(sum([int(i) for i in N]), 9*(len(N)-1)+int(N[0])-1))
import math
 
while True:
    try:
        n.append(int(raw_input()))
    except:
        break

r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*i+1,r,i+1):
            p[j] = 0

for i in n:
     print sum(p[:i])

### FIXED CODE ###

import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])
N = int(input())
A = list(map(int, input().split()))

new_A = A.sort(reverse=True)

ans = 0
for i in range(len(new_A)):
    if i % 2 == 0:
        ans += new_A[i]

print(ans)

### FIXED CODE ###

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

A.sort(reverse=True)

ans = 0
for i in range(N):
    if i % 2 == 0:
        ans += A[i]
    if i % 2 == 1:
        ans -= A[i]

print(ans)
a = input()
print(a[3])

### FIXED CODE ###

a = input()
print(a[:3])
n, k = map(int, input().split())

m = 0
g = 0
ps = p
for i in range(n):
    g = i+1
    while g < k:
        g = g * 2
        m = m + 1
    p = double(0.5**m) / n 
    ps = ps + p

print(ps)


### FIXED CODE ###

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

g = 0
ps = 0
for i in range(n):
    g = i+1
    m = 0
    while g < k:
        g = g * 2
        m = m + 1
    p = float(0.5**m / n)
    ps = ps + p

print(ps)
s = input()
t = input()

a = []
for i in range(len(s)-len(t)):
  count = 0
  for j in range(len(t)):
    if t[j] != s[j+i]:
      count += 1
  a.append(count)
  
print(min(a))

### FIXED CODE ###

s = input()
t = input()

a = []
for i in range(len(s)-len(t)+1):
  count = 0
  for j in range(len(t)):
    if t[j] != s[j+i]:
      count += 1
  a.append(count)
  
print(min(a))
l = input().split()
x = int(l[0])
y = int(l[1])

print(x * y + " " + 2*x + 2*y)


### FIXED CODE ###

a, b = map(int, input().split())
c=a*b
d=a*2+b*2
print(c, d)
import sys
sys.setrecursionlimit(sys.maxsize)

n = int(input())
h = [int(x) for x in input().split()]
dp = [-1 for _ in range(n)]


def rec_dp(i: int) -> int:
    global h, dp
    if i == 0:
        return 0
    if dp[i] != -1:
        return dp[i]
    res = rec_dp(i - 1) + abs(h[i] - h[i - 1])
    if i - 2 >= 0:
        res = min(rec_dp(i - 2) + abs(h[i] - h[i - 2]), res)
    dp[i] = res
    return res


print(rec_dp(n - 1))


### FIXED CODE ###

INF = 10 ** 9
N = int(input())
h = [int(x) for x in input().split()]

dp = [INF] * N
dp[0] = 0

for i in range(N - 1):
    for j in range(1, 3):
        if i + j < N:
            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))

print(dp[N - 1])
a,b,c=map(str,input().split())

if (b-a)==(c-b):
    print("YES")
else:
    print("NO")

### FIXED CODE ###

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

if (2*b-a-c)==0:
    print("YES")
else:
    print("NO")
n=int(input())
p=list(map(int,input().split()))
cnt=0
for i in range(n-2):
  lst=[p[i],p[i+1],p[i+2]]
  m=min(lst)
  P=p[i+1]
  del lst.index(m)
  if min(lst)==P:
    cnt+=1
print(cnt)


### FIXED CODE ###

n=int(input())
p=list(map(int,input().split()))
cnt=0
for i in range(n-2):
  lst=[p[i],p[i+1],p[i+2]]
  m=min(lst)
  P=p[i+1]
  del lst[lst.index(m)]
  if min(lst)==P:
    cnt+=1
print(cnt)