Harryxun/stf_run huggingface dataset:
def main():
    S = input()
    upper = int(S[:2])
    lower = int(S[2:4])

    if upper > 12 and lower > 12:
        print('NA')

    elif upper > 12 and lower > 0:
        print('YYMM')

    elif lower > 12 and upper > 0:
        print('MMYY')

    elif lower == 0 or upper == 0:
        print('NA')

    else:
        print('AMBIGUOUS')

    else:
        print('NA')


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    S = input()
    upper = int(S[:2])
    lower = int(S[2:4])
    s = ''
    if upper <= 12 and upper > 0:
        s += 'MM'

    else:
        s += 'YY'

    if lower <= 12 and lower > 0:
        s += 'MM'

    else:
        s += 'YY'

    if s == 'MMMM':
        print('AMBIGUOUS')

    elif s == 'YYYY':
        print('NA')

    else:
        print(s)


if __name__ == '__main__':
    main()
import sys

def shortestPath(graph, s):
    n = len(graph)
    dist = [inf for _ in range(n)]
    dist[s] = 0

    for i in range(n):
        for u in range(n):
            for v, cost in graph[u]:
                newDist = dist[u] + cost
                if dist[u] != inf and newDist < dist[v]:
                    if i == n - 1:
                        return None
                    dist[v] = newDist
    return dist

def main():
    v, e, s = map(int, input().split())
    
    graph = [[] for _ in range(v)]
    
    for i in range(e):
        a, b, cost = map(int, input().split())
        graph[a].append((b, cost))
            
    dist = shortestPath(graph, s)

    if not dist:
        print("NEGATIVE CYCLE")
    else:
        for d in dist:
            if d >= inf:
                print("INF")
            else:
                print(d)
main()

### FIXED CODE ###

import sys

inf = int(1e12)

def shortestPath(graph, s):
    n = len(graph)
    dist = [inf for _ in range(n)]
    dist[s] = 0

    for i in range(n):
        for u in range(n):
            for v, cost in graph[u]:
                newDist = dist[u] + cost
                if dist[u] != inf and newDist < dist[v]:
                    if i == n - 1:
                        return None
                    dist[v] = newDist
    return dist

def main():
    v, e, s = map(int, input().split())
    
    graph = [[] for _ in range(v)]
    
    for i in range(e):
        a, b, cost = map(int, input().split())
        graph[a].append((b, cost))
            
    dist = shortestPath(graph, s)

    if not dist:
        print("NEGATIVE CYCLE")
    else:
        for d in dist:
            if d >= inf:
                print("INF")
            else:
                print(d)
main()
import math
n , k = map(int, input().split())

mod = 10 ** 9 + 7
red_count = n - k 
for i in range(1, k+1):
    if red_count + 1 - i < 0:
        print(0)
        continue
    b_dif = math.factorial(k-1) / (math.factorial(i-1) * math.factorial(k-i))
    
    a_dif = math.factorial(red_count + 1)  /  (math.factorial(i) * math.factorial(red_count + 1 - i))

    print(int(a_dif * b_dif % mod))

### FIXED CODE ###


from scipy.misc import comb
n , k = map(int, input().split())

mod = 10 ** 9 + 7
red_count = n - k 
for i in range(1, k+1) :
    if red_count + 1 - i < 0 :
        print(0)
        
    else:

        print(comb(red_count+1, i , exact = True)*comb(k-1, i-1, exact=True) % mod)
s = set(list(str(input())))
s1=list(sorted(s))
t=0
if len(s1)==26:
    print(None)
for i in range(len(s1)+1):
    if not i+97==ord(s1[i]):
        print(chr(i+97))
        break

### FIXED CODE ###

s = set(list(str(input())))
s1=list(sorted(s))
for i in range(len(s1)+1):
    if not chr(i+97) in s1:
        print(chr(i+97))
        break
    elif chr(i+97)=='z':
        print(None)
        break
