peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from itertools import accumulate

N, K = list(map(int, input().split()))
P = list(map(lambda x: int(x) + 1, input().split()))
P_cumsum = [0] + list(accumulate(P))
print(max([P_cumsum[i+K]-P_cumsum[i] for i in range(N-K+1)])/2)
# Judge status: Accepted
def main():
    n, m = [int(i) for i in input().split()]
    a = [int(i) for i in input().split()]
    
    bc = []
    for _ in range(m):
        b, c = map(int, input().split())
        bc.append((b, c))

    total = 0
    for num, v in sorted(bc, key=lambda x: -x[1]):
        total += num
        a.extend([v]*num)
        if total >= n:
            break
    print(sum(sorted(a)[-n:]))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
A = sorted(list(map(int, input().split())))
if all(a % 2 == 0 for a in A):
	print(0)
else:
	print(A[0] * A[1])
# Judge status: Accepted
n=int(input())
cnt=0
i=1
while i<=n:
  c=0
  for j in range(1,i+1):
    if i%j==0:
      c+=1
  if c==8:
    cnt+=1
  i+=2
print(cnt)
# Judge status: Accepted
n = int(input())
n1 = n
pn = []
cnt = 2
ans = 0
while cnt <= int(n ** 0.5):
    while n1 % cnt == 0:
        n1 = n1 // cnt
        pn.append(cnt)
    cnt += 1
pns = list(set(pn))
ansa = []
for i in pns:
    ansa.append(pn.count(i))
for i in ansa:
    x = 1
    while i > 0:
        i -= x
        if i < 0:
            break
        x += 1
        ans += 1
print(ans + 1 if n1 != 1 else ans)
# Judge status: Accepted
a,b,c=map(int,input().split())
e=a-b|b-c
print((e!=b&1)*len(f'{e&-e:b}')-1)
# Judge status: Accepted
N = int(input())
if N%2==1:
  print(0);exit()
  
x=10
ans=0
while x<=N:
  ans+=N//x
  x*=5
print(ans)
# Judge status: Wrong Answer
N = int(input())
X = list(map(int,input().split()))

