peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
# import sys
# input = sys.stdin.readline
import collections
import itertools


def main():
    n = int(input())
    x = input_list()
    sx = list(sorted(x))
    h = n//2
    a1 = sx[h-1]
    a2 = sx[h]
    for v in x:
        if v <= a1:
            print(a2)
        else:
            print(a1)


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    h = list(map(int, input().split()))
    for i in range(1, n):
        if h[i] - h[i-1] >= 1:
            h[i] -= 1
        if h[i-1] > h[i]:
            print('No')
            return
    print('Yes')

if __name__ == '__main__':
    main()
# Judge status: Accepted
# ABC 110: A – Maximize the Formula
a = sorted([int(s) for s in input().split()])
a.reverse()
print(a[0] * 10 + a[1] + a[2])
# Judge status: Accepted
N, Y = map(int, input().split())

for x in range(N + 1):
    for y in range(N + 1 - x):
        z = N - x - y
        if x * 10000 + y * 5000 + z * 1000 == Y:
            print(x, y, z)
            exit()
print(-1, -1, -1)
# Judge status: Wrong Answer
# 2020/01/19

n,k,s=map(int,input().split())
if s==10**9:
    rest=10**9-1
else:
    rest=10**9
ans=[s]*k+[rest]*(n-k)
print(ans)
# Judge status: Wrong Answer
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if b - a > k or c - b > k or d - c > k or e - d > k:
    print(":(")
else:
    print("Yay!")
# Judge status: Wrong Answer
def kaibun(mojiretu):
    leg = len(mojiretu)
    if leg == 1:
        return True
    mid = (leg-1) // 2
    if len(mojiretu) % 2 == 0:
        return mojiretu[0:mid+1] == mojiretu[mid+1:]
    else:
        return mojiretu[0:mid] == mojiretu[mid+1:]

def fin():
    print('No')
    quit()

input_line = input()
if not kaibun(input_line):
    fin()

N = len(input_line)