nums=input(3).split(5)
a=int(nums[0])
b=int(nums[1])
print(a*b,(a+b)*2)

### FIXED CODE ###

nums = input().split()
a = int(nums[0])
b = int(nums[1])
print(a * b,(a + b) * 2)
import numpy as np
N = input()
a = []
for i in range(N):
    a.append(input())
dero=np.zeros((25,2))
for i in range(5):
  for j in range (5):
    dero[i*5+j][0]=a[j]-a[i]
    dero[i*5+j][1]=a[5]
frag=0
for i in range(25):
  if dero[i][0]>dero[i][1]:
    frag=1
    print(dero[i][0])
if frag==0:
  print(":(")

### FIXED CODE ###

import numpy as np
n=6
a=[int(input()) for i in range(n)]
dero=np.zeros((25,2))
for i in range(5):
  for j in range (5):
    dero[i*5+j][0]=a[j]-a[i]
    dero[i*5+j][1]=a[5]
frag=0
for i in range(25):
  if dero[i][0]>dero[i][1]:
    frag=1
if frag==0:
  print("Yay!")
else:
    print(":(")
d12=int(input())
d13=int(input())
d23=int(input())
dt1=d12+d23
dt2=d23+d13
dt3=d13+d12
if (dt1<dt2 and dt1<dt3):
    print(dt1)
elif (dt2<dt1 and dt2<dt3):
    print(dt2)
else:
    print(dt3)

### FIXED CODE ###

# your code goes here
p,q,r = map(int,input().split())
print(min(p+q,q+r,r+p))
n, *A = map(int, open(0).read().split())
A = [a%mod for a in A]
mod = 10**9 + 7
ans = 0
d = 1
while any(A):
  c = 0
  for i in range(n):
    q, r = divmod(A[i], 2)
    A[i] = q
    c += r
  ans += c*(n-c) * d
  ans %= mod
  d *= 2
print(ans % mod)

### FIXED CODE ###

import sys
inputs = sys.stdin.readlines()

n = int(inputs[0])
A = list(map(int, inputs[1].split()))
MOD = 10 ** 9 + 7

bit = len(format(max(A), 'b'))
ans = 0
for i in range(bit):
    nb_1 = sum(((a >> i) & 1 for a in A))
    ans += (nb_1 * (n - nb_1)) << i
    ans %= MOD
    
print(ans)
import math
r = raw_input()
area = r * r * math.pi * 1.0
cir = 2 * r * math.pi * 1.0
print '%f %f' % (area, cir)

### FIXED CODE ###

import math
r = input()
area = r * r * math.pi * 1.0
cir = 2 * r * math.pi * 1.0
print '%f %f' % (area, cir)
a,b,c=[int(x) for x in input().split()]
x = b
count = 0
while True:
    if x == a: break
    elif x%c == 0 : count +=
    x -=
print(x)


### FIXED CODE ###

a,b,c=[int(x) for x in input().split()]
count = 0
for d in range(a,b+1):
    if c%d == 0 : count += 1
print(count)
n,m=map(int,input().split())
a=list(map(int,input().split()))
x=0
for i in range(m+1):
  a.sort(reverse=1)
  print(a)
  x=a[0]//2
  a[0]=x
print(sum(a))  

### FIXED CODE ###

import heapq

