peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
A, B, C = map(int, input().split())
print(min(B//A, C))
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
ans=0
import bisect
l.sort()
for i in range(n-2):
    for j in range(i+1,n-1):
        tmp= bisect.bisect_left(l,l[i]+l[j])
        ans+=tmp-j-1
        
print(ans)
# Judge status: Accepted
from collections import Counter
w = input()
w_count = Counter(w)
if all(v%2==0 for v in w_count.values()):print('Yes')
else:print('No')
# Judge status: Accepted
N,M=map(int,input().split())
d=[list(map(int,input().split())) for i in range(M)]
s=[]
for i in range(M):
    s+=d[i]
for k in range(1,N+1):
    print(s.count(k))
# Judge status: Accepted
s = int(input())
a = 10**9
if s == 10**18:
    print(0, 0, a, 0, 0, a)
else:
    x3 = a-(s%a)
    y3 = (s+x3)//a
    print(0, 0, a, 1, x3, y3)
# Judge status: Accepted
N, M = map(int, input().split())

div = [(1, M), (M, 1)]
for i in range(2, int(M ** 0.5) + 1):
    if M % i == 0:
        div.append((i, M // i))
        if i * i != M:
            div.append((M // i, i))

ans = 1
for num, cnt in div:
    if cnt >= N:
        ans = max(ans, num)

print(ans)
# Judge status: Accepted
time = list(map(int,input().split()))
time.sort()
print(sum(time[0:2]))
# Judge status: Accepted
N=int(input())

if N%9==0:
    print("Yes")
else:
        print("No")
# Judge status: Wrong Answer
import numpy as np
n=input().split()
A=int(n[0])
B=int(n[1])
C=int(n[2])
D=int(n[3])
a = np.array([1,0,-1])
b = np.array([A,D-A,D-A-B])
c = np.array([0,B,D-B])
if A>=1:
    print(sum(a*b))

if A==0 and B==0:
    print("-1")  

if A==0 and B>=1:
    print(sum(a*c))
# Judge status: Accepted
p,q,r=map(int,input().split())
print(min(p+q,p+r,q+r))
# Judge status: Accepted
sx,sy,tx,ty=map(int,input().split())
for _ in range(ty-sy): print("U",end="")
for _ in range(tx-sx): print("R",end="")
for _ in range(ty-sy): print("D",end="")
for _ in range(tx-sx+1): print("L",end="")
for _ in range(ty-sy+1): print("U",end="")
for _ in range(tx-sx+1): print("R",end="")
print("DR",end="")
for _ in range(ty-sy+1): print("D",end="")
for _ in range(tx-sx+1): print("L",end="")
print("U")
# Judge status: Accepted
s = input()
t = input()
n = len(s)
x = []
y = []

for i in range(n):
    if s[i] not in x:
        x.append(s[i])
    if t[i] not in y:
        y.append(t[i])

for i in range(len(x)):
    s = s.replace(x[i], str(i))
for i in range(len(y)):
    t = t.replace(y[i], str(i))
print('Yes' if s == t else 'No')
# Judge status: Accepted
S=input()
T=input()
S=S+S
if T in S:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
fac = {}
for i in range(2,10**6):
  if n % i == 0:
    fac[i] = 0
    while n % i == 0:
      fac[i] += 1
      n //= i
if n != 1:
  fac[n] = 1
#print(fac)
jud = [1]
for i in range(10**6):
  jud.append(jud[-1]+i+2)
#print(jud)
ans = 0
for k in fac:
  num = fac[k]
  for i in range(10**6):
    if num >= jud[i]:
      ans += 1
    else:
      break
print(ans)
# Judge status: Accepted
N, L = map(int, input().split())
P = [input() for i in range(N)]
P.sort()
ret = ''
for t in P:
  ret += str(t)
print(ret)
# Judge status: Accepted
print("Yes" if int(input())>=30 else "No")
# Judge status: Wrong Answer
import math

N, K = map(int, input().split())
A_list = list(map(int, input().split()))

pos_1 = 0 
for i in range(N):
    if A_list[i] == 1:
        pos_1 = i

ans1 = math.ceil((pos_1)/(K-1)) + math.ceil((N-1-pos_1)/(K-1))
ans2 = math.ceil((pos_1-1)/(K-1)) + math.ceil((N-1-pos_1+1)/(K-1))
ans3 = math.ceil((pos_1+1)/(K-1)) + math.ceil((N-1-pos_1-1)/(K-1))
print(min(ans1, ans2, ans3))
# Judge status: Accepted
import math
a, b = map(int, input().split())
print(math.ceil((a + b)/2))
# Judge status: Wrong Answer
n = int(input())
l = list(map(int,input().split()))
l1 = [0,0]
from collections import Counter
c = Counter(l)
for i in c.items():
  if i[1]>=2 :
    l1.append(i[0])
l1.sort()
print(l1[-1]*l1[-2])
# Judge status: Wrong Answer
import copy
N=int(input())
a=input().split(' ')
suji = []
for j in range(len(a)):
    suji.append(int(a[j]))
#for i in range(len(a)):
  #suji.append(int(a[i]))
for i in range(N):
    c = copy.copy(suji)
    if c.count(i > 0):
        c.remove(i)
        
   
    aiueo = (len(c) + 1) // 2-1
    print(sorted(c)[(len(c) + 1) // 2-1])
# Judge status: Wrong Answer
S=input()
T=input()

for i in range(len(S)):
    S=S[-1]+S[:-1]
    if T==S:
        print('Yes')
        exit()
    print(S)
print('No')
# Judge status: Wrong Answer
s, t = input().split()

print(s + t)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**6)

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

import math

neck = min(a2e)

ans = 5

t_neck = math.ceil(n/neck)

ans += t_neck-1

print(ans)
# Judge status: Wrong Answer
import math
from functools import reduce

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


x=int(input())
sum=0
l=0
k=0
h=1

for l in range(x):
  l=l+1
  for k in range(x):
    k=k+1
    for h in range(x):
      sum=sum+gcd(l,k,h)
      h=h+1
print(sum)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())

from collections import Counter
c = Counter(As)

area = 0
for n, c in sorted(c.most_common())[::-1]:
    if c<2:
        pass
    elif c>=4:
        area = max(area*n, n**2)
        break
    else:
        if area:
            area = area*n
            break
        else:
            area = n

print(area)
# Judge status: Accepted
from collections import Counter
#入力
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
#blue n (str s)
# red m (str t)
sc = Counter(s)
tc = Counter(t)
u = list(set(s + t))
maxcnt = 0
for i in range(len(u)):
	cnt = 0
	cnt += sc[u[i]]
	cnt -= tc[u[i]]
	if cnt >= maxcnt:
		maxcnt = cnt
print(maxcnt)
# Judge status: Accepted
n = int(input())
n %= 1000
if n == 0:
    print(0)
else:
    print(1000 - n)
# Judge status: Accepted
N=int(input())
W=list(input() for i in range(N))

for i in range(N-1):
	if W.count(W[i]) == 2:
		print("No")
		break
	if W[i][-1] != W[i+1][0]:
		print("No")
		break
else:
	print("Yes")
# Judge status: Accepted
from collections import defaultdict
N = int(input())
A = list(map(int,(input().split())))
c = defaultdict(lambda:0)
for i in range(1,10**5+1):
    c[i]
for i in A:
    c[i] += 1
l = list(c.items())
l.sort()
p = []
for i in range(0,10**5-2):
    p.append(l[i][1]+l[i+1][1]+l[i+2][1])
print(max(p))
# Judge status: Accepted
import numpy as np
from numba import njit

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

@njit(cache=True)
def light(n,a_list):
    outcome= np.zeros(n+1, dtype=np.int64)
    for i in range(n):
        outcome[max(0,i-a_list[i])] += 1
        outcome[min(n,i+a_list[i]+1)] -= 1
    outcome = np.cumsum(outcome)[:-1]
    return outcome

for _ in range(k):
    if min(a) == n:
        break
    a = light(n,a)

[print(aa,end=' ') for aa in a]
# Judge status: Wrong Answer
x=int(input())
if x==3 or x==5 or x==7:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from decimal import Decimal
import math
n,d=map(int,input().split())
x=[]
ans=0
for i in range(n):
    x.append(list(map(int,input().split())))
for i in range(n-1):
    for j in range(i+1,n):
        tmp=0
        for k in range(d):
            tmp+=(x[i][k]-x[j][k])**2
        tt=math.sqrt(tmp)
        if tt==int(tt):
            ans+=1
print(ans)
# Judge status: Accepted
k,x = map(int,input().split())
ans = k*500

if x>ans:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
import sys
from collections import Counter
n,k = map(int,input().split())
a = list(map(int,input().split()))
counter = Counter(a)
cnt = 0

c_value= list(counter.values())
nl = len(c_value)
if nl <= k:
  print(0)
  sys.exit()
  
c_value.sort()
#print(c_value)
do_num = nl - k
for i in range(do_num):
  cnt += c_value[i]
print(cnt)
# Judge status: Accepted
n = int(input())
t = [False]*(n+1)
t[0] = True
l = [int(i) for i in input().split()]
ans = 0
for i in range(n):
  x = l[i]
  if t[x-1]:
    t[x] = True
    ans = max(ans, x)
print(n-ans if ans > 0 else -1)
# Judge status: Accepted
N = int(input())

lst = [1, 6, 9, 6**2, 9**2, 6**3, 9**3, 6**4, 9**4, 6**5, 6**6, 9**5]
dp = [N+1] * (N+1)
dp[0] = 0
for i in range(1, N+1):
    for j in lst:
        if j <= i:
            # print(i, j, i-j)
            dp[i] = min(dp[i], dp[i-j]+1)
print(dp[-1])
# Judge status: Wrong Answer
n = int(input())
answer = 0
for i in range(1, n + 1):
    if i % 3 and i % 5:
        answer += i
        print(i)
print(answer)
# Judge status: Accepted
X,Y=map(int,input().split())

def cmb(n,k):
    x,y=1,1
    for i in range(k):
        x = x * (n-i)%mod
        y = y * (k-i)%mod
    return x*pow(y,mod-2,mod)%mod

if (X+Y)%3!=0:
    print(0)
else:
    m=(2*X-Y)//3
    n=(2*Y-X)//3
    if n<0 or m<0:
        print(0)
    else:
        mod=10**9+7
        ans=cmb(n+m,min(n,m))
        print(ans)
# Judge status: Wrong Answer
N=int(input())
n=input()
l=0;r=0
for i in n:
    if i=="(":
        r+=1
    else:
        if r:
            r-=1
        else:
            l+=1
print("("*r+n+")"*l)
# Judge status: Accepted
x, y = map(int, input().split())

ans = float("inf")

if y >= x:
    ans = min(ans, y - x)

if y >= x * -1:
    ans = min(ans, y - x * -1 + 1)

if y * -1 >= x:
    ans = min(ans, y * (-1) - x + 1)

if y * -1 >= -1 * x:
    ans = min(ans, y * -1 - x * -1 + 2)

print(ans)
# Judge status: Accepted
n,a,b=map(int,input().split())
s=list(input())
count=0
cnt=0
for i in range(n):
  if(cnt>=a+b):
    print("No")
  else:
    if(s[i]=="a"):
      print("Yes")
      cnt+=1
    elif(s[i]=="b"):
      if(count<b):
        print("Yes")
        count+=1
        cnt+=1
      else:
        print("No")
    else:
      print("No")
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x, y = map(int, readline().split())

l = []
while x <= y:
    l.append(x)
    x *= 2

print(len(l))
# Judge status: Accepted
s = input()
print('Yes' if s[2]==s[3] and s[4]==s[5] else 'No')
# Judge status: Wrong Answer
X,Y,Z = map(int,input().split())
cnt = 0

while X-1 >= Z+Y:
    X -= Z+Y
    cnt += 1
print(cnt)
# Judge status: Wrong Answer
A, B, K = map(int, input().split())

if A == 0 and B == 0:
    print(0, 0)
elif A > K:
    print(A-K, B)
else:
    print(0, B-(K-A))
# Judge status: Wrong Answer
import itertools
import math
import fractions
import functools
import copy
from collections import deque

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

a = [-1]*n
d = deque([0])
while d:
    f = d.popleft()
    for i in g[f]:
        if a[i] == -1:
            a[i] = f
            d.append(i)

print("Yes")
for i in range(1,n):
    print(a[i]+1)
# Judge status: Accepted
l = input().split()
print(l[2], l[0], l[1])
# Judge status: Wrong Answer
A, V = map(int,input().split())
B, W = map(int,input().split())
T = int(input())

A *= 10**9
B *= 10**9
if B - A <= 0:
    print("YES")
else:
    if (V-W) * T >= B - A:
        print("YES")
    else:
        print("NO")
# Judge status: Wrong Answer
N=int(input())
p=list(map(int,input().split()))
swap=[0,0]
cnt=0
for i in range(N):
    if (p[i]==i+1):
        if swap[0]==0:
            swap[0]=i+1
        else:
            swap[1]=i+1
            #print(swap)
            cnt=cnt+(swap[1]-swap[0])
            swap=[0,0]
print(cnt)
# Judge status: Accepted
X = int(input())
ans = 0

a_i = 0
n = 1
while a_i < X:
    a_i = a_i + n
    ans = n
    n += 1

print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
if a+b>=c:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N,M = map(int, input().split())
li = [0 for i in range(N)]
for i in range(M):
    x,y = map(int, input().split())
    li[x-1] += 1
    li[y-1] += 1
for i in range(N):
    print(li[i])
# Judge status: Accepted
N,K = (int(X) for X in input().split())
A  = [int(X) for X in input().split()]
Left  = A.index(1)
Right = (N-1)-Left
Count = (Right%(K-1)!=0)+Right//(K-1)
Left  -= (Right%(K-1)!=0)*((K-1)-Right%(K-1))
Count += (Left%(K-1)!=0)+Left//(K-1)
print(Count)
# Judge status: Wrong Answer
N = int(input())
P = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
    a, b = P[i], P[i + 1]
    if a == i + 1:
        ans += 1
        P[i] = b
        P[i + 1] = a
print(ans)
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
l = list(l[i]-i for i in range(n))
import statistics as st
m = int(st.median(l))
print(sum(abs(m-i) for i in l))
# Judge status: Wrong Answer
from heapq import heappush, heappop
N = int(input())
H = []
for _ in range(N):
    A, B = map(int,input().split())
    heappush(H, (B - A, A))
t = 0
for _ in range(N):
    S, A = heappop(H)
    if S < t:
        print("No")
        break
    t += A
    if len(H) == 0:
        print("Yes")
# Judge status: Wrong Answer
a, b, c = map(int,input().split())
if a == b:
    if a == c:
        print(1)
    elif a != c:
        print(2)
        
elif a != b:
    if a == c:
        print(2)
    elif a != c:
        print(3)
        
    elif b == c:
        print(2)
# Judge status: Accepted

n = int(input());

print(n + n**2 + n**3)
# Judge status: Wrong Answer
a, b = map(int, input().split())
s = min(a, b)
cnt = 0

for i in range (s+1):
  if i < a and i < b:
    cnt += 1
print(cnt)
# Judge status: Accepted
N = int(input())
S = input()
FLG = False

if N % 2 == 0:
    if S[:int(N/2)]*2 == S:
        FLG = True

if FLG:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = input()
cnt = 0
for i in N:
	cnt += int(i)
print("Yes" if cnt % 9== 0 else "No")
# Judge status: Accepted
S=input()
if S<="2019/04/30":
    print("Heisei")
else:
    print("TBD")
# Judge status: Accepted
def display():
    s = input()
    out = []
    final = ''

    for i in range(len(s)):
        key = s[i]

        if key == '0':
            out.append('0')
        if key == '1':
            out.append('1')
        if key == 'B':
            if len(out) > 0:
                out.pop()
        
    for i in range(len(out)):
        final = final + out[i]
    
    print(final)

            

display()
# Judge status: Wrong Answer
n = int(input())
ans =1

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


for i in a:
    ans *= i

if(ans>0**18):
    print(-1)
else:
    print(ans)
# Judge status: Wrong Answer
n, d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]
count = 0
for i in range(n - 1):
  total = 0
  for now_, next_ in zip(x[i], x[i+1]):
    total += abs(now_ - next_) ** 2
  
  for j in range(total + 1):
    if j ** 2 == total:
      count += 1
print(count)
# Judge status: Accepted
import fractions
n=int(input())
ans=int(input())
for i in range(n-1):
  t=int(input())
  ans=(ans*t)//fractions.gcd(t,ans)
print(ans)
# Judge status: Accepted
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
    cnt = 0
    i = str(i)
    for j in i:
        cnt += int(j)
    if cnt >= A and cnt <= B:
        ans += int(i)
print(ans)
# Judge status: Wrong Answer
a=input()
b=sorted(a)
if b[0]==b[1] and b[2]==b[3]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())

ans = 0
for i in range(1, n):
    ans += (n-1)//i

print(ans)
# Judge status: Accepted
s = input()
k = 'keyence'
k_size = len(k)
d_size = len(s) - k_size

result = "NO"
for i in range(k_size):
    t = s[:i] + s[i+d_size:]
    if t == k:
        result = "YES"
        break
print(result)
# Judge status: Accepted
k = int(input())

r = 0.01
s = 100
n = 5
i = 0
while True:
  if k <= s:
    break
  else:
    s = int(s * (1 + r))
    i = i + 1
print(i)
# Judge status: Wrong Answer
a,b,x=map(int,input().split())
if a+b < x and a < x:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
S = list(input())

if S[5] == '1':
    print('TBD')

elif S[6] == '1' or '2' or '3' or '4':
    print('Heisei')
else:
    print('TBD')
# Judge status: Accepted
n, m = map(int, input().split())
if abs(n - m) > 1:
    print(0)
else:
    ret1 = 1
    for i in range(1, n + 1):
        ret1 = (ret1 * i) % 1000000007
    ret2 = 1
    for i in range(1, m + 1):
        ret2 = (ret2 * i) % 1000000007
    print((ret1 * ret2 * (2 if n == m else 1)) % 1000000007)
# Judge status: Wrong Answer
import sys
x,y = map(int,input().split())
cnt = 1
for i in range(1,60):
  if x*2 <= y:
    cnt += 1
    x *= 2
  else:
    print(cnt)
    sys.exit()
# Judge status: Wrong Answer
n,m = map(int,input().split())
ans = list()
sc_list = [list(map(str,input().split())) for _ in range(m)]
if n == 0:
    j = 0
else:
    j = 10 ** n
for k in range(j,10 ** n):
    st = str(i)
    for s,c in sc_list:
        if st[s] != c:
            break
    else:
        print(st)
        exit()
else:
    print('-1')
# Judge status: Accepted
N, M = map(int, input().split())
v = M - N * 2
# print('v', v)
if v <= 0:
    print(M // 2)
    exit()
ans = N + v // 4
print(ans)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-

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

print((a+b)/2 if (a+b)%2==0 else 'IMPOSSIBLE')
# Judge status: Wrong Answer
def get_gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

def get_lcm(a, b):
    return a * b // get_gcd(a, b)


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

B = A[0]

if sum([a % 2 != 0 for a in A]) > 0:
    print(0)
else:
    for b in A[1:]:
        pass
        # B = get_lcm(B, b)
    print(max(0, int((M + 0.5 * B) // B)))
# Judge status: Accepted
from collections import Counter
_=input()
s=input()
s=Counter(s)
ans=1
for i in s.values():
    ans=(ans*(i+1))%(10**9+7)
print(ans-1)
# Judge status: Wrong Answer
import sys
from bisect import bisect_right
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A = list(int(readline()) for _ in range(N))

    LIS = [INF]*N
    A.reverse()
    for a in A:
        i = bisect_right(LIS,a)
        LIS[i] = a
    print(bisect_right(LIS, INF))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

a,b,x = map(int,input().split())
ab = a+b
if x>=a and x<ab:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x,y = map(int,input().split())

print(x + int(y/2))
# Judge status: Accepted
N,R=map(int,input().split())
if(N>=10):print(R)
else:print(R+100*(10-N))
# Judge status: Accepted
N,K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
if sum(A)>=N:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
A = [int(i) for i in input().split()]
sorted_A = sorted(A, reverse=True)

print(sum(sorted_A[1:2*N:2]))
# Judge status: Wrong Answer
import math as m
r=int(input())
print(m.pi*r*r)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

while b <= a:
    c -= 1
    b += 1

print(c)
# Judge status: Accepted
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
n  = int(input())
#  = map(int, input().split())
l  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
c = collections.Counter(l)

cmc = c.most_common()

if cmc[0][1] == 1 or len(cmc) == 1:
    print(0)
else:
    cmc = sorted(cmc)[::-1]
    cmc = [(k, v) for k, v in cmc if v >= 2]
    print(cmc[0][0] * (cmc[0][0] if cmc[0][1] >= 4 else cmc[1][0]))
# Judge status: Accepted
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
A = lr()
BC = [lr() for _ in range(M)]
BC.sort(key=lambda x: x[1], reverse=True)
D = []
count = 0
for b, c in BC:
    x = [c] * b
    D.extend(x)
    count += b
    if count >= N:
        break

E = A + D
E.sort(reverse=True)
answer = sum(E[:N])
print(answer)
# Judge status: Accepted
n,c,k=map(int,input().split())
t=[int(input()) for i in range(n)]
t=sorted(t)
time=t[0]
cnt=0
ans=0
for i in range(n):
    #制限時間以内かつC人以内
    if time+k>=t[i] and cnt<=c-1:
        cnt+=1

    else:
        ans+=1
        time=t[i]
        cnt=1
print(ans+1)
# Judge status: Wrong Answer
import math
A,B = list(map(float, input().split()))
print(int(A*int(B*100)/100))
# Judge status: Accepted
n, k = map(int, input().split())
X = list(map(int, input().split()))
ans = 10 ** 9
for i in range(n - k + 1):
  if X[i] * X[i + k - 1] < 0:
    dup = min(abs(X[i]), abs(X[i + k - 1])) * 2
    sgl = max(abs(X[i]), abs(X[i + k - 1]))
    dist = dup + sgl
  else:
    dist = max(abs(X[i]), abs(X[i + k - 1]))
  ans = min(ans, dist)
print(ans)
# Judge status: Accepted
s = input()
n = len(s)
if n % 2:
    print('No')
    exit()

for i in range(0,n-1,2):
    if s[i:i+2] != 'hi':
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
n = int(input())
s = []
while n!=0:
    if n<=26:
        s.append(n)
        n = 0
    else:
        x = n % 26
        #余りが0の場合には26にする
        if not x:
            x = 26
        s.append(x)
        n = (n - 1) // 26
t = []
#求めた順番とは逆に並べる
for i in range(len(s)-1,-1,-1):
    t.append(chr(s[i]+96))
print(''.join(t))
# Judge status: Accepted
n,p = map(int,input().split())
a = [int(i) for i in input().split()]
if all([i%2 == 0 for i in a]):
  if p == 1:
    print(0)
  else:
    print(pow(2,n))
else:
  print(pow(2,n-1))
# Judge status: Accepted
S = input()
zero = S.count("0")
one = S.count("1")
print(min(zero,one)*2)
# Judge status: Accepted
K = int(input())

x = 7%K

for i in range(K):
    if x == 0:
        print(i+1)
        exit()
    x = (x*10+7)%K
print(-1)
# Judge status: Accepted
n = int(input())
li = list(map(int, input().split()))
ans = 0
for i in range(len(li)-2):
  for j in range(i+1,len(li)-1):
    for k in range(j+1,len(li)):
      a = li[i]
      b = li[j]
      c = li[k]
      if a==b or b==c or c==a:
        continue
      if a+b>c and b+c>a and c+a>b:
        ans += 1
print(ans)
# Judge status: Wrong Answer
"""
1. The initial character of S is an uppercase A.
2. There is exactly one occurrence of C between the third character from the beginning and the second to last character (inclusive).
3. All letters except the A and C mentioned above are lowercase.
"""
import collections
def a(r): return r[0] == 'A'
def b(r): return collections.Counter(r[1:-2])['C'] == 1
def c(r): return all([l in set(['A', 'C']) or l.lower() ==l for l in r ])
def f(r):  return a(r) and b(r) and c(r)

print 'AC' if f(raw_input()) else 'WA'
# Judge status: Accepted
N = int(input())
S = input()

if N%2==0:
  if S[:int(N/2)] == S[int(N/2):]:
    print('Yes')
  else:
    print('No')
else:
  print('No')
# Judge status: Accepted
S=input()
right=[0]*(len(S)+1)
for i in range(len(S)):
    if S[i]=="<":
        right[i+1]=right[i]+1
left=[0]*(len(S)+1)
for i in range(len(S)-1,-1,-1):
    if S[i]==">":
        left[i]=left[i+1]+1
total=0
for i in range(len(S)+1):
    total+=max(right[i],left[i])
print(total)
# Judge status: Wrong Answer
[n,m] = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
#table = [[0]*n for i in range(n)]
ls = [1] * n
for i in range(m):
    [a,b] = [int(j)-1 for j in input().split()]
    if h[a] < h[b]:
        ls[a] = 0
    else:
        ls[b] = 0
print(sum(ls))
#print(ls)
# Judge status: Accepted
from statistics import median

N = int(input())
A = [0] * N
B = [0] * N
max=0
min =0
for c in range(N):
    A[c], B[c] = map(int, input().split())

med_A = median(A)
med_B = median(B)

if N%2==0:
    print(int((med_B-med_A)*2+1))
else:
    print(med_B-med_A+1)
# Judge status: Accepted
def main():
    n, k = map(int, input().split())
    a_lst = list(map(int, input().split()))

    tmp = k
    count = 1
    while tmp < n:
        tmp += k - 1
        count += 1

    print(count)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())

x = 10**N - 2*(9**N) + 8**N
print(x % (10**9+7))
# Judge status: Accepted
a,b,c=sorted(map(int,input().split()))
print("Yes" if a+b==c else  "No")