Problem:


Score : 100 points

Problem Statement

In some other world, today is December D-th.

Write a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.

Constraints

22 \leq D \leq 25

D is an integer.

Input

Input is given from Standard Input in the following format:

D

Output

Print the specified string (case-sensitive).

Sample Input 1

25

Sample Output 1

Christmas

Sample Input 2

22

Sample Output 2

Christmas Eve Eve Eve

Be sure to print spaces between the words.



Sample input:
25


Sample output:
Christmas

Submission status: Runtime Error

Solution code:
n = int(import())
if n == 25:
  print("Christmas")
elif n == 24:
  print("Christmas Eve")
elif n == 23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")

Submission status: Runtime Error

Solution code:
n = int(input())
2.2.if n == 25:
3.3.  print("Christmas")
4.4.elif n == 24:
5.5.  print("Christmas Eve")
6.6.elif n == 23:
7.7.  print("Christmas Eve Eve")
8.8.else:
9.9.  print("Christmas Eve Eve Eve")

Submission status: Runtime Error

Solution code:
n = int(imput())
2.if n == 25:
3.  print("Christmas")
4.elif n == 24:
5.  print("Christmas Eve")
6.elif n == 23:
7.  print("Christmas Eve Eve")
8.else:
9.  print("Christmas Eve Eve Eve")

Submission status: Runtime Error

Solution code:
n = int(import())
if n == 25:
  print("Christmas")
elif n == 24:
  print("Christmas Eve")
elif n == 23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")

Submission status: Runtime Error

Solution code:
inp=map(input())
if inp==25:
    print('Christmas')

Submission status: Runtime Error

Solution code:
inp=map(input)
if inp==25:
    print('Christmas')

Submission status: Runtime Error

Solution code:
import numpy as np

asd = np.array([1,2,2])
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
a.sort()
ans=int(0)
for i in range(n-1):
    ans = ans + a[i]
ans = ans + a[-1]/2
print(int(ans))

Submission status: Runtime Error

Solution code:
N = int(input())
list1 = []
for i in range(0,N,1):
    list1.append(int (input()))
    if i > 0:
        if list1[i] >= list1[i-1]:
            max = i
list1[max] = list1[max]//2

print(int(sum(list1)))

Submission status: Runtime Error

Solution code:
N = int(input())
list1 = []
for i in range(0,N,1):
    list1.append(int (input()))
    if i > 0:
        if list1[i] > list1[i-1]:
            max = i
list1[max] = list1[max]/2

print(int(sum(list1)))

Submission status: Runtime Error

Solution code:
n, x = map(int, input().split())


def pi(n):
    return 2**(n+1)-1


def ai(n):
    return 2**(n+2) - 3


def f(n, x):
    if (x <= 1) or (n <= 0):
        return 0
    elif (1 < x) and (x <= 1 + ai(n-1)):
        return f(n - 1, x - 1)
    elif x == 2 + ai(n - 1):
        return pi(n - 1) + 1
    elif (2 + ai(n - 1) < x) and (x <= 2 + 2 * ai(n - 1)):
        return pi(n-1) + 1 + f(n-1, x-2-ai(n-1))
    elif x >= ai(n):
        return pi(n)


print(f(n, x))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h)
print(min(h[i+K-1]-h[i] for i in range(N-K+1)))

Submission status: Runtime Error

Solution code:
if D == 25:
  print("Chrismas")
elif D == 24:
  print("Chrismas Eve")
elif D == 23:
  print("Chrismas Eve Eve")
else:
  print("Chrismas Eve Eve Eve")

Submission status: Runtime Error

Solution code:
d = int(input())
if d==25:
    print(Christmas)
if d==24:
    print(Christmas Eve)
if d==23:
    print(Christmas Eve Eve)
if d==22:
    print(Christmas Eve Eve Eve)

Submission status: Runtime Error