n,m=map(int,input().split())
a=list(map(int,input().split()))
a=list(map(lambda x: x*(-1), a))
heapq.heapify(a)
for _ in range(m):
  x=heapq.heappop(a)
  x=((x*(-1))//2)*(-1)
  heapq.heappush(a,x)










print(sum(a)*(-1))
n, m = map(int, input().split())

left  = 0
right = n
for i in range(m):z
  l, r = map( int, input().split() )
  left = max( left, l )
  right = min( right, r )

print( right - left + 1 )

### FIXED CODE ###

n, m = map(int, input().split())
 
left  = 0
right = n
for i in range(m):
  l, r = map( int, input().split() )
  left = max( left, l )
  right = min( right, r )

ans =  right - left + 1
if ans <= 0:
  ans = 0
print( ans )
from collections import deque

N = int(input())

dic = {}

for  i in range(N-1):

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

    if a not in dic:
        dic[a] = []
    if b not in dic:
        dic[b] = []

    dic[a].append(b)
    dic[b].append(a)

for xxx in range(1):

    lis = [float("inf")] * N
    lis[0] = 0
    maxind = 0
    q = deque([0])

    while len(q) > 0:

        now = q.popleft()

        for nex in dic[now]:

            if lis[nex] > lis[now] + 1:
                lis[nex] = lis[now] + 1
                q.append(nex)
                maxind = nex

    lis = [float("inf")] * N
    lis[maxind] = 1
    q = deque([maxind])
    L = 0

    while len(q) > 0:

        now = q.popleft()

        for nex in dic[now]:

            if lis[nex] > lis[now] + 1:
                lis[nex] = lis[now] + 1
                q.append(nex)
                L = lis[nex]

    #print (lis)
    #print (L)

    if L == 1 or L % 3 != 2:

        print ("First")

    else:

        print ("Second")


### FIXED CODE ###

from collections import deque
import sys

N = int(input())

if N == 1:
    print ("First")
    sys.exit()


dic = {}

for  i in range(N-1):

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

    if a not in dic:
        dic[a] = []
    if b not in dic:
        dic[b] = []

    dic[a].append(b)
    dic[b].append(a)

for xxx in range(1):

    lis = [float("inf")] * N
    lis[0] = 0
    maxind = 0
    q = deque([0])

    while len(q) > 0:

        now = q.popleft()

        for nex in dic[now]:

            if lis[nex] > lis[now] + 1:
                lis[nex] = lis[now] + 1
                q.append(nex)
                maxind = nex

    lis = [float("inf")] * N
    lis[maxind] = 1
    q = deque([maxind])
    L = 0

    while len(q) > 0:

        now = q.popleft()

        for nex in dic[now]:

            if lis[nex] > lis[now] + 1:
                lis[nex] = lis[now] + 1
                q.append(nex)
                L = lis[nex]

    #print (lis)
    #print (L)

    if L == 1 or L % 3 != 2:

        print ("First")

    else:

        print ("Second")
import math
n,k = map(int,input().split())
x = n//k
if(n<k):
    x = k//n
    print(min(abs(k*x-n),abs(k*(x+1)-n)))
else:
    print(min(abs(k*x-n),abs(k*(x+1)-n)))

### FIXED CODE ###

#ab,ac
a,b,c = map(int,input().split())
a,b = b,a
a,c = c,a
print(a,b,c)
x,y,z=[int(i) for i in range(input)]
print(x*y/2)

### FIXED CODE ###

x,y,z=[int(i) for i in input().split()]
print(int(x*y/2))
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

n, x = map(int, input().split())
num = list(map(int,input().split()))
d = num[0]-x
for nn in num:
    d=gcd(t,n-x)
print(d)

### FIXED CODE ###

import fractions

n, x = map(int, input().split())
num = list(map(int,input().split()))
d = abs(num[0]-x)
for nn in num:
	d=fractions.gcd(d, abs(nn-x))
print(d)
N,M=map(int,input().split())
sc=[]
ans=[]
for i in range(M):
    sc.append(list(map(int,input().split())))
    ans.append(0)
for i in sc:
    ans[i[0]-1]=i[1]
stack=""
for i in ans:
    stack=stack+str(i)
stack=int(stack)
stack=str(stack)
if len(stack) == N and stack != "0":
    print(stack)
else:
    print(-1)

### FIXED CODE ###

N,M=map(int,input().split())
s,c=[0]*M,[0]*M
for i in range(M):
    s[i],c[i] = map(int,input().split())
for i in range(10**N):
    if len(str(i)) != N:
        pass
    else:
        num=list(str(i))
        ok = True
        for j in range(M):
            if num[s[j]-1] != str(c[j]):
                ok = False
        if ok:
            print(i)
            exit()
print(-1)
def main():
    N,Y = list(map(int,input().split()))

    flag = False

    for i in range(N+1):
        for j in range(N+1):
            for k in range(N+1):
                if(i+j+k == N and 10000 * i + 5000 * j + 1000 * k == Y):
                    print(i,j,k)
                    flag = True
                    break
            if(flag):
                break
        if(flag):
            break
    if(!flag):
        print(-1,-1,-1)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    N,Y = list(map(int,input().split()))

    flag = False

    loop_10000 = Y // 10000
    loop_5000 = Y // 5000
    loop_1000 = Y // 1000

    for i in range(loop_10000+1):
        for j in range(loop_5000+1):
            k = N - i - j
            if(k >= 0 and i+j+k == N and 10000 * i + 5000 * j + 1000 * k == Y):
                print(i,j,k)
                flag = True
                break
            #for k in range(loop_1000+1):
            #    if(i+j+k == N and 10000 * i + 5000 * j + 1000 * k == Y):
            #        print(i,j,k)
            #        flag = True
            #        break
            #if(flag):
            #    break
        if(flag):
            break
    if(not flag):
        print(-1,-1,-1)

if __name__ == "__main__":
    main()
import numpy as np
N,*A=map(int,open(0).read().split())
A=(np.array(A)//400).astype("int32")

color_num=0

colors=np.zeros(9)

for a in A:
  colors[a]+=1

c=np.count_nonzero(colors[:-1])

min_color_num = 1 if (c==0 and colors[-1]>0) else c
max_color_num = min(8,c+max(int(colors[-1]),0))

print(min_color_num,max_color_num)


### FIXED CODE ###

N,*A=map(int,open(0).read().split())

colors = [0 for i in range(8)]
tyty = 0

for a in A:
  c = a//400
  if c>=8:
    tyty+=1
  else:
    colors[c]+=1

cNum = 8-colors.count(0)
    
minC = max(cNum,1)
maxC = cNum+tyty

print(minC,maxC)
x = int(raw_input())
for i in range(-100 , 100):
  for j in range(-100 , 100):
    if(math.pow(i , 5) - math.pow(j , 5) == x):
      print(i , " " , j)
      break

### FIXED CODE ###

import math
x = int(input())
foo = 0;
for i in range(-120 , 120):
  if foo == 1:
      break;
  for j in range(-120 , 120):
    if(math.pow(i , 5) - math.pow(j , 5) == x):
      print(i , " " , j)
      foo = 1;
      break;
# https://atcoder.jp/contests/abc123/tasks/abc123_b

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())


orders = [a, b, c, d, e]


def last_order(nums):
    cnt = 130
    num = 0

    for i in nums:
        if i % 10 != 0:
            if cnt > int(str(i)[-1]):
                cnt = int(str(i)[-1])
                num = i

    return num


def move_up(num):
    if num % 10 != 0:
        return  num + (10 - (num % 10))
    else:
        return num

last = last_order(orders)
orders.remove(last)

total_time = 0

for i in orders:
    total_time = total_time + move_up(i)

print(total_time + last)

### FIXED CODE ###

# https://atcoder.jp/contests/abc123/tasks/abc123_b

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())