sor = sorted(X)
l = sor[N//2-1]
r = sor[N//2]

print(l,r)
for i in range(0,N,1):
    print(l if X[i]>=r else r)
# Judge status: Accepted
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()

f = [0] * 1000005
for v in a:
    f[v] += 1
for i in range(1000000, 0, -1):
    if f[i] == 0:
        continue
    j = i*2
    while j <= 1000000:
        f[j] += f[i]
        j += i
ct = 0
for v in a:
    if f[v] == 1:
        ct += 1
print(ct)
# Judge status: Accepted
N,T=map(int,input().split())

CT=[[0,0]]*N
i=0
while i<N:
    CT[i]=list(map(int,input().split()))
    i+=1

CT=sorted(CT)

ans='TLE'
for x,y in CT:
    if y<=T:
        ans=x
        break
print(ans)
# Judge status: Accepted
from statistics import median
n=int(input())
A=list(map(int,input().split()))

B=[A[i]-(i+1) for i in range(n)]
middle=median(B)

ans=0
for i in range(n):
    ans +=abs(A[i]-(middle+i+1))

print(int(ans))
# Judge status: Wrong Answer
N = int(input())
if N == 1:
    print("1.0000000000")
elif N % 2 == 0:
    print("0.5000000000")
else:
    print("0.4000000000")
# Judge status: Wrong Answer
A, B, C = map(int, input().split())

if A == B:
    if C == A or C == B:
        print('No')
    else:
        print('Yes')
if B == C:
    if A == B or A == C:
        print('No')
    else:
        print('Yes')
if C == A:
    if B == A or B == C:
        print('No')
    else:
        print('Yes')
else:
    print('No')
# Judge status: Accepted
S = input()
ans = 0
n = len(S)
for i in range(n):
    for j in range(i, n):
        if all('ACGT'.count(c) == 1 for c in S[i:j+1]):
            ans = max(ans, j+1-i)
print(ans)
# Judge status: Accepted
def main():
    a=[]
    for s in input():
        if s == "B":
            if len(a) > 0:
                a.pop()
        else:
            a.append(s)
    print("".join(a))
    pass

if __name__ == "__main__":
    main()
# Judge status: Accepted
import math
from functools import reduce
_=input()
print(reduce(math.gcd,map(int,input().split())))
# Judge status: Wrong Answer
N = int(input())
v = sorted(list(map(int,input().split())))

print((sum(v[:-1])/(N-1)+v[-1])/2)
# Judge status: Accepted
#a,bの最大公約数
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

#a,bの最小公倍数
def lcm(a, b):
	return a * b // gcd (a, b)


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

l = a[0]
for e in a:
    l = lcm(l,e)

a_sum = 0
for e in a:
    a_sum = (a_sum + pow(e,mod-2,mod))%mod

print((l%mod)*a_sum%mod)
# Judge status: Wrong Answer
n, m = map(int, input().split())
if n == 1:
    ans = m - 2
elif m == 1:
    ans = n - 2
else:
    ans = (n - 2) * (m - 2)
print(ans)
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = list(map(int, input().split()))
B, C = [0]*M, [0]*M
result = 0
for i in range(M):
    B[i], C[i] = map(int, input().split())
    A.extend([C[i]]*B[i])
A.sort(reverse=True)
print(A)
for i in range(N):
    result += A[i]
print(result)
# Judge status: Wrong Answer
x,a,b = map(int,input().split())
if abs(x-a) > abs(x-b):
  print('A')
else:
  print('B')
# Judge status: Accepted
from math import *
h = int(input())
w = int(input())
n = int(input())
print(ceil(n / max(h, w)))
# Judge status: Accepted
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
A = list(map(int,input().split()))

A.sort()
print("Yes" if A[0]+A[1]==A[2] else "No")
# Judge status: Accepted
s=list(input())
k=int(input())

for i in range(len(s)):
    if k==0:break

    num=ord(s[i])
    ch_num=123-num
    if i==len(s)-1:
        s[i]=chr(97+(num+k-97)%26) #if num+k>122 else chr(num+k)
        #print(97+(num+k-97)%26)
        k=0
        break
    elif s[i]=='a':continue
    elif ch_num<=k:
        s[i]='a'
        k-=ch_num
print(''.join(s))
# Judge status: Accepted
a,b=map(int,input().split())
print("Even" if (a*b)%2 == 0 else "Odd" )
# Judge status: Wrong Answer
n, k = map(int, input().split())

print((n % k + n // k) - n // k)
# Judge status: Accepted
N = int(input())
*A, = map(int,input().split())
ans = [0]*N
for a in A:
    a -=1
    ans[a] += 1
for out in ans:
    print(out)
# Judge status: Accepted
import math
import numpy as np

N = int(input())
ans = 0
num_mat = np.zeros((9, 9))
for i in range(N+1):
  head = int(list(str(i))[0])
  tail = int(list(str(i))[-1])
  rev = ''.join(list(str(i))[::-1])
  if tail==0:
    continue
  num_mat[head-1, tail-1] += 1

for i in range(9):
  for j in range(i+1):
    if i==j:
      num = num_mat[i,j]
      ans += num + num * (num-1)
    else:
      ans += num_mat[i,j] * num_mat[j,i] * 2

print(int(ans))
# Judge status: Wrong Answer
X = int(input())
default = 100

year = 1
while True:
    default = default + round(1 % default)
    if default == X:
        print(year)
        break
    year += 1
# Judge status: Accepted
def main():
    ab = [_x for _x in input().split()]
    n = ab[1]
    bb = (int(n[0])*100 + int(n[2])*10 + int(n[3]))
    aa = int(ab[0])
    if aa == 0:
        print(0)
        return
    if bb == 0:
        print(0)
        return
    result = str(aa*bb)

    if len(result) <= 2:
        print(0)
    else:
        print(str(result)[:-2])


main()
# Judge status: Wrong Answer
n=int(input())
c=[list(map(int,input().split())) for _ in range(n)]
a=[i[0] for i in c]
b=[i[1] for i in c]
a.sort()
b.sort()
if n%2==0:
    print(b[n//2]-a[n//2-1]-b[n//2-1]+a[n//2]+1)
else:
    print(b[n//2]-a[n//2]+1)
# Judge status: Wrong Answer
def main():
    n = int(input())
    A=[int(i) for i in input().split()]
    res = 0
    for i in range(1,n,2):
        if(A[i]%2==1):
            res+=1
    print(res)

if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input(""))
ans = int(N/1.08)-1
f = 0
while ans < (N/1.08)+1:
    if int(ans*1.08) == N:
        print(ans)
        f += 1
    ans += 1
if f == 0:
    print(":(")
# Judge status: Accepted
N = int(input())
S = input()
ans=""
for i in range(len(S)):
    ans += chr((ord(S[i])+N+13)%26+52+13)
print(ans)
# Judge status: Wrong Answer
N, A, B, C, D = map(int, input().split())
S = list(input())

for i in range(A, max(C, D)):
    if S[i-1:i+1] == '##':
        print('No')
        exit(0)

if C < D:
    print('Yes')
    exit(0)

for i in range(B-1, D):
    if S[i-1:i+2] == '...':
        print('Yes')
        exit(0)
print('No')
# Judge status: Accepted
daw = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
S = input()
idx = daw.index(S)
print(7 - idx)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
"""
Created on Sat May  9 23:33:40 2020

@author: shinba
"""

q,h,s,d = map(int,input().split())

n = int(input())

a = [4*q,2*h,s,d/2]

a.sort()

if a[0] != d/2:
    print(int(n*a[0]))

else:
    if n % 2 == 0:
        print(int(n*a[0]))
    else:
        print(int((n-1)*a[0])+int(a[1]))
# Judge status: Accepted
x=int(input())
if(x==1):
  print(0)
else:
  print(1)
# Judge status: Wrong Answer
a,b = map(int, input().split())

if (a+b)%2 == 0:
    print((a+b)/2)
else:
    print("IMPOSSIBLE")
# Judge status: Accepted
X,K,D = map(int,input().split())
if X > 0:
  if X // D >= K:
    ans = X - D*K
  else:
    K -= X//D
    X = X%D
    if K%2 == 0:
      ans = X
    else:
      ans = abs(X -D)
if X < 0:
  if -1*X // D >= K:
    ans = abs(X + D*K)
  else:
    K -= (-1*X)//D
    X = (-1*X)%D
    if K%2 == 0:
      ans = X
    else:
      ans = abs(X -D)
if X == 0:
  if K%2==0:
    ans = 0
  else:
    ans = D
print(ans)
# Judge status: Wrong Answer
sx, sy, tx, ty = map(int, input().split())
ver = ty - sy
hor = tx - sx
go1 = 'U'*ver+"R"*hor
back1 = "D"*ver+"L"*hor
go2 = "D"+"R"*(hor+1)+'U'*(ver+1)
back2 = "U"+"L"*(hor+1)+"D"*(ver+1)+"R"
print(go1+back1+go2+back2)
# Judge status: Accepted
sx, sy, tx, ty = map(int, input().split())

dx, dy = tx-sx, ty-sy

path1 = 'U'*dy + 'R'*dx
path2 = 'D'*dy + 'L'*dx
path3 = 'L' + 'U'*(dy+1) + 'R'*(dx+1) + 'D'
paht4 = 'R' + 'D'*(dy+1) + 'L'*(dx+1) + 'U'

ans = path1 + path2 + path3 + paht4
print(ans)
# Judge status: Accepted
def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    rate_list = [0] * 9

    for a in a_list:
        rate = a // 400
        if rate < 8:
            rate_list[rate] += 1
        else:
            rate_list[-1] += 1

    min_cnt = 0
    for i in range(8):
        if rate_list[i] > 0:
            min_cnt += 1

    print(max(min_cnt, 1), min_cnt + rate_list[-1])


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K, Q, *A = map(int, read().split())
point = np.zeros(N + 1)

for i in A:
    point[i] += 1
point += K - Q
print(*['Yes' if i > 0 else 'No' for i in point], sep='\n')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
AJ = tuple(a - i for i, a in enumerate(A))

maxnum = 2*10**5
count = 0
for i in range(0, N-1):
    if A[i] >= maxnum:
        break

    iai  = i + A[i]
    for aj in AJ[iai+1:]:
        if iai + aj == 0:
            count += 1

print(count)
# Judge status: Accepted
s = input()
k = int(input())
if k <= 100:
    if set(s[:k]) == set('1'):
        print(1)
        exit()
for _ in s:
    if _ != '1':
        print(_)
        exit()
# Judge status: Wrong Answer
def resolve():
    sx, sy, tx, ty = map(int, input().split())
    tx, ty = (tx-sx), (ty-sy)
    sx, sy = 0, 0

    ans1 = ["R"]*tx + ["U"]*ty
    ans2 = ["L"]*tx + ["D"]*ty
    ans3 = ["D"]+["R"]*(tx+1)+["U"]*(ty+1)+["L"]
    ans4 = ["U"] + ["L"]*(tx+1)+["R"]*(ty+1)+["R"]
    print("".join(ans1+ans2+ans3+ans4))

resolve()
# Judge status: Accepted
N,M=map(int, input().split())
A=[[] for i in range(N)]

for i in range(M):
  p,y=map(int, input().split())
  A[p-1].append((y, i))

X=[0]*M
for i,d in enumerate(A):
  d.sort()
  for k,(y,j) in enumerate(d):
    X[j]=str(i+1).zfill(6)+str(k+1).zfill(6)
print(*X,sep='\n')
# Judge status: Wrong Answer
N, M = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(N)]
cd = [tuple(map(int, input().split())) for _ in range(M)]

for a, b in ab:
    tmp_dist = 10 ** 8 * 2
    tmp_point = 0
    count = 0
    for c, d in cd:
        count += 1
        if tmp_dist > abs(a - c) + abs(b - d):
            tmp_point = count
        tmp_dist = min(tmp_dist, abs(a - c) + abs(b - d))
    else:
        print(tmp_point)
# Judge status: Accepted
N, M = [int(i) for i in input().split()]
a = [int(input()) for _ in range(M)]
divisor = 10**9 + 7

fl = [True] * N

for i in range(M):
    fl[a[i]] = False

dp = [0] * (N+1)
dp[0] = 1

for i in range(1, N+1):
    if i > 0 and fl[i-1]:
        dp[i] += dp[i-1] % divisor
    if i > 1 and fl[i-2]:
        dp[i] += dp[i-2] % divisor
    
print(dp[N]%divisor)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
n, h = map(int, input().split())
a, b = [0]*n, [0]*n
for i in range(n):
    aa, bb = map(int, input().split())
    a[i], b[i] = aa, bb
a_max = max(a)
b_thr = []
for i in b:
    if i > a_max:
        b_thr.append(i)
ans = 0
for i in b_thr:
    if h > 0:
        h -= i
        ans += 1
    else:
        print(ans)
        exit()
if h % a_max == 0:
    ans += h // a_max
else:
    ans += h // a_max + 1
print(ans)
# Judge status: Wrong Answer
#ABC144A
a,b = map(int,input().split())
print(a*b if 1<=a<=b<=9 else -1)
# Judge status: Accepted
x = int(input())
m = 100
n = 0
while m < x:
    m += m // 100
    n += 1
print(n)
# Judge status: Accepted
#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

Q1,H1 = 4*Q,2*H
S = min(Q1,H1,S)

if 2*S>D:
    cnt_2 = N//2
    cnt_1 = N%2
    pay = D*cnt_2 + S*cnt_1
else:
    pay = N * S
print(pay)
# Judge status: Accepted
def main():
    a, b, x = map(int, input().split())
    if a == 0:
        left = 0
    else:
        left = (a-1)//x + 1

    if b == 0:
        right = 1
    else:
        right = b//x + 1 

    print(right - left)
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n, m, x = map(int, input().split())
li = [list(map(int, input().split())) for _ in range(n)]
X = [x for i in range(m)]

ans = 10**10
f = 0
for b in range(2**n):
  skils = [0]*m
  tmp = 0
  
  for i in range(n):
    if b&(1<<i):
      for j in range(m):
        skils[j] += li[i][j+1]
      tmp += li[i][0]

        
  if skils>=X:
    ans = min(ans, tmp)
    f+=1

    
if f==0:
  print(-1)
  exit()
print(ans)
# Judge status: Accepted
import math

def main():
    a, b = map(int, input().split())
    print(math.ceil((a + b)/2))
main()
# Judge status: Accepted
n = int(input())
a = [int(input()) for i in range(n)]

d = {}
for i in range(n):
    if a[i] not in d:
        d[a[i]] = 0
    else:
        del d[a[i]]

print(len(d))
# Judge status: Wrong Answer
import numpy as np
n = int(input())
hikumono = n * (n-1)//2
A = np.array(list(map(int, input().split())))
B = np.array([i+1 for i in range(n)])
C=A-B
heikin1 = C.sum()//n
heikin2 = heikin1 + 1
ans1 = abs(C-heikin1).sum()
ans2 = abs(C-heikin2).sum()
print(min(ans1, ans2))
# Judge status: Wrong Answer
s= str(input())
print('A' + s[0] +'C')
# Judge status: Accepted
a, b, c, d = map(int, input().split())

m = -999999999999999999

ac = a * c
if ac >= m:
  m = ac

ad = a * d
if ad >= m:
  m = ad

bc = b * c
if bc >= m:
  m = bc

bd = b * d
if bd >= m:
  m = bd

print(m)
# Judge status: Accepted
a,b,c = map(int,input().split())
if a < c < b or b < c < a:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
with open(0) as f:
    X, A, B = map(int, f.read().split())
if B-A <= 0:
    ans = 'delicious'
if 0 < B-A <= X:
    ans = 'safe'
if B-A > X:
    ans = 'dangerous'
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math


def main():
    S = list(input())
    for abc in 'abcdefghijklmnopqrstuvwxyz':
        if not abc in set(S):
            print(abc)
            exit(0)
    print('None')


if __name__ == "__main__":
    main()
# Judge status: Accepted
N,K = map(int,input().split())
print(0 if N%K == 0 else 1)
# Judge status: Accepted
import collections

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

CNT_A = collections.Counter(A_s).most_common()
sorted_A = sorted(CNT_A, reverse=True)


verticle = []
ans = 0


for i in range(len(CNT_A)):
    key = sorted_A[i][0]
    value = sorted_A[i][1]
    
    if (value > 1):
        verticle.append(key)
    

    if (len(verticle) == 1 and value > 3):
        ans = key * key
        break

    elif (len(verticle) >= 2):
        ans = verticle[0] * verticle[1]
        break


print(ans)
# Judge status: Accepted
a = []
a = list(map(int, input().split()))

m = a.pop()
n = a.pop()

if m == n:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
A, B = map(int, input().split())
for i in range(0, 21):
    if i*A - (i-1) >= B:
        print(i)
        break
# Judge status: Accepted
N = int(input())
H = list(map(int,input().split()))
ans = 0
maxi = 0
for i in range(N-1):
    if H[i] >= H[i+1]:
        ans += 1
    else:
        ans = 0
    maxi = max(ans, maxi)
print(maxi)
# Judge status: Wrong Answer
a = 2
ans = int(a + a ** 2 + a ** 3)
print(ans)
# Judge status: Accepted
n = list(map(int, input().split()))
n.sort()
cnt = 0
if (n[1]-n[0])%2 != 0:
  if (n[0]%2==0 and n[2]%2==0) or (n[0]%2!=0 and n[2]%2!=0):
    cnt += 1
    n[0] += 1
    n[2] += 1
  elif (n[1]%2==0 and n[2]%2==0) or (n[1]%2!=0 and n[2]%2!=0):
    cnt += 1
    n[1] += 1
    n[2] += 1
n.sort()
if (n[1]-n[0])%2 ==0:
  cnt += (n[1]-n[0])//2
  n[0] = n[1]
  print(cnt+n[2]-n[1])
# Judge status: Accepted
from copy import copy, deepcopy
from collections import Counter
from math import sqrt, floor, factorial
from itertools import permutations, combinations, combinations_with_replacement
from operator import mul
from functools import reduce
import bisect

MOD = 10**9 + 7
INF = float('inf')

N = int(input())

A = {2, 4, 5, 7, 9}

if N % 10 in A:
    print("hon")
elif N % 10 == 3:
    print("bon")
else:
    print("pon")
# Judge status: Accepted
INF = 10 ** 9 + 7
N = int(input())
a = 10**N
b = 9**N
c = 8**N
ans = a -(b + b - c)
ans = ans%INF
print(ans)
# Judge status: Accepted
import itertools
N,D=map(int,input().split())
zahyo=[]

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False
for _ in range(N):
    x=list(map(int,input().split()))
    zahyo.append(x)    
cnt=0
for y in itertools.combinations(zahyo,2):
    
    kyori=[(i-j)**2 for i,j in zip(y[0],y[1])]
    soukyori=(sum(kyori))**(1/2)
    if is_integer_num(soukyori):
        cnt+=1
print(cnt)
# Judge status: Accepted
n=int(input())
s=input()

ans=0
for i in range(n):
  s1=s[:i]
  s2=s[i:]
  ans=max(ans,len(set(s1)&set(s2)))

print(ans)
# Judge status: Accepted
A, B, C = map(int, input().split())
A, B, C = sorted([A, B, C])
count = 0

count += C - B
q, r = divmod(C - (A + (C - B)), 2)
if r == 0:
    count += q
else:
    count += q + 2

print(count)
# Judge status: Accepted
from math import gcd

def lcm(x, y):
    return (x * y)//gcd(x, y)

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

cd = lcm(c,d)
ab = b-a+1

print(ab-(b//c-(a-1)//c)-(b//d-(a-1)//d)+(b//cd-(a-1)//cd))
# Judge status: Accepted
import math
N = int(input())
A = [int(input()) for _ in range(5)]
print(4+math.ceil(N/min(A)))
# Judge status: Wrong Answer
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def lowmod(a, b, mod):
    a -= b
    if a >= mod:
        a -= mod
    return a

def solve():
    n = int(input())
    s = input()
    c = collections.Counter(s)
    mod = 10*9+7
    ans = 1
    for i in c:
        ans *= (c[i]+1)
        ans %= mod
    ans = (ans-1+mod) % mod
    print(ans)
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
import itertools
N = int(input())
num_list = list(map(str, range(1, N)))
combi_list = [i for i in zip(num_list,num_list)]
combi_list_2 = [i for i in itertools.permutations(num_list,2)]
ab = 0
for i in combi_list:
    if (i[0][-1] == i[1][0]) & (i[0][0] == i[1][-1]):
        ab += 1
for i in combi_list_2:
    if (i[0][-1] == i[1][0]) & (i[0][0] == i[1][-1]):
        ab += 1
print(ab)
# Judge status: Wrong Answer
import numpy as np
def solve(s):
    h = int(np.sqrt(s))
    if h**2 < s:
        h += 1
    d = h**2 - s
    if d == 0:
        x, y = 0, 0
    else:
        x, y = 1, d
    return " ".join(map(str, [0,0,x,d,d,y]))

s = int(input())
print(solve(s))
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())
print(max(a*c,b*d,a*d))
# Judge status: Accepted
abcd = input()
int_abcd = list(map(int, abcd))
for i in range(1 << 3):    
    op = ['-'] * 3 + ['=7']
    sum_abcd = int_abcd[0]
    for j in range(3):
        if (i >> j) & 1:
            op[2 - j] = '+'
        sum_abcd += (-1)**(((i >> j) & 1) + 1) * int_abcd[3 - j]
    if sum_abcd == 7:
        break

for num, pm in zip(abcd, op):
    print(num, pm, sep='', end='')
# Judge status: Wrong Answer
import sys

N = int(input())
s = list(input())
t = list(input())
if s == t:
  print(N)
  sys.exit()
  
s.reverse()
c = 0
for i in range(N):
  if t[i] == s[i]:
    c += 1
  else:
    break
print(2*N-c)
# Judge status: Wrong Answer
x,y=map(int,input().split())
print("Yes" if (x!=2 and y!=2) and ((x%2==0 and y%2==0) or (x%2!=0 and y%2!=0)) else "No")
# Judge status: Accepted
n=int(input())
a_list=[int(i) for i in input().split()]

count=0
for i in range(n):
    if (i+1)%2!=0 and a_list[i]%2!=0:
        count+=1
        
print(count)
# Judge status: Wrong Answer
a,b,c,k = map(int,input().split())
count = 0
while count == k:
  a1 = a
  b1 = b
  c1 = c
  a = b1 + c1
  b = a1 + c1
  c = a1 + b1
  count += 1
if abs(a-b) >= 10**8:
  print('Unfair')
else:
  print(a-b)
# Judge status: Accepted
a, b, c = map(int, input().split())
print(max(c - (a-b), 0))
# Judge status: Accepted
S = list(input())

c = 0
ans = 0

for i in S:
    if i=='A' or i=='C' or i=='G' or i=='T':
        c += 1
        if ans < c:
            ans = c
    else:
        c = 0

print(ans)
# Judge status: Wrong Answer
a = int(input("Enter a number: \n"))
print(a + (a**2) + (a**3))
# Judge status: Accepted
n=int(input())
x=[int(i) for i in input().split()]
xx=sorted(x)
a=xx[n//2-1]
b=xx[n//2]
for i in range(n):
  if x[i]<=a:
    print(b)
  else:
    print(a)
# Judge status: Accepted
n = int(input())
lis = [x for x in range(1, n+1, 2)]
ans = 0

for a in lis:
  lis2 = []
  for b in range(1, a+1):
    if a % b == 0:
      lis2.append(b)
  if len(lis2) == 8:
    ans += 1

print(ans)
# Judge status: Accepted
from collections import Counter

s, t = input(), input()

dict = {}
for si, ti in zip(s, t):
    if ti not in dict:
        dict[ti] = si
    elif dict[ti] != si:
        print('No')
        break
else:
    cnt = Counter(dict.values())
    bool = all(cnt[i] <= 1 for i in cnt)
    print('Yes' if bool else 'No')
# Judge status: Accepted
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline


def main():
    n, r = map(int, input().split())
    if n <= 10:
        # r = x - (100 * (10 - n))
        print(r + 100 * (10 - n))

    else:
        print(r)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N, K = map(int, input().split())

n = N//K
m1 = N-K*n
m2 = abs(N-K*(n+1))
ans = min(m1, m2)
print(ans)
# Judge status: Wrong Answer
w,h,x,y=map(int,input().split())
ma=w*h/2
H=h//2
W=w//2
if H==x and W==y:
    boo=1
else:
    boo=0

print(ma,boo)
# Judge status: Accepted
S=input()
if S[2]==S[3] and S[4]==S[5]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def main():
    # editorial読んだ．
    N, K = map(int, input().split(" "))
    coordinates = list(map(int, input().split(" ")))
    result = 10 ** 9 + 7
    for i in range(N - K + 1):
        result = min(result, abs(coordinates[i + K - 1] - coordinates[i]) + abs(coordinates[i]),
                     abs(coordinates[i + K - 1] - coordinates[i]) + abs(coordinates[i + K - 1]))
    print(result)


if __name__ == '__main__':
    main()
# Judge status: Accepted
import itertools
import math
import fractions
import functools
import copy

p,q,r = map(int, input().split())
print(p+q+r-max(p,q,r))