if not kaibun(input_line[0:(N-1)//2]):
    fin()


print('Yes')
# Judge status: Accepted
N,K=map(int,input().split())
a=[]
for i in range(K):
    d=int(input())
    k=list(map(int,input().split()))
    a.append(k)
b=[]
for m in range(K):
    b+=a[m]
b=set(b)
ans=N-(len(b))
print(ans)
# Judge status: Accepted
a,b,c,k = map(int,input().split())
ans = 0
if k==0 or k%2==0:
    ans = a-b
else:
    ans = b-a
if len(str(abs(ans)))==20:
    print("Unfair")
else:
    print(ans)
# Judge status: Accepted
N, K = map(int, input().split())

count = 0
N_K = 1
while N >= N_K:
    count += 1
    N_K *= K

print(count)
# Judge status: Wrong Answer
def main():
  S=input()
  nums = len(S)
  print(type(nums))
  xs = ''
  for num in range(nums-1):
    xs += "x"
  print(xs)
main()
# Judge status: Wrong Answer
n = int(input())

n_li = [n]
while n!=1:
    if n%2==0:
        n = n/2
        if n in n_li:
            break
        n_li.append(n)
    else:
        n = 3*n+1
        if n in n_li:
            break
        n_li.append(n)
print(len(n_li)+1)
# Judge status: Accepted
K,S = map(int, input().split())
count = 0
for x in range(K+1):
    for y in range(K+1):
        z = S-x-y
        if z >=0 and z <=K:
            count += 1
print(count)
# Judge status: Accepted
s = list(input())
count = 0
for i in range(len(s)//2):
    if s[i] != s[len(s)-i-1]:
        count += 1
print(count)
# Judge status: Wrong Answer

import collections

def main():
  n = int(input())
  A = tuple(map(int, input().split()))
  D = collections.defaultdict(int)
  for a in A:
    D[a] += 1

  ans = n

  for i in range(n):
    a = A[i]
    for j in range(1, a // 2 + 1):
      if j not in D:
        continue

      if a == j and D[a] == 1:
        continue

      if a % j == 0:
        ans -= 1
        break

  print(ans)


main()
# Judge status: Accepted
A,B = map(int, input().split())
cnt=0
for i in range(A, B+1):
  i_str = str(i)
  front = i_str[4]+i_str[3]
  back = i_str[0]+i_str[1]
  if front == back:
    cnt +=1
print(cnt)
# Judge status: Wrong Answer
s = input()
t = input()

if len(t) > len(s):
    print("UNRESTORABLE")
    exit()

s = s[::-1]
t = t[::-1]
for i in range(len(s)):
    k = 0
    while True:
        if k == len(t):
            ans = s[:i] + t + s[i+len(t):]
            print(ans[::-1].replace("?","a",len(ans)))
            exit()
        if t[k] == s[k] or s[k] == "?":
            k += 1
        else:
            break
print("UNRESTORABLE")
# Judge status: Accepted
N=int(input())
A=[0]+list(map(int,input().split()))
B=[0]+list(map(int,input().split()))
C=[0]+list(map(int,input().split()))

X=0
for i in range(1,N+1):
    X+=B[i]

    if A[i-1]+1==A[i]:
        X+=C[A[i-1]]
print(X)
# Judge status: Accepted
n, k = map(int, input().split())
s = input()

print(s[:k-1] + s[k-1].lower() + s[k:] )
# Judge status: Wrong Answer
# import math
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque

# import numpy as np
# import scipy as scp

# 入力の受け取り
d,n = map(int,input().split())
if d ==0:
    if n <=99:
        ans = n
    elif n==100:
        ans = 101
elif d == 1:
    if n <=99:
        ans = n*100
    elif n==100:
        ans = 100*100+1
else:
    if n <=99:
        ans = n*100**2
    elif n==100:
        ans = 100*100**2+1

print(ans)
# Judge status: Wrong Answer
sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy

print('R' * dx + 'U' * dy + 'R' + 'D' * (dy + 1) + 'L' * (dx + 1) + 'U' * (dy + 1) + 'R' * dy + 'U' + 'L' * (dx + 1) + 'D' * (dy + 1) + 'R')
# Judge status: Accepted
from fractions import Decimal, Fraction
a,b = input().split()
a = Fraction(a)
x = Decimal(b).as_integer_ratio()
b = Fraction(x[0], x[1])
print(int(a*b))
# Judge status: Accepted
a,v=map(int,input().split())
b,w=map(int,input().split())
t = int(input())
kyori = abs(b - a)
sokudo = w - v
if kyori + sokudo * t <= 0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
K, N = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

A = A + [K]

lis = [0]*N
for i in range(N):
    lis[i] = A[i+1] - A[i]

#一番長い距離を引くか, 端から端までか
print(min(sum(lis[:N-1]), K - max(lis)))
# Judge status: Accepted
import math
N,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
#print(a)
conf=0
for i in range(N):
    if i==N-1:
        if a[i]==x:
            conf=conf+1
    else:
        if a[i]<=x:
            conf=conf+1
            x=x-a[i]
        else:
            break
print(conf)
# Judge status: Accepted
S = str(input())

if len(S)%2 == 0:
  tes = "hi"*int((len(S)/2))
  if S ==tes:
    print("Yes")
  else:
    print("No")
else:
  print("No")
# Judge status: Accepted
import math
N,D = map(int,input().split())
print(math.ceil(N/((D*2+1))))
# Judge status: Wrong Answer
a,b,c=map(str,input().split())
print(int(a+b)+int(c),int(a)+int(b+c))
# Judge status: Wrong Answer
n,k = map(int, input().split())
lis = list(map(int, input().split()))

if len(lis) == 1:
    print(abs(lis[0]))
    exit()

ans = 10**9+7
for i in range(n-k):
    l = abs(lis[i]) + abs(lis[i+k-1]-lis[i])
    r = abs(lis[i+k-1]) + abs(lis[i+k-1]-lis[i])
    ans = min(ans, l, r)

print(ans)
# Judge status: Accepted
a, b = map(int,input().split())
if a<=b:
  print(a)
else:
  print(a-1)
# Judge status: Accepted
n,k=map(int,input().split())
h=[int(input()) for _ in range(n)]
h.sort()
ans=1000000000
for i in range(n-k+1):
    buf=h[i+k-1]-h[i]
    if buf<ans:
        ans=buf
print(ans)
# Judge status: Wrong Answer
import math
n = int(input())
print(int(math.sqrt(n))**2)
# Judge status: Accepted
a,b=map(int,input().split())
j=a+b
print( int(j/2) if j%2==0 else "IMPOSSIBLE")
# Judge status: Accepted
a, b, c = map(int, input().split())
res = 0
if a == b and a == c and a % 2 == 0:
    print(-1)
else:
    while 10 > 0:
        if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
            break
        a1 = a//2
        b1 = b//2
        c1 = c//2
        a = b1+c1
        b = a1+c1
        c = a1+b1
        res += 1
    print(res)
# Judge status: Wrong Answer
def devide(dev):
	count = 0
	while dev % 2 == 0:
		dev /= 2
		count += 1
	return count

n = int(input())
count_cal = []

for i in range(1, n+1):
	count_cal.append(devide(i))

MAX = count_cal[0]

for k in range(len(count_cal)):
	if MAX <= count_cal[k]:
		MAX = count_cal[k]
		ans = k

print(count_cal)
print(ans + 1)
# Judge status: Wrong Answer
N = int(input())
print(10**N-2*9**N+8**N)
# Judge status: Accepted
from math import ceil

S=input()
N=len(S)
a=S.count("a")
b=S.count("b")
c=S.count("c")

maxi=max(a,b,c)
mini=min(a,b,c)
midi=a+b+c-maxi-mini

ans="NO"
if maxi<=ceil(N/3):
  if midi<=ceil(N/3):
    if mini<=ceil(N/3):
      ans="YES"
      
print(ans)
# Judge status: Accepted
a=int(input())
print(a+a*a+a**3)
# Judge status: Accepted
import  math

R=int(input())

print(2*math.pi*R)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

turn = 1
while a > 0 and c > 0:
    if turn == 1:
        c -= b
    else:
        a -= d
    turn *= -1

if a <= 0:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
from statistics import mean, median,variance
N = int(input())
A = list(map(int, input().split()))

m = round(mean(A))
cost = 0
for a in A:
  cost += (a-m)**2
print(cost)
# Judge status: Accepted
from collections import deque
from bisect import bisect_left

n = int(input())
a = [int(input()) for _ in range(n)]

dp = deque([])
b = []
for i in range(n):
    j = bisect_left(dp, a[i])
    if j == 0:
        dp.appendleft(a[i])
    else:
        dp[j-1] = a[i]

print(len(dp))
# Judge status: Accepted
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

print('ABD' if ri() > 999 else 'ABC')
# Judge status: Accepted
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
if n>=m:
    print(0)
else:
    s=[]
    for i in range(m-1):
        a=x[i+1]-x[i]
        s.append(a)
    s.sort()
    ans=0
    for i in range(m-n):
        ans+=s[i]
    print(ans)
# Judge status: Wrong Answer
A, B, C, K = map(int, input().split())
if K % 2 == 1:
    print(A-B)
else:
    print(B-A)
# Judge status: Accepted
import sys

a, b, c, d = map(int, sys.stdin.readline().split())

def main():
  dy, dx = d - b, c - a
  res = 'U' * dy + 'R' * (dx + 1) + 'D' * (dy + 1) + 'L' * (dx + 1)
  res += 'UL'
  res += 'U' * (dy + 1) + 'R' * (dx + 1) + 'D' * (dy + 1) + 'L' * dx
  print(res) 
if __name__ == '__main__':
  main()
# Judge status: Accepted
N, M = map(int, input().split())

adj = [set() for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    adj[a].add(b)
    adj[b].add(a)

if len(adj[0] & adj[N - 1]) > 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Judge status: Accepted
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
print(-(-(N - M) // (M - 1)) + 1)
# Judge status: Wrong Answer
n = int(input())
h = list(map(int, input().split()))
for i in range(n-1):
    if h[i+1]-h[i] > 1:
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,m,k = na()

for i in range(m+1):
    for j in range(n+1):
        if n*i+m*j-2*i*j == k:
            print('Yes')
            exit()

print('No')
# Judge status: Wrong Answer
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

x=int(input())
if x%11==0:
    print(x//11*2)
else:
    print(x//11*2+(x%11)//6+1)
# Judge status: Accepted
# -*- coding: utf-8 -*-
S = input()

s_frq_dict = {'a': 0, 'b': 0, 'c': 0}
for s in S:
    s_frq_dict[s] += 1

frqs = list(s_frq_dict.values())
if max(frqs) - min(frqs) <= 1:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n,m = map(int,input().split())
s = [0 for i in range(m)]
for i in range(n):
    t = list(map(int,input().split()))
    for i in range(1,len(t)):
        s[t[i]-1] += 1
ans = 0
for i in range(m):
    if(s[i] == n):
        ans += 1
print(ans)
# Judge status: Wrong Answer
a=list(input())
s=''

for i in a:
    if i == '0':
        s=s+'0'
    elif i == '1':
        s=s+'1'
    else:
        s=s[0:a.index(i)-1]
    
print(s)
# Judge status: Accepted
n=int(input())
a=[int(o) for o in input().split()]
ans=1000
stock=0
prev=0
for i in range(n-1):
    if i>0 and prev<a[i] and stock>0:
        ans+=stock*a[i]
        stock=0
    if a[i]<a[i+1]:
        m=ans//a[i]
        ans-=m*a[i]
        stock+=m
        prev=a[i]
    #print(ans," ",stock)
if  prev<a[n-1] and stock>0:
        ans+=stock*a[n-1]
print(ans)
# Judge status: Accepted
c = [list(map(int, input().split())) for _ in range(3)]
flag = True
for i in range(3):
  x = [0]*3
  y = [0]*3
  for j in range(3):
    x[j] = c[i-1][j] - c[i][j]
    y[j] = c[j][i-1] - c[j][i]
  if len(set(x)) != 1 or len(set(y)) != 1:
    flag = False
if flag:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a, b, c = map(int, input().split())

if a + b >= c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a = int(input())

print(a + a**2 + a ** 3)
# Judge status: Accepted
s=input()

count=0
for i in range(len(s)):
    if (i+1)%2==1 :
        if s[i] in ["R","U","D"]:
            count+=1
    if (i+1)%2==0:
        if s[i] in ["L","U","D"]:
            count+=1
    
if count==len(s):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    x, a, b = map(int, readline().split())

    if abs(x - a) < abs(x - b):
        print('A')
    else:
        print('B')

    return


if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b,c = map(int,input().split())
s = "YNeos"
print(s[(a+b<c)::2])
# Judge status: Accepted
a,b,c = map(int,input().split())
if a+b+c >= 22:
  print('bust')
elif a+b+c <= 21:
  print('win')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
ls = [-1] * n
c = 0
for i in a:
    ls[i - 1] = c + 1
    c+=1
print(ls)
# Judge status: Accepted
k = int(input())
s = input()
if k >= len(s):
    print(s)
else:
    a = s[:k] + "..."
    print(a)
# Judge status: Accepted
from collections import Counter

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

c = Counter(An)

res = 0
for k,v in c.items():
    res += v*(v-1)//2

for a in An:
    print(res - (c[a]-1))
# Judge status: Accepted
S = {}
S['a'] = input()
S['b'] = input()
S['c'] = input()
turn = 'a'
while True:
    hand = S[turn]
    if len(hand) == 0: break
    S[turn] = hand[1:]
    turn = hand[0]

print(turn.upper())
# Judge status: Accepted
N=int(input())
print((N-1)//2+1)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

cnt = 0

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

print(cnt)
# Judge status: Wrong Answer
N,K=map(int,input().split())
p=list(map(int,input().split()))
ppp=sorted(p)
print(ppp)
buy=[]
for i in range(K):
    buy.append(ppp[i])
print(sum(buy))
# Judge status: Wrong Answer
S = input()
s = list(S)
k = []
a = len(s) % 2
if a == 0:
    for i in range(a):
        t = [s[i * 2],s[i * 2 + 1]]
        result = ''.join(t)
        k.append(result)
        
    
    #print(k)
    n = 0
    for j in range(a):
        if k[j] == "hi":
            n = n + 1
    if n == a:
        print("Yes")
    else:
        print("No")
else:
    print("No")
# Judge status: Accepted
nums = list(map(int, input().split()))
a, b, c, d = nums
result = a*c

if a*d > result:
  result = a*d
if b*c > result:
  result = b*c
if b*d > result:
  result = b*d

print(result)
# Judge status: Accepted
n = int(input())
h = [int(i) for i in input().split()]
cnts = []
start = 0
i = 1
while i < n:
    while h[i-1] >= h[i]: 
        i += 1
        if i >= n: break
    cnts.append(i - start - 1)
    start = i
    i += 1

print(max(cnts) if cnts != [] else 0)
# Judge status: Wrong Answer
import bisect
N, *A = map( int, open( 0 ).read().split() )
L = [ A[ 0 ] ]
for a in A[1:]:
  kr = bisect.bisect_right( L, a )
  print( kr, a )
  if ( kr != 0 ) and ( a != L[ kr -1 ] ):
    L[ kr - 1 ] = a
  else:
    L.insert( kr, a )

print( len( L ) )
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))

#6,10の倍数になれば良い

count = 0
ok_count = 0
for i in range(len(a)):
    if a[i]%2  == 0:
        count += 1
        if a[i]%3 == 0 or a[i]%5 == 0 or a[i]%3 == 0 and a[i]%5 == 0:
            ok_count += 1
if count == ok_count:
    print('APPROVED')
else:
    print('DENIED5')
# Judge status: Accepted
t = int(input())

if t >= 30:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s = input()
nums = list(reversed([int(c) for c in s])) + [0]
r = (0, 1) # no borrow, with borrow
for i in range(len(nums)):
    # print(r)
    next_no_borrow = min(r[0] + nums[i], r[1] + nums[i] + 1)
    next_borrow = min(10 - nums[i] + r[0], 9 - nums[i] + r[1])
    r = (next_no_borrow, next_borrow)
print(min(r))
# Judge status: Accepted
from itertools import accumulate

N = int(input())
a_li = list(map(int, input().split()))
# y = X - x
# |x - y| = |x - (X - x)|
#         = |-X + 2x|
total = sum(a_li)
acc = list(accumulate(a_li))
ans = 10 ** 18
for i in range(N - 1):
    ans = min(ans, abs(acc[i] * 2 - total))
print(ans)
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())
if b <= 0 and d <= 0:
    print(c * a)

elif b > 0 and d > 0:
    print(b * d)

elif b < 0 and d > 0:
    if c > 0:
        print(c * d)
    else:
        print(b * d)

elif b > 0 and d < 0:
    if a > 0:
        print(a * d)
    else:
        print(a * c)
# Judge status: Accepted
H,N=map(int,input().split())
A=list(map(int,input().split()))
if H <= sum(A):print('Yes')
else:print('No')
# Judge status: Accepted
s = input()
if "N" in s:
  if "S" not in s :
    print("No")
    exit()
if "E" in s:
  if "W" not in s:
    print("No")
    exit()
if "S" in s:
  if "N" not in s :
    print("No")
    exit()
if "W" in s:
  if "E" not in s:
    print("No")
    exit()
print("Yes")
# Judge status: Accepted
N,A,B = map(int,input().split())
S = input()

cnt = 0 # 予選通過人数
rank_f = 1 # 海外学生の順位
for i in range(N):
  if(S[i] == 'a'):
    if(cnt < A+B):
      print('Yes')
      cnt += 1
    else:
      print('No')
  elif(S[i] == 'b'):
    if((cnt < A+B)and(rank_f <= B)):
      print('Yes')
      rank_f += 1
      cnt += 1
    else:
      print('No')
  elif(S[i] == 'c'):
     print('No')
# Judge status: Accepted
import heapq
 
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for i in range(m)]
bc.sort(key=lambda x: x[1], reverse = True)
heapq.heapify(a)
 
for i in range(m):
  for j in range(bc[i][0]):
    temp = heapq.heappop(a)
    temp2 = bc[i][1]
    if temp2 > temp:
      heapq.heappush(a, temp2)
    else:
      heapq.heappush(a, temp)
      print(sum(a))
      quit()
      
print(sum(a))
# Judge status: Accepted
import math;f=math.factorial;n,m=sorted(map(int,input().split()));print(max(2-m+n,0)*f(n)*f(m)%(10**9+7))
# Judge status: Accepted
S = input ()
week = ['SAT','FRI','THU','WED','TUE','MON','SUN']
for i in range (7):
  if S == week[i]:
    print (i+1)
    break
# Judge status: Wrong Answer
c=[list(map(int,input().split())) for _ in range(3)]

for a0 in range(101):
  b0=c[0][0]-a0
  b1=c[0][1]-a0
  b2=c[0][2]-a0
  
  a1= c[1][0]-b0
  if a1 != c[1][1]-b1 or a1 != c[1][2]-b2:
    continue
  a2= c[2][0]-b0
  if a2 != c[2][1]-b1 or a2 != c[2][2]-b2:
    continue
  print("Yes")
  print(a0,a1,a2)
  print(b0,b1,b2)
  
  exit()
print("No")
# Judge status: Wrong Answer
S = input()
K = int(input())

for s in S[:K+1]:
    if s != "1": 
      print(s)
      break
# Judge status: Accepted
N = int(input())
S = input()
rcount = 0
gcount = 0
bcount = 0
for i in range(N):
  if S[i] == 'R':
    rcount += 1
  elif S[i] == 'G':
    gcount += 1
  elif S[i] == 'B':
    bcount += 1

total = rcount * gcount * bcount
count = 0
for i in range(N-2):
  for j in range(i+1, N-1):
    k = 2*j - i
    if k < N and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
      count += 1
print(total - count)
# Judge status: Wrong Answer
num = list(map(int,input().split()))
sum = 0
for i in num:
  sum += i
if sum > 22:
  print("best")
else:
  print("win")
# Judge status: Accepted
from itertools import combinations_with_replacement

N, M, Q = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(Q)]

ans = 0
for x in combinations_with_replacement(range(1, M + 1), N):
    tmp = 0
    for i in range(Q):
        if x[X[i][1] - 1] - x[X[i][0] - 1] == X[i][2]:
            tmp += X[i][3]
    ans = max(ans, tmp)

print(ans)
# Judge status: Accepted
from collections import Counter
n = int(input())
l = []
for _ in range(n):
    s = "".join(sorted(input()))
    l.append(s)
cnt = Counter(l)
ans = 0
for v in cnt.values(): ans += v * (v-1) // 2
print(ans)
# Judge status: Accepted
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))

def lamp(A):
  B = [0] * N
  for i in range(N):
    l = max(0, i - A[i])
    r = min(N - 1, i + A[i])
    #print(l, r)
    B[l] += 1
    if r + 1 < N:
      B[r + 1] -= 1
  
  A[0] = B[0]
  for i in range(1, N):
    A[i] = A[i - 1] + B[i]
  return A

x = int(math.log(N, 2)) + 40
r = min(x, K)
for i in range(r):
  A = lamp(A)
  
for i in range(N):
  print(A[i], end = " ")
print("")
# Judge status: Accepted
s=input()
n=len(s)
ss=''

def even_strings(a):
  n=len(a)
  if n%2!=0:
    return False
  
  if a[0:n//2]==a[n//2:n]:
    return True
  else:
    return False

for i in range(n-1): #手前までやる､最後まではやらない 1文字以上だから
  ss+=s[i]
  if even_strings(ss):
    ret=i
    
print(ret+1)
# Judge status: Accepted
N,C,K=map(int,input().split())
T=[int(input()) for i in range(N)]
T.sort()
 
count=1
cus=0
pre=T[0]
for t in T:
    if C>cus and pre+K>=t:
        cus+=1
    else:
        cus=1
        pre=t
        count+=1
print(count)
# Judge status: Accepted
# 4問目類題1
N = int(input())
for k in range(7):
    if 2**k <= N < 2**(k+1):
        print(2**k)
# Judge status: Accepted
s = input()

a, b, c = 0, 0, 0

for i in range(len(s)):
    if s[i] == "a":
        a += 1
    elif s[i] == "b":
        b += 1
    else:
        c += 1


def func(j, k):
    if j + 1 == k or j - 1 == k or j == k:
        return True
    else:
        return False

ab, bc, cd = False, False, False
ab = func(a, b)
bc = func(b, c)
ca = func(c, a)

if ab and bc and ca:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
def main():
    s = list(input())
    if len(s) % 2 == 0:
        del s[-1]

    del s[-1]
    half_len = len(s) // 2

    for i in range(0, half_len, 2):
        if s[:half_len-(i//2)] == s[half_len-(i//2):]:
            break
        else:
            del s[-2:]

    print(len(s))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
k, a, b = map(int, input().split())

if a+2 <= b:
    print(max(max((k-a-1) // 2, 0) * (b-a) + b + (k-a-1) % 2, k+1))
else:
    print(k+1)
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
b = round(sum(a)/n)
ans = 0

for i in range(n):
    ans += (a[i]-b)**2

print(ans)
# Judge status: Accepted
K, X = map(int,input().split())

if (K*500) >= X:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a = list(map(int, input().split()))

print(len(set(a)))
# Judge status: Accepted
x = input()
if len(x) < 3:
    print(0)
    exit()
k = int(x[0:-2])
x = int(x[-2:])

k -= x / 5
if x % 5 == 0 and k >= 0:
    print(1)
elif k > 0:
    print(1)
else:
    print(0)