orders = [a, b, c, d, e]


def last_order(nums):
    cnt = 130
    num = 0

    for i in nums:
        if i % 10 != 0:
            if cnt > int(str(i)[-1]):
                cnt = int(str(i)[-1])
                num = i

    return num


def move_up(num):
    if num % 10 != 0:
        return  num + (10 - (num % 10))
    else:
        return num

last = last_order(orders)
if last:
    orders.remove(last)

total_time = 0

for i in orders:
    total_time = total_time + move_up(i)

print(total_time + last)
a,b,c=map(int,input().split())
if a=b=c :
    print(1)
elif a=b and not b=c:
    print(2)
elif b=c and not a=c :
    print(2)
elif c=a and not a=b :
    print(2)
else :
    print(3)


### FIXED CODE ###

a,b,c=map(int,input().split())
if a==b==c :
    print(1)
elif a==b and not b==c:
    print(2)
elif b==c and not a==c :
    print(2)
elif c==a and not a==b :
    print(2)
else :
    print(3)
import math
Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)
c_min = int(a/c) if a % c == 0 else int(a/c) + 1
c_max = int(b/c)
delta_c = c_max - c_min + 1
d_min = int(a/d) if a % c == 0 else int(a/d) + 1
d_max = int(b/d)
delta_d = d_max - d_min + 1
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
cd = lcm(c, d)
cd_min = int(a/cd) if a % c == 0 else int(a/cd) + 1
cd_max = int(b/cd)
delta_cd = cd_max -cd_min + 1
print( b-a+1 - (delta_c + delta_d - delta_cd), end='')