Solution code:
p=[int(input()) for i in range(int(input()))]
print(sum(p)-max(p)//2)

Submission status: Runtime Error

Solution code:
n = int(intput())
if n == 22:
	print("Christmas Eve Eve Eve")
elif n == 23:
  	print("Christmas Eve Eve Eve")
elif n == 24:
  	print("Christmas Eve Eve")
elif n == 25:
  	print("Christmas Eve")

Submission status: Runtime Error

Solution code:
n = int(intput())
if n == 22:
  print("Christmas Eve Eve Eve")
elif n == 23:
  print("Christmas Eve Eve Eve")
elif n == 24:
  print("Christmas Eve Eve")
elif n == 25:
  print("Christmas Eve")

Submission status: Runtime Error

Solution code:
D = int(input())

if D ==25:
  print("Christmas")
elif D ==24:
  print("Christmas Eve")
elif D ==23:
  print("Christmas Eve Eve")
else D ==22:
  print("Christmas Eve Eve Eve")

Submission status: Runtime Error

Solution code:
D = int(input())

if D==25:
  print("Christmas")
  elif D==24:
    print("Christmas Eve")
    elif D==23:
      print("Christmas Eve Eve")
      else D==22:
        print("Christmas Eve Eve Eve")

Submission status: Runtime Error

Solution code:
N, X = map(int, input().split())

a, p = [1], [1]
for i in range(N):
  a.append(a[i] * 2 + 3)
  p.append(p[i] * 2 + 1)

def f(N, X): # X <= 0 や X > a_N を許容し解説本文から簡略化
  if N == 0:
    return 0 if X <= 0 else 1
  elif X <= 1 + a[N-1]:
    return f(N-1, X-1)
  elif X == 2 + a[N-1]:
    return p[N-1] + 1
  elif X == 3 + 2 * a[N-1]:
    return 2 * p[N-1] + 1
  else:
    return p[N-1] + 1 + f(N-1, X-2-a[N-1])
print(f(N, X))

Submission status: Runtime Error

Solution code:
import sys 
a = sys.argv[1]
if a == '25':
    print('Christmas')
if a == '24':
    print('Christmas Eve')
if a == '23':
    print('Christmas Eve Eve')
if a == '22':
    print('Christmas Eve Eve Eve')

Submission status: Runtime Error

Solution code:
#coding:utf-8
a = int(input('a = '))

if a == 25:
	print "Christmas"
if  a == 24:
	print "Christmas Eve"
if  a == 23:
	print "Christmas Eve Eve"
if a==22:
	print "Christmas Eve Eve Eve"

Submission status: Runtime Error

Solution code:
#coding:utf-8

def count(a):
	if a == 25:
		print "Christmas"
	if  a == 24:
		print "Christmas Eve"
	if  a == 23:
		print "Christmas Eve Eve"
	if a==22:
		print "Christmas Eve Eve Eve"

if __name__ == "__main__":
    print('入力してください')
    b = input('a = ')
    count(b)

Submission status: Runtime Error

Solution code:
#coding:utf-8

def count(a):
	if a == 25:
		print "Christmas"
	elif  a == 24:
		print "Christmas Eve"
	elif  a == 23:
		print "Christmas Eve Eve"
	elif a==22:
		print "Christmas Eve Eve Eve"

if __name__ == "__main__":
    print('入力してください')
    b = input('a = ')
    count(b)

Submission status: Runtime Error

Solution code:
#coding:utf-8

def count(a):
	if 'a == 25':
		print "Christmas"
	elif  'a == 24':
		print "Christmas Eve"
	elif  'a == 23':
		print "Christmas Eve Eve"
	elif  'a == 22':
		print "Christmas Eve Eve Eve"

if __name__ == "__main__":
    print('入力してください')
    a = input('a = ')
    count(a)

Submission status: Runtime Error

Solution code:
#coding:utf-8

def count():
	if 'a == 25':
		print "Christmas"
	elif  'a == 24':
		print "Christmas Eve"
	elif  'a == 23':
		print "Christmas Eve Eve"
	elif  'a == 22':
		print "Christmas Eve Eve Eve"

if __name__ == "__main__":
    print('入力してください')
    a = input('a = ')
    count(a)

Submission status: Runtime Error

Solution code:
firstLine = input().split(" ")
valn = int(firstLine[0])
valk = int(firstLine[1])
valh = []

for vali in range(valn):
    valh.append(int(input()))

valh.sort()

smallest = 1000000001
for vali in range(valn - valk + 1):
    diff = valh[vali + valk - 1] - valh[vali]
    if diff < smallest:
        smallest = diff

print(smallest)

Submission status: Runtime Error

Solution code:
firstLine = input().split(" ")
valn = int(firstLine[0])
valk = int(firstLine[1])
valh = []

for vali in range(valn):
    valh.append(int(input()))

valh.sort()

smallest = 1000000001
for vali in range(valn - valk + 1):
    diff = valh[vali + valk - 1] - valh[vali]
    if diff < smallest:
        smallest = diff

print(smallest)

Submission status: Runtime Error

Solution code:
import sys

firstLine = sys.stdin.readline().split(" ")
valn = int(firstLine[0])
valk = int(firstLine[1])
valh = []

for vali in range(valn):
    valh.append(int(sys.stdin.readline()))

valh.sort()

smallest = 1000000001
for vali in range(valn - valk + 1):
    diff = valh[vali + valk - 1] - valh[vali]
    if diff < smallest:
        smallest = diff

print(smallest)

Submission status: Runtime Error

Solution code:
eve="Christmas"
for x in range(input()):
	eve += "Eve"
print(eve)

Submission status: Runtime Error

Solution code:
D = input()
eve = 'Eve'
print("Christmas " + eve * (25 - D))

Submission status: Runtime Error

Solution code:
hoge

Submission status: Runtime Error

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-


nnk = input().split(" ")
n = int(nnk[0])
k = int(nnk[1])

hs = [int(input()) for l in range(n)]
hs.sort()

hmmm = []
for l in range(n-k+1):
    hmmm.append(hs[k+l-1] - hs[l])

hmmm.sort()
print(hmmm[0])

Submission status: Runtime Error

Solution code:
nnk = list(map(lambda x: int(x), input().split(" ")))
n = nnk[0]
k = nnk[1]

hs = [int(input()) for l in range(n)]
hs.sort()

hmmm = []
for l in range(n-k+1):
    hmmm.append(hs[k+l-1] - hs[l])

hmmm.sort()
print(hmmm[0])

Submission status: Runtime Error

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-


nnk = list(map(lambda x: int(x), input().split(" ")))
n = nnk[0]
k = nnk[1]

hs = [int(input()) for l in range(n)]
hs.sort()

num = n - k + 1

hmmm = []
for l in range(num):
    hmmm.append(hs[k+l-1] - hs[l])

hmmm.sort()
print(hmmm[0])

Submission status: Runtime Error

Solution code:
D = int(input())
if D = 25:
	print("Christmas")
elif D = 24:
	print("Christmas Eve")
elif D = 23:
	print("Christmas Eve Eve")
else:
	print("Christmas Eve Eve Eve")

Submission status: Runtime Error

Solution code:
D=input()
if D==25:
  print("Christmas")
  elif D==24:
    print("Christmas Eve")
    elif D==23:
      print("Christmas Eve Eve")
      elif D==22:
        print("Christmas Eve Eve Eve")

Submission status: Runtime Error

Solution code:
Num = []
Num = list(map(int,input().split(" "))) #0-all 1-pick
lists = []
for i in range(0,Num[0]):
    lists.append(int(input()))
lists.sort()
lists.reverse()
dist = lists[0] - lists[0+Num[1]-1]
for j in range(1,Num[0] - Num[1] + 1):
    tmp = lists[j] - lists[j+Num[1]-1]
    if (dist > tmp):
        dist = tmp
print(dist)

Submission status: Runtime Error

Solution code:
X = int(input())
if (D == 25):
    print("Christmas")
elif (D == 24):
    print("Christmas Eve")
elif (D == 23):
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")

Submission status: Runtime Error

Solution code:
D = int(input("date? "))
if D = 22:
    print("Chsistmas Eve Eve Eve")
elif D = 23:
    print("Christmas Eve Eve")
elif D = 24:
    print("Christmas Eve")
else D = 25:
    print("Christmas")

Submission status: Runtime Error

Solution code:
D = int(input(date? ))
if D = 22:
    print("Chsistmas Eve Eve Eve")
elif D = 23:
    print("Christmas Eve Eve")
elif D = 24:
    print("Christmas Eve")
elif D = 25:
    print("Christmas")

Submission status: Runtime Error

Solution code:
D = int(input(date? ))
if D = 22:
    print("Chsistmas Eve Eve Eve")
elif D = 23:
    print("Christmas Eve Eve")
elif D = 24:
    print("Christmas Eve")
else D = 25:
    print("Christmas")

Submission status: Runtime Error

Solution code:
n,k = input().split(' ')
n = int(n)
k = int(k)
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
diffs = []
for i in range(n-k+1):
    diffs.append(h[i+k] - h[i])
print(min(diffs))

Submission status: Runtime Error

Solution code:
n = int(input())
p = [int(input()) for i in range(n)]

print(int(sum(p)-max(p)/2))

Submission status: Runtime Error

Solution code:
D = input()

if D == 25:
    print("Christmas")
elif D == 24:
    print("Christmas Eve")
elif D == 23:
    print("Christmas Eve Eve")
elif:
    print("Christmas Eve Eve Eve")

Submission status: Runtime Error

Solution code:
print('Christmas' + ' Eve' * (25) - int(input()))

Submission status: Runtime Error

Solution code:
print('Christmas' + ' Eve' * (int(input()) - D))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
D = int(input())
print("Christmas"+"Eve"*(D-25).split())

Submission status: Runtime Error

Solution code:
D=int(input())
if D==22:
  print(Christmas Eve Eve Eve)
elif D==23:
  print(Christmas Eve Eve)
elif D==24:
  print(Christmas Eve)
else:
  print(Christmas)

Submission status: Runtime Error

Solution code:
D=int(input())
print(" ".join(["Christmas"]+["Eve"]*(25-D))

Submission status: Runtime Error

Solution code:
n=int(input())
if n=25:
  print('Christmas')
elif n=24:
  print('Christmas Eve')
elif n=23:
  print('Christmas Eve Eve')
elif n=22:
  print('Christmas Eve Eve Eve')

Submission status: Runtime Error

Solution code:
n = int(input())
if n==22:
  print(Christmas Eve Eve Eve)
elif n==23:
  print(Christmas Eve Eve)
elif n==24:
  print(Christmas Eve)
else:
  print(Christmas)

Submission status: Runtime Error

Solution code:
n = int(input())
p = [input() for i in range(n)]
max_value = p.index(max(p))
p[max_value] = int(p[max_value]) / 2
sum = 0
for i in range(len(p)):
    sum += int(p[i])
print(sum)

Submission status: Runtime Error

Solution code:
NK = input()
NK = N.split(" ")
N = int(NK[0])
K = int(NK[1])


h = []
for i in range(N):
  h.append(int(input()))
  
  
h.sort()
ans = h[-1] - h[0]

for i in range(N-K+1):
  ans = min(ans, h[i+K-1] - h[i])
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())


p = []
for i in range(N):
  p.append(int(input()))
  
p_max = p.index(max(p))


p[p_max] = p[p_max] / 2 

print(int(sum(p)))

Submission status: Runtime Error

Solution code:
D = int(input())

if D == 25:
 print("Christmas")
else if D == 24:
 print("Christmas Eve")
else if D== 23:
 print("Christmas Eve Eve")
else:
 print("Christmas Eve Eve Eve")

Submission status: Runtime Error

Solution code:
day = int(input())
if day == 22:
  print('Christmas Eve Eve Eve')
else if day == 23:
   print('Christmas Eve Eve')
else if day == 24:
   print('Christmas Eve')
else:
  print( print('Christmas)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
trees = [int(input()) for i in range(N)]
trees.sort()
ans = 10 ** 10
for i in range(N - K + 1):
    ans = min(ans, abs(trees[i]-trees[i+K-1]))
print(ans)

Submission status: Runtime Error

Solution code:
import sys
n=input()
list = n.split(" ")
n=int(list[0])
k=int(list[1])

trees = []
for i in range(n):
  trees.append(int(input()))

def merge_sort(alist):
  if len(alist) <= 1:
    return alist
  
  mid = int(len(alist)/2)
  left = alist[:mid]
  right = alist[mid:]
  
  left = merge_sort(left)
  right = merge_sort(right)
  
  return merge(left, right)

def merge(left,right):
  sorted_list = []
  left_index = 0
  right_index = 0
  
  while left_index < len(left) and right_index < len(right):
    if left[left_index] >= right[right_index]:
      sorted_list.append(left[left_index])
      left_index += 1
    else:
      sorted_list.append(right[right_index])
      right_index += 1
      
  if left:
    sorted_list.extend(left[left_index:])
    
  if right:
    sorted_list.extend(right[right_index:])
    
    return sorted_list

trees = merge_sort(trees)

ans=sys.maxsize
flag=0
temp = []

for i in range(len(trees)-k+1):
  diff = trees[i]-trees[i+k-1]
  if(diff==0):
    ans=0
    break
  if(ans>diff):
    ans=diff
  temp.clear()

print(ans)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
h = [int(input()) for i in range(n)]
h.sort()
answer = h[-1] - h[0]
for i in range(n - k + 1):
    answer = min(answer, h[i + k - 1] - h[i])
print(answer)

Submission status: Runtime Error

Solution code:
N,X = map(int,input().split())
B = [-1 for i in range(51)]
P = [-1 for i in range(51)]

def buns(L):
    if L == 0:#再帰終了条件
        B[L] = 0
        return B[L]
    else:
        if B[L] == -1:
            B[L] = buns(L-1)*2 + 2
            return B[L]
        else:
            return B[L]

def patty(L):
    if L == 0:#再帰終了条件
        P[L] = 1        
        return P[L]
    else:
        if P[L] == -1:
            P[L] = patty(L-1)*2 + 1
            return P[L]
        else:
            return P[L]

buns(N)
patty(N)
memo = [B[i] + P[i] for i in range(51)]

def func(L,X):

    if L == 0:
        if X <= 0:
            return 0
        else:
            return 1
    elif X <= memo[L-1]+1:
        return func(L-1,X-1)
    else :
        return P[L-1] + 1 + func(L-1,X-2-memo[L-1])


print(func(N,X))

Submission status: Runtime Error

Solution code:
N,K=list(map(int,input().split()))
h=[int(input()) for i in range(N)]
 
h.sort()
 
m="a"
for i in range(N-K+1):
	if m=="a" or m>h[i+K-1]-h[i]: m=h[i+K-1]-h[i]
 
print(m)

Submission status: Runtime Error

Solution code:
N, K = list(map(int,input().split()))
h =  [int(input()) for i in range(N)]
h.sort()
m = "a"
for i in range(N - K + 1):
    if m=="a" or m>h[i+K-1]:
        m = h[i+K-1] - h[i]
print(m)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
N = int(input)
print("Christmas" + "Eve"*(25 - n))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
N = int(input)
print("Christmas" + "Eve"*(25 - n).split())

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
N = int(input)
print("Christmas" + "Eve"*(25 - n).split)

Submission status: Runtime Error

Solution code:
N = int(input())
p = []
for i in range(N):
    _p = int(input())
    p.append(_p)
biggest = 0
j = 0
for i in range(N):
    if(p[i]>=biggest):
        j = i
        biggest=p[i]
p[j] = p[j] / 2
print(int(sum(p)))

Submission status: Runtime Error

Solution code:
N = int(input())
p = []
for i in range(N):
    _p = int(input())
    p.append(_p)
biggest = 0
j = 0
for i in range(N):
    if(p[i]>biggest):
        j = i
        biggest=p[i]
p[j] = p[j] / 2
print(int(sum(p)))

Submission status: Runtime Error

Solution code:
print("Christmas"+[" Eve"for i in-int(input())%5])

Submission status: Runtime Error

Solution code:
print("Christmas"+" Eve"*int(input())%5)

Submission status: Runtime Error

Solution code:
print("Christmas"+" Eve"*(25-int(innput())))

Submission status: Runtime Error

Solution code:
N,K = list(map(int, input().split()))
h = [int(input()) for i in range(N)]
candidate = None
h.sort()
for i in range(N-K+1):
    tmp = h[i+K-1] - h[i]
    if candidate == None or tmp < candidate:
        candidate = tmp
print(candidate)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python

from sys import stdin, stderr

DPL = [0] * 56
DPP = [0] * 56

def F(n, x):
   if x == 0:
      return 0

   if x == 1:
      return 1 if n == 0 else 0

   if x == DPL[n]:
      return DPP[n]

   if x == 1 + DPL[n-1] + 1:
      return DPP[n-1] + 1
   elif x > 1 + DPL[n-1] + 1:
      return DPP[n-1] + 1 + F(n-1, x - (1 + DPL[n-1] + 1))
   else:
      return F(n-1, x-1)

def main():
   N, X = map(int, stdin.readline().split())

   DPL[0] = 1
   DPP[0] = 1
   for n in xrange(1, N+1):
      DPL[n] = 2*DPL[n-1] + 3
      DPP[n] = 2*DPP[n-1] + 1

   res = F(N, X)
   print(res)

   return 0

if __name__ == '__main__': main()

Submission status: Runtime Error

Solution code:
N, X = input().split()

N = int(N)
X = int(X)

all = 2**(N+2)-3
b_all = 0
for i in range(N+1):
    if i > 0:
        b_all += 2**i

p_all = all - b_all

first = 1
last = all

get = 0
for i in range(N):
    if i < N-1:
        if (first + last) / 2 == X:
            get += (p_all + 1) / 2
            break

        elif (first + last) / 2 < X:
            get += (p_all + 1) / 2
            p_all -= (p_all + 1) / 2
            first = (first + last) / 2 + 1
            last = last - 1

            if first == X:
                break
        elif (first + last) / 2 > X:
            p_all = (p_all - 1) / 2
            last = (first + last) / 2 - 1
            first = first + 1

            if last == X:
                get += p_all
                break
    else:
        if first == X:
            break
        elif last == X:
            get += 3
        else:
            get += X - first
            break

print(int(get))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
c=[]
for i in range(a):
	c.append(int(input()))
c=sorted(c)
#print(c)
f=[]
for k in range(a-b+1):
	e=[]
	f.append(e)
	for i in range(b):
		e.append(c[i+k])
#print(f)
g=[]
for i in range(len(f)):
	g.append(max(f[i])-min(f[i]))
print(min(g))

Submission status: Runtime Error

Solution code:
N, X = map(int, input().split())

a, p = [1], [1]

for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(N, X):
    if N == 0:
        #return 0 if X <= 0 else 1
        return 0
    elif X <= 1 + a[N-1]:
        return f(N - 1, X - 1)
    else:
        return p[N - 1] + 1 + f(N - 1, X - 2 - a[N - 1])

print(f(N, X))

Submission status: Runtime Error

Solution code:
N,X = map(int,input().split())

PforL = [1]
HforL = [1]
for i in range(1,51):
    PforL.append(PforL[i-1]*2+1)
    HforL.append(HforL[i-1]*2+3)

def recursive(n,x):
    if x<=n:
        return 0
    if x<=HforL[n-1]+1:
        return recursive(n-1,x-1)
    else:
        return PforL[n-1]+1+recursive(n-1,x-HforL[n-1]-2)

print(recursive(N,X))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=[]
for _ in range(n):
    l.append(int(input()))
l.sort()
a=0
for i in range(n-k+1):
    if i==0:
        a=l[i+k-1]-l[i]
    else:
        a=min(a,abs(l[i+k-1]-l[i]))
print(a)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
h = [int(input()) for i in range(N)]
h.sort()
print(min(h[i+K-1] - h[i] for i in range(N-K+1)))

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
h=[int(input()) for i in range(n)]
h=sorted(h)
mi=float('inf')
 
for i in range(n-k+1):
    mi = min(mi, h[i+k-1]-h[i])
 
print(mi)

Submission status: Runtime Error

Solution code:
N,X=(int(x) for x in input().split())
tmp='P'
for i in range(N):
    tmp='B'+tmp+'P'+tmp+'B'
print(tmp[0:X].count('P'))

Submission status: Runtime Error

Solution code:
n,x=[int(i) for i in input().split()]
p=[1]
b=[0]
z=[]
for i in range(n):
  p.append(p[i]*2+1)
  b.append(b[i]*2+2)
  z.append(p[i]+b[i])
ans=0
ici=0
for i in range(n-1, -1, -1):
  if x-ici>z[i]+1:
    ici+=z[i]+2
    ans+=p[i]+1
  elif x-ici<z[i]+1:
    ici+=1
  else:
    ans+=p[i]
    break
print(ans)

Submission status: Runtime Error

Solution code:
# coding:utf-8

N, X = map(int, input().split())

def eatBan(c, w):
        return c, w+1
def eatPan(c, w):
    return c+1, w+1
def checkWalk(w, X):
    if w == X:
        return True
    else:
        return False

def createNBurger(w, c, n, X):
    if n == 0:
        c, w = eatPan(c, w)
        return c, w
    else:
        # バン食べる
        c, w = eatBan(c, w)
        if checkWalk(w, X):
            c, w, True
        # N-1 バーガー
        c, w = createNBurger(w, c, n-1, X)
        if checkWalk(w, X):
            c, w, True
        # パティ食べる
        c, w = eatPan(c, w)
        if checkWalk(w, X):
            c, w, True
        # N-1 バーガー
        c, w = createNBurger(w, c, n-1, X)
        if checkWalk(w, X):
            return c, w, True
        # バン食べる
        c, w = eatBan(c, w)
        if checkWalk(w, X):
            c, w, True
        return c, w, False

# Nバーガー作成
c = 0
w = 0
c, w , t= createNBurger(w, c, N, X)

# eat_p = 0
# for i, c in enumerate(burger):
#     if c == "P":
#         eat_p += 1
#     if i == X-1:
#         break
print(c)

Submission status: Runtime Error

Solution code:
N,X=(int(x) for x in input().split())
burger=[]
burger.append('P')
for i in range(N):
    burger.append('B'+burger[-1]+'P'+burger[-1]+'B')
print(burger[-1][0:X].count('P'))

Submission status: Runtime Error

Solution code:
in_t = input().split()
n = int(in_t[0])
k = int(in_t[1])
list = []
for i in range(k):
 list.append(int(input()))
for i in range(n - k):
 new = int(input())
 if (list[k-1] > new) | (new > list[2]):
  list.append(new)
  list.sort()
  diff_max = list[k-1] - list[k-2]
  diff_min = list[1] - list[2]
  if (diff_max > diff_min):
   list.remove(list[0])
  else:
    list.remove(list[k-1])
print(list[k-1] - list[0])

Submission status: Runtime Error

Solution code:
import collections

def conv(cc, ks, K):
    tm=max([sum(cc[j:j+(ks+1)]) for j in range(len(cc)-(ks-1))])
    if tm>=K:
        return ks
    else:
        return conv(cc, ks+1, K)

N, K=map(int, input().split())
h=[int(input()) for i in range(N)]

cc=list(collections.Counter(h).values())

print(conv(cc,0,K))

Submission status: Runtime Error

Solution code:
N=int(input())
P=[int(input()) for n in range(N)]

a=-100
for i in range(N):
  if a<P[i]:
    a=P[i]

P.remove(a)

goukei=a/2
for j in range(N-1):
  goukei+=P[j]

print(int(goukei))

Submission status: Runtime Error

Solution code:
N,X = [int(i) for i in input().split()]

def get_next_burger(current_burger) :
	return "B" + current_burger + "P" + current_burger + "B"

current = "P"

for i in range(N) :
	current = get_next_burger(current)

target = current[:X]
print(target.count("P"))

Submission status: Runtime Error

Solution code:
N, X = map(int, input().split())

def get_lburger(l):
    lburger = [1]
    for i in range(l):
        lburger = [0] + lburger + [1] + lburger + [0]
    return lburger

if __name__ == "__main__":
    print(sum(get_lburger(N)[:X]))

Submission status: Runtime Error

Solution code:
a = int(input())
if a == 25:
    print("Christmas")
elif a == 24:
    print("Christmas Eve")
elif a == 23:
    print("Christmas Eve Eve")
    else:
        print("Christmas Eve Eve Eve")

Submission status: Runtime Error

Solution code:
import pdb

def eat(n, x):
    ret = 0

    if x == 0:
        return 0, x

    if n == 0:
        x -= 1
        return 1, x

    if allnum[n] <= x:
        x -= allnum[n]
        return pnum[n], x
        
    
    x -= 1 # eat bread
    if x == 0:
        return 0, x

    # eat n-1 beager
    tmp, x = eat(n - 1, x)
    ret += tmp
    if x == 0:
        return ret, x

    # eat patty
    x -= 1
    ret += 1
    if x == 0:
        return ret, x

    # eat n-1 beager
    tmp, x = eat(n - 1, x)
    ret += tmp
    if x == 0:
        return ret, x

    x -= 1 # eat bread
        
    return ret, x


def main():
    tmp = input().split()
    n = int(tmp[0])
    x = int(tmp[1])
    global pnum
    global allnum
    pnum = [1]
    allnum = [1]
    for i  in range(1, 52):
        pnum.append(pnum[i-1] * 2 + 1)
        allnum.append(allnum[i-1] * 2 + 3)

    ans, tmp = eat(n, x)

    print("%d" % ans)

        
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
h1, h2 = map(int, input().split())
l = []
l.append(h1)
l.append(h2)
for i in range(N-2):
    h = int(input())
    global l
    if len(l) < K:
        l.append(h)
    elif len(l) >= K:
        if h > min(l):
            l[l.index(min(l))] = h
        if h < max(l):
            l[l.index(max(l))] = h
print(max(l) - min(l))

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

al = [0, 5] + [0] * 49
bl = [0, 3] + [0] * 49


def solve2(ans, x, idx, cnt):
    if idx == 1:
        return ans + (0, 0, 1, 2, 3, 3, 3)[x] + [0, 1][cnt >= 1]
    if x == (al[idx] // 2) + 1:
        return ans + bl[idx - 1] + 1 + [0, 1][cnt >= 1]
    elif x > (al[idx] // 2) + 1:
        ans += bl[idx - 1]
        x -= (al[idx] // 2)
        cnt += 1
    return solve2(ans, x, idx - 1, cnt)


def solve():
    n, x = map(int, input().split())
    for i in range(2, n + 1):
        al[i] = al[i - 1] * 2 + 3
        bl[i] = bl[i - 1] * 2 + 1
    ans = solve2(0, x, n, 0)
    print(ans)


if __name__ == "__main__":
    solve()

Submission status: Runtime Error

Solution code:
import pdb
import sys
sys.setrecursionlimit(10000)

def eat(n, x):
    ret = 0

    if x == 0:
        return 0, x

    if n == 0:
        x -= 1
        return 1, x

    if allnum[n] <= x:
        x -= allnum[n]
        return pnum[n], x
        
    
    x -= 1 # eat bread
    if x == 0:
        return 0, x

    # eat n-1 beager
    tmp, x = eat(n - 1, x)
    ret += tmp
    if x == 0:
        return ret, x

    # eat patty
    x -= 1
    ret += 1
    if x == 0:
        return ret, x

    # eat n-1 beager
    tmp, x = eat(n - 1, x)
    ret += tmp
    if x == 0:
        return ret, x

    x -= 1 # eat bread
        
    return ret, x


def main():
    tmp = input().split()
    n = int(tmp[0])
    x = int(tmp[1])
    global pnum
    global allnum
    pnum = [1]
    allnum = [1]
    for i  in range(1, 52):
        pnum.append(pnum[i-1] * 2 + 1)
        allnum.append(allnum[i-1] * 2 + 3)

    ans, tmp = eat(n, x)

    print("%d" % ans)

        
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n,x = map(int,input().split())
l1='BPPPB'
for i in range(n-1):
    l2 = 'B'+l1+'P'+l1+'B'
    l1 = l2
y = l1[:x].count('P')
print(y)

Submission status: Runtime Error

Solution code:
N=int(input())
P=[int(N) for N in input().split()]

a=-100
for i in range(N):
  if a<P[i]:
    a=P[i]

P.remove(a)

goukei=a/2
for j in range(N-1):
  goukei+=P[j]

print(int(goukei))

Submission status: Runtime Error

Solution code:
n = int(input())
p = list(map(int, input().split()))
p.sort(reverse=True)
a = p[1:]
b = p[0] // 2
print(sum(a, b))

Submission status: Runtime Error

Solution code:
a, b = (int(i) for i in input().split()) 

list=[]
 
for i in range(a):
    list.append(int(input()))

new_list = sorted(list)

sabun = None

for i in range(len(new_list)-1):

    if i+b == len(new_list):
        break

    bbb = new_list[i+b-1] - new_list[i]

    if sabun == None:
        sabun = bbb
        continue

    if sabun > bbb:
        sabun = bbb
    
print(sabun)

Submission status: Runtime Error

Solution code:
N=int(input())
P=[int(N) for N in input().split()]

a=-100
for i in range(N):
  if a<P[i]
    a=P[i]

P.remove(P[i])

goukei=a/2
for j in range(N-1):
  goukei+=P[j]

print(int(goukei))

Submission status: Runtime Error

Solution code:
N = int(input())
a = [int(input()) for i in range(N)]

total = int(max(a)/2)
print(max(a))
print(total)
a.remove(max(a))
print(a)
total += sum(a)

Submission status: Runtime Error

Solution code:
n,k = map(int, input().split())
h = [int(input()) for i in range(n)] 
h.sort()

crr_min = 10^9

for i in range(0,n-k+1):
    tmp = h[n-k+i] - h[0+i]
    if tmp<crr_min:
        crr_min=tmp

print(crr_min)

Submission status: Runtime Error

Solution code:
N, X = map(int, input().split())
bager = []
bager.append("P")

for i in range(1, N+1):
    bagernow = "B" + bager[i-1] + "P" + bager[i-1] + "B"
    bager.append(bagernow)

bagerN = str(bager[N])

runbager = bagerN[:(X)]

Ans = runbager.count("P")

print(Ans)

Submission status: Runtime Error

Solution code:
D = int(input())

if D==22:
    (print) "Christmas Eve Eve Eve Eve"

if D==23:
    (print) "Christmas Eve Eve"

if D==24:
    (print) "Christmas Eve"

if D==25:
    (print) "Christmas "

Submission status: Runtime Error

Solution code:
#coding:utf-8
s=[int(i) for i in input().split()]
n=[]
for i in range(s[0]):
  n.append(int(input()))
n.sort()
sa=abs(n[0]-n[s[1]]-1)
for i in range(s[1]):
  print(n[1],n[i+s[1]-1])
  if(sa>abs(n[i]-n[i+s[1]-1])):
    sa=abs(n[i]-n[i+s[1]-1])
print(sa)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
hei_list = []
for i in range(n):
    tmp = int(input())
    hei_list.append(tmp)
hei_list.sort()
for i in range(n-k+1):
    tmp_dist = hei_list[i + k - 1] - hei_list[i]
    if i == 0:
        min_dist = tmp_dist
    elif tmp_dist < min_dist:
        min_dist = tmp_dist
print(min_dist)

Submission status: Runtime Error

Solution code:
#coding:utf-8

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

h=[]
for i in range(N):
    h_i = int(input())
    h.append(h_i)

h = sorted(h)

min_val = 100000000000
for i in range(N-K+1):
    min_val = min(abs(h[i+K-1] - h[i]), min_val)
print(min_val)