peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import collections
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)

one = 0
theo = 0
skip = False
for i in range(N-1):
    if skip:
        skip = False
        continue
    if A[i] == A[i+1]:
        if one == 0:
            one = A[i+1]
            skip = True
        else:
            theo = A[i+1]
            break
print(one*theo)
# Judge status: Accepted
import math
H, N = map(int, input().split())
A = list(map(int, input().split()))

if sum(A) < H:
	print("No")
else:
	print("Yes")
# Judge status: Accepted
from collections import Counter as C

_ = input()

b = []
for k, v in C([int(x) for x in input().split()]).items():
    b.extend([k] * (v // 2))
else:
    if 2 <= len(b):
        b.sort()
        print(b[-1] * b[-2])
    else:
        print(0)
# Judge status: Accepted
def main():
    N=int(input())
    abc=[0]*N
    for i in range(N):
        xyz=list(map(int,input().split()))
        abc[i]=xyz
    dp=[[0]*3 for _ in range(N+1)]
    for i in range(1,N+1):
        for j in range(3):
            dp[i][j]=max(dp[i-1][(j-1)%3]+abc[i-1][(j-1)%3],dp[i-1][(j-2)%3]+abc[i-1][(j-1)%3])

    print(max(max(dp[N][0],dp[N][1]),dp[N][2]))

if __name__=="__main__":
    main()
# Judge status: Accepted
V = [int(input()) for _ in range(5)]

v_mod = [x%10 if x%10 != 0 else 10 for x in V]
min_mod = min(v_mod)

ans = 0
for i, v in enumerate(V):
    ans += v + (10 - v_mod[i])
ans -= (10 - min_mod)
print(ans)
# Judge status: Accepted
def mi(): return map(int,input().split())
def lmi(): return list(map(int,input().split()))
def ii(): return int(input())
def isp(): return input().split()
from collections import deque
n,m=mi()
adjacent_list=[[] for i in range(n+1)]
for i in range(m):
  a,b=mi()
  adjacent_list[a].append(b)
  adjacent_list[b].append(a)
#print(adjacent_list)

dp=[0]*(n+1)

que=deque()
que.append(1)
while que:
  p=que.popleft()
  for i in adjacent_list[p]:
    if dp[i]==0:
      dp[i]=p
      que.append(i)
      
print('Yes')
for i in range(2,n+1):
  print(dp[i])
# Judge status: Accepted
n = int(input())
c,f=0,0
for i in range(1,1000001):
    c=c*10+7
    c=c%n
    if c==0:
        f=1
        print(i)
        break
if f==0:
    print(-1)
# Judge status: Wrong Answer
import queue
q = queue.Queue()
for i in range(1,10):
   q.put(i)

def k_th(q,k):
  for i in range(k):
      x=q.get()
      if x%10!=0:
        q.put(10*x-1)
      q.put(10*x)
      if x%10!=9:
        q.put(10*x+1)
  return x

K=int(input())
print(k_th(q,K))
# Judge status: Accepted
N = int(input())
T,A = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
sub = [0 for i in range(N)]
for i in range(N):
    sub[i] = abs(A - (T - 0.006*H[i]))
print(sub.index(min(sub))+1)
# Judge status: Accepted
n = int(input())
ls = []
for i in range(n):
    x,l = map(int,input().split())
    ls.append([x-l,l+x])

ls = sorted(ls, key=lambda x: x[1])
ans = n

for i in range(1,n):
    if ls[i][0] < ls[i-1][1]:
      ls[i][1] = ls[i-1][1]
      ans -=1

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

if 1 <= A <= 9 and 1 <= B <= 9:
    print(A * B)
else:
    print(-1)
# Judge status: Wrong Answer
N, W = map(int, input().split())
item = [list(map(int, input().split())) for _ in range(N)]
item.sort(key=lambda x: x[1])
ans = 0
total_weight = 0

for i in range(N):
    while item:
        weight, value = item.pop()
        if weight <= W - total_weight:
            ans += value
            total_weight += weight
            break
    if not item:
        break

print(ans)
# Judge status: Wrong Answer
a, b, c, x, y = [int(i) for i in input().split()]
m = 0
if a + b > c * 2:
    if x > y:
        m += 2 * c * min(x, y) + min(a * (x - y), 2 * c * (x - y))
    else:
        m += min(b * (y - x), 2 * c * (y - x))
else:
    m += a * x + b * y
print(m)
# Judge status: Accepted
import sys

input = sys.stdin.readline

def main():
    ans = 'Yes'
    n = int(input())
    now = [0,0]
    pt = 0
    for i in range(n):
        t, x, y = map(int, input().split())
        d = abs((x - now[0]) + (y - now[1]))
        if d > abs(t - pt) or (t - pt)%2 != d%2:
            ans = "No"
            break
        now = [x, y]
        pt = t
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
D,T,S=(int(x) for x in input().split())
if D >S*T:
  print('no')
else:
  print('yes')
# Judge status: Accepted
n = int(input())

for i in range(1, 10):
    num = 111 * i
    if n <= num:
        print(num)
        break
# Judge status: Accepted
n = int(input())
for i in range(1,10):
    for j in range(1,10):
        if i*j == n:
            print("Yes")
            exit()
print("No")
# Judge status: Accepted
P,Q,R=map(int,input().split())
A=[P+Q,Q+R,R+P]
print(min(A))
# Judge status: Wrong Answer
n, d = map(int, input().split())

a = n % (1 + d * 2)

if a != 0:
  print(n // (1 + d * 2) + 1)
else:
  print(n // (1 + d * 2) + 1)
# Judge status: Wrong Answer
import math
n, d = map(int, input().split())
num = 0
ans = 0

for i in range(n):
  x, y = map(int, input().split())
  num = math.sqrt(x**2 + y**2)
  if num <= 0:
    ans += 1
    
print(ans)
# Judge status: Accepted
n = int(input())

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

import collections

C = collections.Counter(A)

D = sorted(list(set(A)))[::-1]

t = 0
s = 0
for i in D:
    if C[i] >= 4 and t == 0:
        print(i ** 2)
        s = 1
        break
    elif C[i] >= 2 and t == 0:
        t = i
    elif C[i] >= 2 and t != 0:
        print(i * t)
        s = 1
        break

if s == 0:
    print(0)
# Judge status: Accepted
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))


a, b, x = LI()
acnt = (a - 1) // x
bcnt = b // x
ans = bcnt - acnt
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

S = input().strip()

if S[-1] == 's':
    print(S + 'es')
else:
    print(S + 's')
# Judge status: Accepted
H, N = map(int, input().split())
if sum(list(map(int, input().split()))) >= H:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n=int(input())
ans=0
for i in range(1,n+1,2):
    cnt=0
    for j in range(1,i+1):
        if i%j == 0:
            cnt += 1
    if cnt == 8:
        ans += 1
print(ans)
# Judge status: Wrong Answer
def INT(): return int(input())
N = INT()
K = INT()
X = INT()
Y = INT()
print(K * X + (N - K) * Y)
# Judge status: Accepted
#!/usr/bin/env python3
a, b = map(int, input().split())
n = b - a
n = n*(n-1)//2
print(n-a)
# Judge status: Accepted
import numpy as np

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

def rot(deg):
    theta = np.radians(deg)
    c,s = np.cos(theta),np.sin(theta)
    return np.array([[c,-s],[s,c]])

print(np.linalg.norm(A*rot((H*60+M)*360/(60*12)).dot([[0],[1]]) - B*rot(M*360/60).dot([[0],[1]])))
# Judge status: Accepted
# -*- coding: utf-8 -*-

N,M = list(map(int, input().rstrip().split()))
#-----

ans = abs(N-2) * abs(M-2)
print(ans)
# Judge status: Accepted
N = int(input())
answer =int(N*(N+1)/2)

print(answer)
# Judge status: Accepted
s = input()
t = input()
if len(s) < len(t):
  print("UNRESTORABLE")
  exit()

start = -1
for i in range(len(s)-len(t)+1):
  for j in range(len(t)):
    if s[i+j] != "?" and s[i+j] != t[j]:
      break
  else:
    start = i

if start == -1:
  print("UNRESTORABLE")
else:
  ans_list = list(s)
  for i in range(len(ans_list)):
    if start <= i < start+len(t):
      ans_list[i] = t[i-start]
    elif ans_list[i] == "?":
      ans_list[i] = "a"
  print("".join(ans_list))
# Judge status: Accepted
N = int(input())
print(max(2 ** i if 2 ** i <= N else 0 for i in range(10)))
# Judge status: Wrong Answer
Q,H,S,D = map(int,input().split())
N = int(input())


L2 = min(D,2*S,4*H,8*Q)
L1 = min(S,2*H,4*Q)
L05 = min(H,2*Q)

ans = 0
P_L = [L2,L1,L05,Q]
L_L = [2,1,0.5,0.25]
for i,l in enumerate(L_L):
    P,N= divmod(N,l)
    ans+=P*P_L[i]
ans=int(ans)
print(ans)
# Judge status: Accepted
N=int(input())

if 1<=N<=999:
	print("ABC")
elif 999<N<=1998:
 	print("ABD")
# Judge status: Accepted
N, M = map(int, input().split())
Lmi, Lma = [], []
for i in range(M):
  mi, ma = map(int, input().split())
  Lmi.append(mi)
  Lma.append(ma)
r = max(min(Lma) - max(Lmi) + 1, 0)
print(r)
# Judge status: Accepted
a, b = map(int, input().split())
print(a if a <= b else a-1)
# Judge status: Wrong Answer
K,X = map(int,input().split())
if 500*K > X:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
d, m = divmod(n, 100)
if m <= d*5:
    print(1)
else:
    print(0)
# Judge status: Accepted
n=int(input())
p=10**9+7
l=[1]*(2001)
l[1],l[2]=0,0
s=1
for i in range(6,2001):
    l[i]+=s
    l[i]%=p
    s+=l[i-2]
print(l[n])
# Judge status: Wrong Answer
S = input()
m = 0
num = 0
for c in S:
  if c == '<':
    num += 1
  elif c == '>':
    num -= 1
  m = min(num, m)
if m < 0:
  num += -m
else:
  num = 0

ans = 0
ans += num
for c in S:
  if c == '<':
    num += 1
  elif c == '>':
    num -= 1
  ans += num
print(ans)
# Judge status: Wrong Answer
def resolve():
	n = int(input())
	ans = 0
	a = list(map(int, input().split()))
	rem = 0 if sum(a) % n == 0 else 1
	y = sum(a) // n + rem
	for x in a:
		if x == y:
			continue
		ans += (x-y)**2
	print(ans)

resolve()
# Judge status: Accepted
import math
a, b = map(int, input().split())

# 最小公倍数lcmと最大公約数gcdに成り立つ関係：gcd(a,b)*lcm(a,b)=ab を用いる
print(a * b // math.gcd(a, b))
# Judge status: Wrong Answer
n = int(input())
a = list(input().split())
# aa = str("".join(a))
q = int(input())
bc = []
for i in range(q):
    bc.append(list(map(int,input().split())))

for i in range(q):
    mae = str(bc[i][0])
    ato = str(bc[i][1])
    for i,k in enumerate(a):
        if mae == k:    
            a[i] = a[i].replace(mae,ato)
            break
    s = 0
    for j in range(len(a)):
        s += int(a[j])
    print(s)
# Judge status: Accepted
from collections import Counter

N = int(input())
C = list(input())
C1 = Counter(C)
ans = 0
for i in range(C1["R"]):
    if C[i] == "W":
        ans += 1
print(ans)
# Judge status: Wrong Answer
S=input()
ans=1000
for i in range(len(S)-3):
    ans=min(ans,abs(753-int(S[i:i+3])))
print(ans)
# Judge status: Wrong Answer
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

k=int(input())
ans=0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=gcd(a,b,c)
print(ans)
# Judge status: Wrong Answer
import itertools

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

gr=itertools.groupby(sorted(A))
s=0
dic={}
for x,group in gr:
  l=len(list(group))
  if l >= 2:
    s+=l*(l-1)/2
  dic[x]=l

for k in range(N):
  l=dic[A[k]]
  if l >= 2:
    print(int(s-l*(l-1)/2+(l-1)*(l-2)/2))
  else:
    print(s)
# Judge status: Accepted
import sys
readline = sys.stdin.readline

N,M = map(int,readline().split())
A = list(map(lambda x:-x,map(int,readline().split())))

import heapq
heapq.heapify(A)

for i in range(M):
  val = heapq.heappop(A)
  heapq.heappush(A,((val * (-1))// 2) * (-1))

print(-sum(A))
# Judge status: Accepted
N = list(map(int, list(input())))

dp=[[-1,-1] for i in range(len(N)+1)]
dp[0]=[0,1]
b=0
N.insert(0,0)

for i in range(1,len(N)):
    up = 10-N[i]
    dp[i][0]=min(dp[i-1][0]+N[i],dp[i-1][1]+up)
    dp[i][1] = min(dp[i-1][0]+N[i]+1, dp[i-1][1]+up-1)
   

print(dp[-1][0])
# Judge status: Wrong Answer
A, B, K = map(int, input().split())
list = []
for i in range(1, max(A, B)+1):
    if A % i == 0 and B % i == 0:
        list.append(i)
    else:
        pass
print(list[K-1])
# Judge status: Accepted
K = int(input())

def calculate(k):

    if k % 2 == 0:
        print(-1)
        return

    if k % 5 == 0:
        print(-1)
        return

    res = 1

    m = (((10 ** res) - 1) // 9) * 7


    while m % k > 0:
        res += 1
        m = m % k
        m = m * 10 + 7

    print(res)


calculate(K)
# Judge status: Accepted
boin_list = ['a','i','u','e','o']
in_chara = input()
    
if in_chara in boin_list:
    print('vowel')
else:
    print('consonant')
# Judge status: Wrong Answer
# B Comparing Strings

a, b = input().split()

s = []
s.append(a * int(b))
s.append(b * int(a))
s.sort

print(s[0])
# Judge status: Accepted
input_line = input().split()
x = int(input_line[0])
k = int(input_line[1])
d = int(input_line[2])

x = abs(x)
y = int(x/d)

if y < k:
  x -= y * d
  if (k-y) % 2 == 1:
    x -= d

else:
  x -= k*d
    
print(abs(x))
# Judge status: Wrong Answer
N,D = map(int, input().split())
print(N//(2*D+1))
# Judge status: Wrong Answer
#22 C - Guess The Number
N,M = map(int,input().split())

sc = []
for _ in range(M):
    s,c = map(int,input().split())
    sc.append((s,c))
sc = list(set(sc))

ans = [0]*N
for i, j in sc:
    if ans[i-1] != 0:
        result = -1
        break
    ans[i-1] = j
else:
    if ans[0] == 0:
        ans[0] = 1
    ans = [str(k) for k in ans]
    result = ''.join(ans)
if (1,0) in set(sc):
    result = -1
if N == 1 and M == 1 and sc == [(1,0)]:
    result = 0
print(result)
# Judge status: Wrong Answer
N=int(input())
ans=0
for i in range(1,N+1):
    if ans+i==N:
        print(i)
        break
    if N-(ans+i)>=i+1:
        print(i)
        ans+=i
    else:
        continue
# Judge status: Accepted
def main():
    c = input()
    abc = "abcdefghijklmnopqrstuvwxyz"
    idx = abc.index(c)
    print(abc[idx+1])

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
S = list(input())
N = len(S)
a = 0
b = 0
c = 0
for i in range(N):
  if S[i] == 'a':
    a += 1
  elif S[i] == 'b':
    b += 1
  else:
    c += 1
if min(a, b, c) == 0:
  if N < 3:
    ans = 'YES'
  else:
    ans = 'NO'
elif max(a, b, c) - min(a, b, c) < 2:
  ans = 'YES'
else:
  ans = 'NO'
print(ans)
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
for i in range(n):
    b=bin(A[i])
    A[i]=len(b)-b.rfind('1')-1
print(min(A))
# Judge status: Accepted
a, b, c = list(map(int, input().split()))
if b // a >= c:
    print(c)
else:
    print(b // a)
# Judge status: Accepted
a, b, c = map(int, input().split())
if (a == b and b == c and c == a) or (a != b and b != c and c != a):
    print("No")
else:
    print("Yes")
# Judge status: Accepted
from collections import Counter as Cnt
n=int(input())
s=[0]*n
for i in range(n):
    s[i]=input()
C=Cnt(s)

cnt = len(C.values())
print(cnt)
# Judge status: Accepted
K, A, B = map(int, input().split())
if A+2 > B:
  print(K+1)
else:
  print(A+max(0, (K-A+1)//2)*(B-A)+(K-A+1)%2)
# Judge status: Accepted
n,a,b=map(int,input().split())
c=(n//(a+b))*a
r=n%(a+b)
if r<=a:
  print(c+r)
else:
  print(c+a)
# Judge status: Accepted
n = int(input())

for a in range(-1000, 1000):
    for b in range(-1000, 1000):
        if a**5-b**5 == n:
            print(a, b)
            exit()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = b[a[0] - 1]
for i in range(1, n):
    ans += b[a[i] - 1]
    if a[i] - a[i - 1] == 1:
        ans += c[a[i - 1] - 1]
print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())

from math import factorial
mod =(10**9) + 7
# v_n = 1
# for i in range(1,n+1):
#     v_n*= i%mod
# v_m = 1
# for j in range(1,m+1):
#     v_m*= j%mod

v_n = factorial(n)
v_m = factorial(m)
if n==m:
    value = (v_n *v_m * 2)%mod
    print(value)

elif abs(n-m)>2:
    print(0)

else:
    ans = (v_n * v_m)%mod
    print(ans)
# Judge status: Wrong Answer
alf = {c:i for i,c in enumerate('abcdefghijklmnopqrstuvwxyz')}
a = 'abcdefghijklmnopqrstuvwxyz'
s = input()
k = int(input())
diff = [26-alf[c] for c in s]
ans = []
for i in range(len(s)):
    if k >= diff[i]:
        ans.append('a')
        k -= diff[i]
    else:
        ans.append(s[i])
if k > 0:
    ans[-1] = a[(alf[ans[-1]] + k % 26)]
print(''.join(ans))
# Judge status: Accepted
n = int(input())
word = [input() for _ in range(n)]
count=0
for i in range (0,n):
    for j in range (i+1,n):
        if (word[i] == word[j]):
            count += 1
for k in range (0,n-1):
    if (word[k][len(word[k])-1] != word[k+1][0]):
        count += 1
if (count == 0):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
H = int(input())

from collections import deque

d = deque([H])

count = 0
sm = 0
while 1:
    if H == 1:
        break

    H //= 2
    count += 1
    sm += 2**count

print(sm+1)
# Judge status: Wrong Answer
n=int(input())
Q=[1,2,3,4,5,6,7,8,9]
while(Q!=[] and n>1):
  a=Q.pop(0)
  n-=1;
  if(n>1):
    t=a%10
    Q.append(a*10+(t-1));
    Q.append(a*10+t);
    Q.append(a*10+(t+1));
a=Q.pop(0)
if(a<3234566667):
  print(a)
else:
  print(3234566667)
# Judge status: Wrong Answer
import sys 

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


if N == 1:
    print(A[0])
    sys.exit()

mae = []
usiro = []

#0の時に前 1の時に後ろ
Flag = 0

for i in reversed(range(0,N,1)):
    
    if Flag == 0: # 前の時
        mae.append(str(A[i]))
        Flag = 1
    else:
        usiro.insert(0,str(A[i]))
        Flag = 0

moziretu = (mae + usiro)
moziretu = ''.join(moziretu)
print(' '.join(moziretu))
# Judge status: Accepted
answer = ""
num = int(input())
j = 0
while(num > 0):
    j = num % 26
    num = num // 26
    if j == 0:
        answer += 'z'
        num -= 1
    else:
        answer += chr(96+j)

print(answer[::-1])
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
ball = [0] * N

def divisors(n):
  for i in range(1, min(n + 1,int(n ** 0.5) + 2)):
    if n % i == 0:
      ball[i - 1] += 1
  if n > 2:
    ball[n - 1] += 1

for i in range(N - 1,-1,-1):
  if A[i] != (ball[i] % 2):
    divisors(i + 1)

if sum(ball) == 0:
  print(0)
else:
  ball = [i + 1 for i in range(N) if ball[i] >= 1]
  print(len(ball))
  print(*ball)
# Judge status: Accepted
S = input()
C = S.count("hi")
if len(S) == C * 2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from fractions import Fraction
N=int(input())
S=list(input())
T=list(input())

for i in range(N):
    if S[i:]==T[:N-i]:
        print(N+i)
        exit()
print(N*2)
# Judge status: Wrong Answer
N,M = map(int,input().split())
MAX = int(M**(1/2))
for i in range(MAX,0,-1):
    if M % i == 0:
        if M // i >= N:
            print(i)
            break
# Judge status: Accepted
from collections import defaultdict

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

dic = defaultdict(int)

for i in range(N):
    dic[(i + 1) - A[i]] += 1

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

print (ans)
# Judge status: Wrong Answer
N,M,Q = map(int,input().split())
ABCD = [list(map(int,input().split())) for _ in [0]*Q]

A = [1]*N
ans = 0
while A[0] == 1:
    A[N-1] += 1
    tmp = 0
    for a,b,c,d in ABCD:
        if A[b-1]-A[a-1]==c: tmp += d
    ans = max(ans,tmp)
    for i in range(N-1,-1,-1):
        if A[i]>=M:
            A[i-1] += 1
            for j in range(i,N):
                A[j] = A[i-1]
print(ans)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())

print(max(0,a-b-c))
# Judge status: Wrong Answer
a=input()
c=int(a)
b=0
if c%2!=0:
	b=b+1
if c%3!=0:
	b=b+1
if c%4!=0:
	b=b+1
if c%5!=0:
	b=b+1
if c%6!=0:
	b=b+1
if c%7!=0:
	b=b+1
if c%8!=0:
	b=b+1
if c%9!=0:
	b=b+1
if c<=81:
    if b<8:
        print("Yes")
    else:
      	print("No")
else:
    print("No")
# Judge status: Accepted
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]

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

if (b <= a):
    print("delicious")
elif (b <= x+a):
    print("safe")
else:
    print("dangerous")
# Judge status: Accepted
x=int(input())


for a in range(-200,200):
    for b in range(-200,200):
        if x == a**5-b**5:
            ans = [a,b]
            print(a,b)
            exit()
# Judge status: Accepted
from sys import stdin,stdout
from collections import defaultdict
import math
from bisect import bisect
input=stdin.readline
#def print(x):stdout.write(str(x)+'\n')
s=input().strip()
t=input().strip()
n=len(s)
m=len(t)
ans=m
for i in range(n-m+1):
    c=0
    for j in range(min(m,n)):
        if s[i+j]!=t[j]:
            c+=1
    ans=min(c,ans)
print(ans)
# Judge status: Accepted
n = int(input())
s = input()
r = s.count("R")
g = s.count("G")
b = s.count("B")
num = r*g*b
for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >=n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            num -=1
print(num)
# Judge status: Accepted
from math import pi

r = int(input())


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

if (a * b) % 2 == 0:
  print('Even')
else:
  print('Odd')
# Judge status: Wrong Answer
def gcd(n, m):
    if m == 0: return n
    return gcd(m , n%m)

def lcm(n, m): 
    g = gcd(n, m)
    return n * m // g

N, M = map(int, input().split())
A = list(map(int, input().split()))
res = 1
for i in range(0, N):
    res = lcm(res, A[i])

if res // 2 > M: print(0)
else: print((M + res//2 + res - 1) // res)
# Judge status: Wrong Answer
s= list(input())
t = list(input())
S = sorted(s)
T = sorted(t,reverse = True)
if "".join(S) > "".join(T):
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
import sys

x = int(input())

for i in range(x+1,int(1e5)):
    for j in range(2,x):
        if i % j == 0:
            break
        elif j == x-1:
            print(i)
            sys.exit()
# Judge status: Accepted
A1, A2, A3 = map(int,input().split())
if A1+A2+A3<=21:
    print("win")
else:
    print("bust")
# Judge status: Accepted
K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = (t * 10 + 7) % K
else:
    print(-1)
# Judge status: Accepted
n, q = map(int, input().split())

S = list(input())

A = [0]

for i in range(1, n+1):
    # if S[i-1:i]:
    if S[i-2:i] == ['A', 'C']:
        A.append(A[-1] + 1)
    else: 
        A.append(A[-1])
# print(A[1:])
A = A[1:]
for i in range(q):
    a, b = map(int, input().split())
    print(A[b-1] - A[a-1])
# Judge status: Accepted
n = int(input())
y = 0
if  n==2 or n==4 or n==5 or n== 7 or n==9:
    y =0
elif n==0 or n==1 or n==6 or n==8:
    y = 1
else:
    y = 2
 
f = n%10
if f==2 or f==4 or f==5 or f== 7 or f==9: 
    print('hon')
elif f==0 or f==1 or f==6 or f==8:
    print('pon')
else:
    print('bon')
# Judge status: Wrong Answer
n = int(input()) - 1
ans = n * (n + 1) / 2
print(int(ans))
# Judge status: Wrong Answer
s = input()

if s[-1] == 's':
	print(s)
else:
	print(s + 'es')
# Judge status: Accepted
from collections import defaultdict

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

dic = defaultdict(int)
for elem in a:
    dic[elem] += 1
    dic[elem - 1] += 1
    dic[elem + 1] += 1

#max valueを出力
print(max(dic.values()))
# Judge status: Accepted
def main():
    a, b, c, d = map(int, input().split())
    print(max(0, min(b, d) - max(a, c)))


if __name__ == '__main__':
    main()
# Judge status: Accepted
n,k,s=map(int,input().split())
if s==10**9:
  res=(str(s)+' ')*k+'1 '*(n-k)
else:
  res=(str(s)+' ')*k+(str(s+1)+' ')*(n-k)
print(res)
# Judge status: Wrong Answer
N,P = map(int,input().split())
A = list(map(int,input().split()))
if N==1:
    print(1)
else:
    n0=0
    n1=0
    for i in range(N):
        if A[i]%2==0:
            n0 += 1
    n1 = N-n0
    print(2**(n1-1)*2**n0)
# Judge status: Wrong Answer
N = int(input())
a = sorted(list(map(int,input().split())))[::-1]
s = set()
for k in range(1,N):
    if a[k-1] == a[k]:
        s.add(a[k])
if len(s) < 2:
    print(0)
else:
    s = sorted(list(s))
    print(s[-1]*s[-2])
# Judge status: Accepted
N, K = map(int,input().split())
hN = list(map(int,input().split()))
dp = [1000000000]*N
dp[0] = 0
for n in range(N-1):
  for k in range(min(K,N-n-1)):
    dp[n+k+1] = min(dp[n+k+1], dp[n]+abs(hN[n]-hN[n+k+1]))
print(dp[-1])
# Judge status: Wrong Answer
n=int(input())
P=list(map(int,input().split()))
cnt=0
for i in range(n-2):
    if list(set([P[i],P[i+1],P[i+2]]))[1]==P[i+1]:
        cnt+=1
print(cnt)