### FIXED CODE ###

# 同じ数字が連続していないこと
passward = input()


def detector(passward):
    passward_list = list(passward)
    for i in range(len(passward)-1):
        if passward_list[i] == passward_list[i+1]:
            print('Bad', end='')
            break
        else :
            if i == len(passward)-2:
                print('Good', end='')
            continue
        

detector(passward)
x=[i for i in range(1,input()+1)]
print(x)


### FIXED CODE ###

x=[i for i in range(1,int(input())+1)]
print(sum(x))
A,B,C = (int(i) for i in input().split())

Aaddition = A+B+C
if Addition != 17:
  haiku = False
else:
  if((A==5 or A==7) and (B==5 or B==7) and (C==5 or C==7) ):
    haiku = True
  else:
    haiku = False
    
if haiku:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

A,B,C = (int(i) for i in input().split())

Addition = A+B+C
if Addition != 17:
    haiku = False
else:
    if ((A==5 or A==7) and (B==5 or B==7) and (C==5 or C==7)):
        haiku = True
    else:
        haiku = False
    
if haiku:
    print("YES")
else:
    print("NO")
N = int(input())
A = list(map(int, input().split()))

def soinsu(a):
  result = []
  tmp = 2
  n = a
  while tmp <= a:
    if n%tmp == 0:
      result.append(tmp)
      while n%tmp == 0:
        n //= tmp
    tmp += 1
  return result

dict_prime = dict()
for a in A:
  for p in soinsu(a):
    if p in dict_prime.keys():
      dict_prime[p] += 1
    else:
      dict_prime[p] = 1

v = max(dict_prime.values())
if v == N:
  answer = 'not coprime'
elif v == 1:
  answer = 'pairwise coprime'
else:
  answer = 'setwise coprime'

print(answer)

### FIXED CODE ###

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

def get_count(p):
  integers = [1 for _ in range(p+1)]
  integers[0] = 0
  integers[1] = 0
  counts = [0 for _ in range(p+1)]
  for a in A:
    counts[a] += 1
  answer = 0
  for i in range(p+1):
    if integers[i] >= 1:
      count = 0
      for j in range(i,p+1,i):
        count += counts[j]
        integers[j] = 0
      answer = max(answer,count)
  return answer

count = get_count(max(A))
if count == N:
  answer = 'not coprime'
elif count >= 2:
  answer = 'setwise coprime'
else:
  answer = 'pairwise coprime'

print(answer)
n, k = [int(x) for x in input().split()]
s = input()

s[k-1] = s[k-1].lower()

print(s)

### FIXED CODE ###

n, k = [int(x) for x in input().split()]
s = list(input())

s[k-1] = s[k-1].lower()

print(*s ,sep="")
import sys
read_=sys.stdin.buffer.readline

N=int(read_())
H=list(map(int,read_().split()))

dp=[10**4+1]*N

def f(i):
    if dp[i]<10**4+1: 
        return dp[i]
    if i==0: 
        return 0
    res=10**4+1
    res=min(res,f(i-1)+abs(H[i]-H[i-1]))
    if i>1: res=min(res,f(i-2)+abs(H[i]-H[i-2]))
    dp[i]=res
    return dp[i]

print(f(N-1))

### FIXED CODE ###

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

dp=[0]*N

dp[1]=abs(H[0]-H[1])

for i in range(2,N):
    a,b=dp[i-1]+abs(H[i-1]-H[i]),dp[i-2]+abs(H[i-2]-H[i])
    if a<b:
        dp[i]+=a
    else:
        dp[i]+=b

print(dp[-1])
s=input(); if s in "aiueo" print("vowel") else print("consonant")

### FIXED CODE ###

s = input()
if s in "aiueo":
  print("vowel")
else:
  print("consonant")
a,s,b = input(str, input.split())
if s == "+":
    print(a + b)
else:
    print(a - b)

### FIXED CODE ###

a,s,b = map(str, input().split())
if s == "+":
    print(int(a) + int(b))
else:
    print(int(a) - int(b))
n = input()
n = [‘1’ for a in n if a==‘9’ else ‘9’]
print(“”.join(n))

### FIXED CODE ###

n = input()
ans = ''
for a in n:
  if a == '1':
    ans  = ans + '9'
  else:
    ans = ans + '1'
print(ans)
a=input()
b=input()
if int(a)==int(b):
  print('Yes')
  else:
    print('No')

### FIXED CODE ###

a=input().split()
if int(a[0]) == int(a[1]):
  print('Yes')
else:
  print('No')
import math

def lcm(a, b):
    return abs(a*b) // math.gcd(a, b)
  
a, b = [int(x) for x in input().split()]
print(lcm(a,b))


### FIXED CODE ###

from fractions import gcd
 
def lcm(a, b):
    return abs(a*b) // gcd(a, b)
  
a, b = [int(x) for x in input().split()]
print(lcm(a,b))
from fractions import gcd
A, B = map(int, input().split())

cdMap = [0] * min(A, B)
count = 0
tmp = 1

for i in range(1, min(A, B)+1):
    if A%i==0 and B%i==0 and gcd(i, tmp) == 1:
        tmp *= i
        count += 1
print(count)


### FIXED CODE ###

from fractions import gcd
A, B = map(int, input().split())
G = gcd(A, B)

# nの[素因数, その数]のリストを返す
def prime_factoring(n):
    from math import sqrt
    factors = []
    for num in range(2, int(sqrt(n))+1):
        if n % num == 0:
            count = 0
            while(n % num == 0):
                n //= num
                count += 1
            factors.append([num, count])
    else:
        if n != 1:
            factors.append(n)
    return factors

print(len(prime_factoring(G))+1)
import copy
def amida(A,x):
  for e in A:
    if e[x]==1:x+=1
    elif e[x-1]==1:x-=1
  return x
def f():
  for i in range(d):
    for j in range(1,n):
      if A[i][j]==0:
        B=copy.deepcopy(A)
        B[i][j]=1
        if amida(B,m)==p:
          print i+1,j
          return
  print 1
  return
 
import sys
n=input()
m=input()
p=input()
d=input()
A=[]
for s in sys.stdin:
  if s=="0\n":break
  A+=[[0]+map(int,list(s[:-1]))+[0]]
if amida(A,m)==p: print 0
else:f()

### FIXED CODE ###

import sys
def amida(A,x):
  for e in A:
    if e[x]=="1":x+=1
    elif e[x-1]=="1":x-=1
  return x
def f():
  for i in D:
    for j in range(1,n):
      if A[i][j-1:j+2]=="000":
        B=[e[:] for e in A]
        B[i]=B[i][:j]+"1"+B[i][j+1:]
        if amida(B,m)==p:
          print i+1,j
          return
  print 1
  return

while 1:
  n=input()
  if n==0:break
  m=input()
  p=input()
  D=range(input())
  A=["0"+raw_input()+"0" for i in D]
  if amida(A,m)==p:print 0
  else:f()
def typical_stairs():
    n, m = map(int, input().split())
    dangerous = list(int(input()) for _ in range(m))
    mod = 1000000007
    dp = [0] * (n + 1)
    dp[0] = 1
    if not dangerous[0] == 1:
        dp[1] = 1
    for i in range(2, n + 1):
        if i not in dangerous:
            dp[i] = dp[i - 2] + dp[i - 1]
    print(dp[-1] % mod)


if __name__ == '__main__':
    typical_stairs()


### FIXED CODE ###

def typical_stairs():
    n, m = map(int, input().split())
    dangerous = set(int(input()) for _ in range(m))
    mod = 1000000007
    dp = [0] * (n + 1)
    dp[0] = 1
    if 1 not in dangerous:
        dp[1] = 1
    for i in range(2, n + 1):
        if i not in dangerous:
            dp[i] = dp[i - 2] + dp[i - 1]
    print(dp[-1] % mod)


if __name__ == '__main__':
    typical_stairs()
import sys

def input():
    return sys.stdin.readline()[:-1]

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

# 0 - n-1
a = sorted(list(map(int, input().split())))

for j in range(m):
    b, newVal = map(int, input().split())
    if b >= n:
        a_new = [i if i >= newVal else newVal for i in a]
    else:
        mae = a[:b]
        ato = a[b:]
        mae_new = [i if i >= newVal else newVal for i in mae]
        mae_new.extend(ato)
        a = sorted(mae_new)

print(sum(a))

### FIXED CODE ###

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

if a >= 13:
    print(b)
elif a >= 6:
    print(int(b/2))
else:
    print(0)
n = int(input())
s = input()
#white
i=0
num=0
while s[i]==".":
    num+=1
    i+=1
    if i == n:
        break
#  ..##.#..
n = s.count(".")
answ = n-num

#black
j=-1
numb=0
while s[j]=="#":
    numb+=1
    j-=1
    if j*(-1) == n:
        break
m = s.count('#')
ansb=m-numb

if ansb<=answ:
    print(ansb)
else:
    print(answ)


### FIXED CODE ###

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

a = []
#  .##..#.##.
w = s.count(".")
b = s.count("#")
m = min(w,b)

bb=0

for i in range(n):
    if s[i]=='.':
        w-=1
        a.append(bb+w)
    if s[i]=='#':
        bb += 1
        a.append(bb+w)
if len(a)>0:
    I = min(a)
    print(min(m,I))
else:
    print(m)
A, B = map(int, input())
print((A + B) % 24)

### FIXED CODE ###

A, B = map(int, input().split())
print((A + B) % 24)
import numpy as np


def main():
    n, k = map(int, input().split())
    ps = (np.array(list(map(int, input().split()))) + 1) / 2

    if k == 1:
        ans = max(ps)
    else:
        cumulative_sum = [0] * n
        for i in range(n):
            if i == 0:
                cumulative_sum[i] = ps[0]
            else:
                cumulative_sum[i] = ps[i] + cumulative_sum[i-1]
    
        ans = max([cumulative_sum[i+k] - cumulative_sum[i] for i in range(n-k)])
        print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n, k = map(int, input().split())
    ps = list(map(int, input().split()))
    e = [(1+p)/2 for p in ps]

    s = [0]
    for i in range(n):
        s.append(s[i]+e[i])

    ans = max([s[i+k] - s[i] for i in range(n-k+1)])
    print(ans)


if __name__ == "__main__":
    main()