problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p03208
u417014669
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,s=map(int, input().split())\nN=[]\nfor _ in range(n):\n N.append(int(input()))\nN=sorted(N)\nfor i in range(s-1,len(N)):\n diff_list.append(N[i]-N[i-s+1])\nprint(min(diff_list))', 'n,s=map(int, input().split())\nN=[]\nfor _ in range(n):\n N.append(int(input()))\nN=sorted(N)\ndiff_list=[]\nfor i in range(s-1,len(N)):\n diff_list.append(N[i]-N[i-s+1])\nprint(min(diff_list))']
['Runtime Error', 'Accepted']
['s257908493', 's830995965']
[8280.0, 10892.0]
[223.0, 248.0]
[178, 191]
p03208
u422673384
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['NK = input()\nNK = N.split(" ")\nN = int(NK[0])\nK = int(NK[1])\n\nh = []\nfor i in range(N):\n h.append(int(input()))\n \nh.sort()\nans = h[-1] - h[0]\n\nfor i in range(N-K+1):\n ans = min(ans, h[i-K+1] - h[i])\nprint(ans)', 'NK = input()\nNK = N.split(" ")\nN = int(NK[0])\nK = int(NK[1])\n\n\nh = []\nfor i in range(N):\n h.append(int(input()))\n \n \nh.sort()\nans = h[-1] - h[0]\n\nfor i in range(N-K+1):\n ans = min(ans, h[i+K-1] - h[i])\nprint(ans)', 'NK = input()\nNK = N.split(" ")\nN = int(NK[0])\nK = int(NK[1])\n\nh = []\nfor i in range(N):\n h.append(int(input()))\n \n \nh.sort()\nans = h[-1] - h[0]\n\nfor i in range(N-K+1):\n ans = min(ans, h[i+K-1] - h[i])\nprint(ans)', 'NK = input()\nNK = NK.split(" ")\nN = int(NK[0])\nK = int(NK[1])\n\n\nh = []\nfor i in range(N):\n h.append(int(input()))\n \n \nh.sort()\nans = h[-1] - h[0]\n\nfor i in range(N-K+1):\n ans = min(ans, h[i+K-1] - h[i])\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s017917312', 's352815339', 's908760914', 's420512389']
[3064.0, 3064.0, 3064.0, 7488.0]
[18.0, 18.0, 18.0, 258.0]
[214, 216, 215, 217]
p03208
u426108351
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int, input().split())\ntree = []\nfor i in range(N):\n tree.append(int(input()))\ntree.sort()\nmini = 1000000000\nfor i in range(N-K+1):\n mini = min(mini, tree[i+K-1]-[i])\nprint(mini)\n ', 'N, K = map(int, input().split())\ntree = []\nfor i in range(N):\n tree.append(int(input()))\ntree.sort()\nmini = 1000000000\nfor i in range(N-K+1):\n mini = min(mini, tree[i+K-1]-tree[i])\nprint(mini)\n ']
['Runtime Error', 'Accepted']
['s526113307', 's655312695']
[7384.0, 7440.0]
[226.0, 251.0]
[193, 197]
p03208
u426649993
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['if __name__ == "__main__":\n N, K = map(int, input().split())\n h = list()\n for i in range(N):\n h.append(int(input()))\n\n h = sorted(h)\n\n res = 10 ** 9 + 1\n for i in range(N-K + 1):\n if res > h[i] - h[i+K]:\n res = h[i] - h[i+K]\n \n print(res)\n', 'if __name__ == "__main__":\n N, K = map(int, input().split())\n h = list()\n for i in range(N):\n h.append(int(input()))\n\n h = sorted(h)\n\n res = 10 ** 9 + 1\n for i in range(N-K+1):\n if res > h[i+K-1] - h[i]:\n res = h[i+K-1] - h[i]\n \n print(res)\n']
['Runtime Error', 'Accepted']
['s438622458', 's524805824']
[8280.0, 8280.0]
[237.0, 251.0]
[288, 290]
p03208
u430726059
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k=map(int, input().split())\nh=[]\nfor i in range(n):\n h.append(int(input()))\nh.sort()\nans=h[k-1]-h[0]\nfor i in range(1,n-k):\n ans=min(ans,h[i+k-1]-h[k])\nprint(ans)', 'n,k=map(int, input().split())\nh=[]\nfor i in range(n):\n h.append(int(input()))\nh.sort()\nans=h[k-1]-h[0]\nfor i in range(1,n-k+1):\n ans=min(ans,h[i+k-1]-h[i])\nprint(ans)']
['Wrong Answer', 'Accepted']
['s814069565', 's670842199']
[13356.0, 13392.0]
[202.0, 193.0]
[166, 168]
p03208
u432333240
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
["import numpy as np\nN, K = map(int,input().split())\nH = np.array([int(input()) for _ in range(0, N)])\nH = np.sort(H)\n#print(H)\nH_diff = abs(H[1:]-H[:-1])\n#print(H_diff)\nbest = np.sum(H_diff[0, K-1])\nfor i in range(0, len(H_diff)-K+2):\n #print(i)\n if np.sum(H_diff[i:i+K-1]) < best:\n #print(H_diff[i:i+K-1])\n best = np.sum(H_diff[i:i+K-1])\n#print('best:{}'.format(best))\nprint(best)", 'import numpy as np\nN, K = map(int,input().split())\nH = np.array([int(input()) for _ in range(0, N)])\nH = np.sort(H)\nH_diff = abs(H[1:]-H[:-1])\n#best = (H[-1] - H[0])*K\nH_diff = np.sort(H_diff)\n\n\n\nprint(H_diff)\nprint(np.sum(H_diff[0:K-1]))', "import numpy as np\nN, K = map(int,input().split())\nH = np.array([int(input()) for _ in range(0, N)])\nH = np.sort(H)\nH_diff = np.diff(H)\nbest = int(np.min(np.convolve((H_diff), np.ones(K-1), mode='valid')))\nprint(best)"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s767832015', 's949605393', 's389772301']
[17124.0, 17104.0, 17928.0]
[321.0, 319.0, 1518.0]
[400, 352, 217]
p03208
u433532588
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['\n\nimport sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(2147483647)\nINF=float("inf")\nMOD=10**9+7\n# A = [ int(input()) for _ in range(N) ]\n##############################\n\nfrom collections import Counter\n\nN, K = map(int, input().split())\nH = [ int(input()) for _ in range(N) ]\n\nc = Counter(H)\n#print(c)\n\nt = []\nfor k, v in c.most_common():\n if K >= v:\n K -= v\n t.append(k)\n else:\n t.append(k)\n K = 0\n\n if K == 0:\n break\n\nprint(max(t) - min(t))', '\nimport sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(2147483647)\nINF=float("inf")\nMOD=10**9+7\n# A = [ int(input()) for _ in range(N) ]\n##############################\n\nN, K = map(int, input().split())\nH = [ int(input()) for _ in range(N) ]\n\nH.sort()\n\nans = INF\nfor i in range(N-K+1):\n ans = min(ans, H[i+K-1]-H[i])\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s385465050', 's626388057']
[21372.0, 7384.0]
[133.0, 135.0]
[491, 336]
p03208
u434872492
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int,input().split())\nh = []\nfor i in range(N):\n x = int(input())\n h.append(x)\n\nh.sort()\nm = []\nfor i in range(N):\n m.append(h[i+K-1] - h[i])\n\nprint(min(m))', 'N, K = map(int,input().split())\nh = []\nfor i in range(N):\n x = int(input())\n h.append(x)\n\nh.sort()\nm = []\nfor i in range(N-K+1):\n m.append(h[i+K-1] - h[i])\n\nprint(min(m))']
['Runtime Error', 'Accepted']
['s218382646', 's832410613']
[11292.0, 11288.0]
[246.0, 248.0]
[175, 179]
p03208
u438189153
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k=map(int,input().split())\nans=[]\nfor i in range(n):\n ans.append(int(input()))\nans.sort()\nprint(min(ans[i+k-1]-ans[i] for j in range(n-k+1)))\n\n', 'n,k=map(int,input().split())\nans=[]\nfor i in range(n):\n ans.append(int(input()))\nans.sort()\nprint(min(ans[j+k-1]-ans[j] for j in range(n-k+1)))\n']
['Runtime Error', 'Accepted']
['s357595448', 's948592448']
[13236.0, 13312.0]
[162.0, 177.0]
[148, 147]
p03208
u442877951
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N,K = map(int,input().split())\nh = list(map(int,input().split()))\nh.sort(reverse = True)\nl = [0]*(N-(K-1))\nfor i in range(N-(K-1)):\n l[i] = h[i]-h[i+K-1]\nans = min(l)\nprint(ans)', 'N,K = map(int,input().split())\nh = list(map(int,input().split()))\nh.sort()\nans = min(h[i]-h[i+K] for i in range(N-K))\nprint(ans)', 'N,K = map(int,input().split())\nh = [int(input()) for i in range(N)]\nh.sort(reverse = True)\nl = [0]*(N-(K-1))\nfor i in range(N-(K-1)):\n l[i] = h[i]-h[i+K-1]\nans = min(l)\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s429069093', 's538078622', 's706153024']
[3828.0, 3060.0, 11036.0]
[19.0, 17.0, 239.0]
[178, 128, 180]
p03208
u449473917
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['# coding: utf-8\n# Your code here!\nN,K = [int(i) for i in input().split()]\n\nl = [int(input()) for j in range(N)]\nl = sorted(l)\ndif = 1000000000\nfor a in range(N-K+1):\n d = l[a+K-1] - l[a]\n print(a)\n print(d)\n if dif >= d:\n dif = d\n\nprint(dif)\n', '# coding: utf-8\n# Your code here!\nN,K = [int(i) for i in input().split()]\n\nl = [int(input()) for j in range(N)]\nl = sorted(l)\ndif = 1000000000\nfor a in range(N-K+1):\n d = l[a+K-1] - l[a]\n #print(a)\n #print(d)\n if dif >= d:\n dif = d\n\nprint(dif)\n']
['Wrong Answer', 'Accepted']
['s077084669', 's171340331']
[8436.0, 8204.0]
[372.0, 247.0]
[261, 263]
p03208
u450904670
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['import collections\nn,k = map(int, input().split())\nh = [ int(input()) for _ in range(n) ]\nh_cnt = collections.Counter(h)\n\n\ncnt = 0\nfor num, value in h_cnt.most_common():\n if(cnt == 0):\n h_max = num\n remain = k - value\n else:\n remain -= value\n if(remain <= 0):\n print(abs(h_max - num))\n exit()\n cnt += 1', 'N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\nh.sort()\nprint(min(h[i+K-1] - h[i] for i in range(N-K+1)))']
['Wrong Answer', 'Accepted']
['s823997139', 's898919516']
[21372.0, 7484.0]
[253.0, 224.0]
[321, 128]
p03208
u451598761
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
["def main():\n if 'get_ipython' not in globals(): \n # For Subsession\n N = int(input())\n K = int(input())\n h = []\n for _ in range(N):\n h.append(int(input()))\n else:\n # N = 5\n # K g= 3\n # h = [10,15,11,14,12]\n N = 5\n K = 3\n h = [5,7,5,7,7]\n\n h.sort()\n for i in range(0,len(h)-2):\n if i == 0:\n ans = (h[2] - h[1]) + (h[1] - h[0])\n else:\n tmp = (h[i+2] - h[i+1]) + (h[i+1] - h[i])\n if ans > tmp:\n ans = tmp\n \n print(ans)\n\nmain()", "import sys\ndef main():\n if 'get_ipython' not in globals(): \n # For Subsession\n N,K = map(int, input().split())\n h = []\n for _ in range(N):\n h.append(int(input()))\n else:\n N = 5\n K = 3\n h = [10,15,11,14,12]\n # N = 5\n # K = 3\n # h = [5,7,5,7,7]\n\n h.sort() \n\n ans = (h[K-1] - h[0])\n \n max_i = len(h)-K+1\n for i in range(1,max_i):\n tmp = (h[i+K-1] - h[i])\n if ans > tmp:\n ans = tmp\n if ans == 0:\n print(ans)\n sys.exit()\n \n print(ans)\n\nmain()"]
['Runtime Error', 'Accepted']
['s788264573', 's667443518']
[3064.0, 7440.0]
[17.0, 225.0]
[495, 507]
p03208
u460468647
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k = map(int,input().split())\nh = sorted([int(input()) for _ in range(n)])\nprint(h)\nans = []\nfor i in range(n-k+1):\n ans.append(h[i+k-1]-h[i])\nprint(min(ans))', 'n,k = map(int,input().split())\nh = sorted([int(input()) for _ in range(n)])\nans = []\nfor i in range(n-k+1):\n ans.append(h[i+k-1]-h[i])\nprint(min(ans))']
['Wrong Answer', 'Accepted']
['s641714951', 's908054493']
[12084.0, 10892.0]
[246.0, 239.0]
[160, 151]
p03208
u463655976
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['import heapq\n\nn, k = map(int, input().split())\n\nh = []\nfor _ in range(n):\n heapq.heappush(h, int(input()))\n\nq = [heapq.heappop(h) for _ in range(k-1)]\n\nans = 1e9\nwhile len(h):\n p = i % (k-1)\n s = q[p]\n e = heapq.heappop(h)\n q[p] = e\n ans = min(ans, e - s)\n\nprint(ans)\n', 'import heapq\n\nn, k = map(int, input().split())\nh = []\nd = [0 for _ in range(n)]\nans = 1e9\n\nfor _ in range(n):\n # h.append(int(input()))\n heapq.heappush(h, int(input()))\n\nh = [heapq.heappop(h) for _ in range(n)]\n\nfor i in range(n - k + 1):\n diff = h[i + k - 1] - h[i]\n ans = min(ans, diff)\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s544840906', 's435436337']
[7496.0, 8372.0]
[262.0, 306.0]
[286, 312]
p03208
u464912173
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n, k = map(int,input().split())\nh = list(int(input()) for i in range(n)) \nh=sorted(h)\nx=[]\nfor i in range(n-k+1):\n b = h[i+k-1]-h[i]\nx.append(b)\nprint(min(x))', 'n, k = map(int,input().split())\nh = list(int(input()) for i in range(n)) \nh=sorted(h)\nx=[]\nfor i in range(n-k+1):\n b = h[i+k-1]-h[i]\n x.append(b)\nprint(min(x))']
['Wrong Answer', 'Accepted']
['s861223349', 's217863956']
[8264.0, 10904.0]
[229.0, 249.0]
[162, 164]
p03208
u466143662
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,p=map(int,input().split())\n\nitem=[]\nfor i in range(n):\n p=int(input())\n item.append(p)\n \nitem.sort()\ntemp=[]\nfor i in range(n-1):\n a=item[i+1]-item[i]\n temp.append(a)\n \ntemp.sort()\nprint(temp[0])', 'n,p=map(int,input().split())\n\nitem=[]\nfor i in range(n):\n b=int(input())\n item.append(b)\n \nitem.sort()\ntemp=[]\n\nfor i in range(n-p):\n a=item[i+p]-item[i]\n temp.append(a)\n \ntemp.sort()\nprint(temp[0])', 'n,p=map(int,input().split())\n\nitem=[]\nfor i in range(n):\n b=int(input())\n item.append(b)\n \nitem.sort()\ntemp=[]\n\nfor i in range(n-p+1):\n a=item[i+p-1]-item[i]\n temp.append(a)\n \ntemp.sort()\nprint(min(temp))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s700432329', 's793866725', 's018487201']
[11216.0, 11212.0, 11416.0]
[287.0, 279.0, 288.0]
[215, 216, 222]
p03208
u466331465
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N,K = [int(x) for x in input().split()]\nH = [0]*N\nfor i in range(N):\n H[i] = int(input())\nH.sort(reverse=True)\nans= H[0]-H[K-1]\nprint(ans)', 'N,K = [int(x) for x in input().split()]\nH = [0]*N\nfor i in range(N):\n H[i] = int(input())\nH.sort(reverse=True)\nans = 100000000000000000\nfor i in range(N-K+1):\n ans = min(ans,H[i]-H[i+K-1])\nprint(ans)']
['Wrong Answer', 'Accepted']
['s059643344', 's517193724']
[7472.0, 7472.0]
[222.0, 251.0]
[139, 201]
p03208
u470101103
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
["n_k = input()\nn_k_list =n_k.split(' ')\n\nN = int(n_k_list[0])\nK = int(n_k_list[1])\n\nh_list = [0] * N\nfor i in range(N):\n h_list[i] = int(input())\n\nsorted_h_list = sorted(h_list)\nprint(sorted_h_list)\n\n# print(h_list)\nmin_dif = 1000000000\nfor i in range(N-K+1):\n start = i\n end = K - 1 + i\n # print('start,end', start, end)\n end_v = sorted_h_list[end]\n start_v = sorted_h_list[start]\n dif = end_v - start_v\n # print('dif', dif)\n \n if min_dif > dif:\n min_dif = dif\n\nprint(int(min_dif))", "n_k = input()\nn_k_list =n_k.split(' ')\n\nN = int(n_k_list[0])\nK = int(n_k_list[1])\n\nh_list = [0] * N\nfor i in range(N):\n h_list[i] = int(input())\n\nsorted_h_list = sorted(h_list)\n\nmin_dif = 1000000000\nfor i in range(N-K+1):\n start = i\n end = K - 1 + i\n\n end_v = sorted_h_list[end]\n start_v = sorted_h_list[start]\n dif = end_v - start_v\n\n if min_dif > dif:\n min_dif = dif\n\nprint(int(min_dif))"]
['Wrong Answer', 'Accepted']
['s850041811', 's564910515']
[11300.0, 8240.0]
[260.0, 244.0]
[545, 417]
p03208
u474423089
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['5 3\n5\n7\n5\n7\n7', "N,K=map(int,input().split(' '))\nh=sorted([int(input()) for i in range(N)])\nans = 10**9\nfor i in range(N-K+1):\n ans = min(ans,h[i+K-1]-h[i])\nprint(ans)\n"]
['Runtime Error', 'Accepted']
['s699865529', 's973493837']
[2940.0, 8280.0]
[17.0, 253.0]
[13, 154]
p03208
u476124554
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N,K = map(int,input().split())\nh = []\nfor _ in range(N):\n h.append(int(input()))\nh = sorted(h)\ntmp = 0\nans = 1000000000\nfor i in range(K):\n if(K+i == K):\n break\n tmp = h[K+i-1] - h[0+i]\n if(tmp < ans):\n ans = tmp\nprint(ans)', 'N,K = map(int,input().split())\nh = []\nfor _ in range(N):\n h.append(int(input()))\nh = sorted(h)\ntmp = 0\nans = 1000000000\nloop = min(K+1,N-K+1)\nfor i in range(loop+1):\n tmp = h[K+i-1] - h[0+i]\n if(tmp < ans):\n ans = tmp\nprint(ans)', 'N,K = map(int,input().split())\nh = []\nfor _ in range(N):\n h.append(int(input()))\nh = sorted(h)\ntmp = 0\nloop = N-K+1\nfor i in range(loop):\n tmp = h[K+i-1] - h[0+i]\n if(tmp < ans):\n ans = tmp\nprint(ans)', 'N,K = map(int,input().split())\nh = []\nfor _ in range(N):\n h.append(int(input()))\nh = sorted(h)\ntmp = 0\nloop = N-K+1\nfor i in range(loop):\n tmp = h[K+i-1] - h[0+i]\n if(tmp < ans):\n ans = tmp\nprint(ans)', 'N,K = map(int,input().split())\nh = []\nfor _ in range(N):\n h.append(int(input()))\nh = sorted(h)\ntmp = 0\nans = 10000000000\nloop = N-K+1\nfor i in range(loop):\n tmp = h[K+i-1] - h[0+i]\n if(tmp < ans):\n ans = tmp\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s315658404', 's789794145', 's799098571', 's840796496', 's798239038']
[8280.0, 8280.0, 8280.0, 8280.0, 8280.0]
[221.0, 240.0, 222.0, 222.0, 245.0]
[249, 244, 216, 216, 234]
p03208
u480200603
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
["n, k = map(int, input().split())\ntree = [int(input()) for _ in range(n)]\ntree.sort()\nresult = float('INF')\ncumulative = [0]\nfor i in range(n - 1):\n cumulative.append(tree[i + 1] - tree[i])\nfor i in range(n - k):\n result = min(result, cumulative[i + k - 1] - cumulative[i])\nprint(result)\n", "n, k = map(int, input().split())\ntree = [int(input()) for _ in range(n)]\ntree.sort()\nresult = float('INF')\ncumulative = [0]\nfor i in range(n - 1):\n cumulative.append(tree[i + 1] - tree[i] + cumulative[i])\nfor i in range(n - k + 1):\n result = min(result, cumulative[i + k - 1] - cumulative[i])\nprint(result)\n"]
['Wrong Answer', 'Accepted']
['s940246721', 's437725671']
[11192.0, 11304.0]
[289.0, 306.0]
[293, 313]
p03208
u482157295
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k = map(int, input().split())\nh = [int(input()) for i in range(n)]\nh.sort()\nans = h[1] - h[0]\nfor j in range(0,k-n):\n if ans < h[j+k-1] - h[0]:\n ans = h[j+k-1] - h[0]\nprint(ans)', 'n,k = map(int, input().split())\nh = [int(input()) for i in range(n)]\nh.sort()\nans = h[k-1] - h[0]\nfor j in range(0,n-k+1):\n if h[j+k-1] - h[j] < ans:\n ans = h[j+k-1] - h[j]\nprint(ans)']
['Wrong Answer', 'Accepted']
['s671671111', 's289017287']
[7384.0, 7384.0]
[215.0, 227.0]
[183, 188]
p03208
u484229314
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = list(map(int, input().split()))\nH = sorted([int(input()) for _ in range(N)])\n\nmin_h = 1e15\nfor i in range(N-K+1):\n tmp = H[i+K-1] - H[i]\n if tmp < min_h:\n min_h = tmp\n', 'N, K = list(map(int, input().split()))\nH = sorted([int(input()) for _ in range(N)])\n\nmin_h = 1e15\nfor i in range(N-K+1):\n tmp = H[i+K-1] - H[i]\n if tmp < min_h:\n min_h = tmp\nprint(min_h)\n']
['Wrong Answer', 'Accepted']
['s183534765', 's811491900']
[8280.0, 8280.0]
[234.0, 232.0]
[187, 200]
p03208
u485716382
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
["def main():\n N, K = map(int, input().split(' '))\n \n \n \n \n trees = [int(input()) for _ in range(N)]\n trees.sort()\n trees = [n - trees[0] for n in trees]\n \n \n MIN = 100000000000000\n # print(trees)\n for n in range(K):\n t = trees[n+K-1] - trees[n]\n print(trees[n], trees[n+K-1])\n MIN = min(t, MIN)\n print(MIN)\nmain()", "def main():\n N, K = map(int, input().split(' '))\n \n \n \n \n trees = [int(input()) for _ in range(N)]\n trees.sort()\n trees = [n - trees[0] for n in trees]\n \n \n # MIN = 100000000000000\n # print(trees)\n # for n in range(K):\n # for n in range(N - K + 1):\n # t = trees[n+K-1] - trees[n]\n # MIN = min(t, MIN)\n MIN = min([trees[n+K-1] - trees[n] for n in range(N-K+1)])\n print(MIN)\n\nmain()"]
['Runtime Error', 'Accepted']
['s217209129', 's089303303']
[11216.0, 11216.0]
[286.0, 227.0]
[740, 807]
p03208
u487594898
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['import sys\ninput = sys.stdin.readline\nn,m= map(int,input().split())\n\nB = []\nC = [0]*n\nans = 0\npna = 0\nfor i in range(m):\n A = list(map(str,input().split()))\n if A[0] not in B:\n if A[1]=="AC" :\n B.append(A[0])\n ans += 1\n pna += C[int(A[0])-1]\n \telse:\n \t C[int(A[0])-1] += 1 \nprint(ans,pna)', 'import sys\ninput = sys.stdin.readline\nn,m= map(int,input().split())\nA = [ int(input()) for _ in range(n)]\na=sorted(A)\nans = 10 **10\nfor i in range(n-m+1):\n ans = min(abs(a[i+m-1] - a[i]),ans)\nprint(ans)']
['Runtime Error', 'Accepted']
['s533937706', 's132028306']
[3064.0, 8276.0]
[18.0, 134.0]
[343, 205]
p03208
u488934106
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
["def cChristmas(n, k, hl):\n\n\n hl.sort()\n ans = 10**10\n\n for i in range(n-k+1):\n print(hl[i+k-1],hl[i])\n ans = min(ans, hl[i+k-1]-hl[i])\n\n return ans\n\ndef main():\n n, k = map(int, input().split())\n hl = [int(input()) for i in range(n)]\n print(cChristmas(n, k, hl))\n\nif __name__ == '__main__':\n main()\n", "def cChristmas(n, k, hl):\n\n\n hl.sort()\n ans = 10**10\n\n for i in range(n-k+1):\n ans = min(ans, hl[i+k-1]-hl[i])\n\n return ans\n\ndef main():\n n, k = map(int, input().split())\n hl = [int(input()) for i in range(n)]\n print(cChristmas(n, k, hl))\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s096068896', 's396422497']
[9036.0, 7444.0]
[366.0, 226.0]
[337, 306]
p03208
u490305870
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N ,K = map(int,input().split())\nh = [int(input()) for i in range(N)]\nh.sort()\n# print(h)\nmin=h[N-1]\nfor i in range(N):\n if(i+K>N):\n break\n tmp = h[i+K-1]-h[i]\n if(min>tmp):\n min = tmp\nprint(min)', 'N ,K = map(int,input().split())\nh = [int(input()) for i in range(N)]\nh.sort()\n# print(h)\nmin=h[N-1]\nfor i in range(N):\n if(i+K>N):\n break\n tmp = h[i+K-1]-h[i]\n if(min>tmp):\n min = tmp\nprint(min)']
['Wrong Answer', 'Accepted']
['s109992885', 's771408664']
[7384.0, 7488.0]
[210.0, 240.0]
[209, 203]
p03208
u497625442
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int,input().split())\nh = [int(input()) for i in range(N)].sort()\n# print(h)\n\nMIN = 10**10\nfor i in range(N-K):\n\tif h[i+K-1] - h[i] <= MIN:\n\t\tMIN = h[i+K-1] - h[i]\n#\tprint(i,h[i],h[i+K-1])\nprint(MIN)\n\n', 'N, K = map(int,input().split())\nh = [0 for i in range(N)]\nfor i in range(N):\n\th[i] = int(input())\nh.sort()\n# print(h)\n\nMIN = 10**10\nfor i in range(N-K+1):\n\tif h[i+K-1] - h[i] <= MIN:\n\t\tMIN = h[i+K-1] - h[i]\n# print(i,h[i],h[i+K-1])\nprint(MIN)\n\n']
['Runtime Error', 'Accepted']
['s316042002', 's510849496']
[7384.0, 7392.0]
[210.0, 239.0]
[211, 244]
p03208
u497952650
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N,K = map(int,input().split())\nh = [int(input()) for _ in range(N)]\nh.sort()\nans = 1e10\nfor i in range(N-K+1):\n tmp = h[i:i+K]\n print(tmp)\n ans = min(ans,max(tmp)-min(tmp))\n\n\nprint(ans)', 'N,K = map(int,input().split())\nh = [int(input()) for _ in range(N)]\nh.sort()\nans = 1e10\nfor i in range(N-K+1):\n ans = min(ans,h[i+K-1]-h[i])\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s806043614', 's388298425']
[115412.0, 7384.0]
[2104.0, 243.0]
[194, 155]
p03208
u501750652
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['import numpy as np\nN = int(input())\nK = int(input())\n\ne = [0]*N\n\nfor i in range(N):\n e[i] = int(input())\n\nfor i in range(N):\n print("i",i)\n for j in range(N): \n if e[i] < e[j]:\n tmp = e[i]\n e[i] = e[j]\n e[j] = tmp\n\nf = [0]*(N - K + 1)\nfor i in range(N-K+1):\n f[i] = e[K + i - 1] - e[i]\n\nprint(np.min(np.array(f)))', 'import numpy as np\nN = int(input())\nK = int(input())\n\ne = [0]*N\n\nfor i in range(N):\n e[i] = int(input())\n\nfor i in range(N):\n for j in range(N): \n if e[i] < e[j]:\n tmp = e[i]\n e[i] = e[j]\n e[j] = tmp\n\nf = [0]*(N - K + 1)\nfor i in range(N-K+1):\n f[i] = e[K + i - 1] - e[i]\n\nprint(np.min(np.array(f)))', 'import numpy as np\nN,K=input().split()\nN = int(N)\nK = int(K)\ne = [0]*N\n\nfor i in range(N):\n e[i] = int(input())\n\n\n# for j in range(N): \n# if e[i] < e[j]:\n# tmp = e[i]\n# e[i] = e[j]\n# e[j] = tmp\n\ne = list(sorted(e))\n\nf = [0]*(N - K + 1)\nfor i in range(N-K+1):\n f[i] = e[K + i - 1] - e[i]\n\nprint(np.min(np.array(f)))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s171744729', 's651992968', 's012915786']
[12392.0, 12396.0, 20732.0]
[150.0, 154.0, 392.0]
[370, 353, 387]
p03208
u506287026
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int, input().split())\nhs = sorted([int(input()) for _ in range(N)])[::-1]\n# N, K = 5, 3\n# hs = [15, 14, 12, 11, 10]\n\nmin_diff = 10 ** 10\nfor i in range(0, N-K+1):\n tmp = hs[i:i+1]\n min_diff = min(min_diff, tmp[0] - tmp[-1])\n\nprint(min_diff)\n', 'N, K = map(int, input().split())\nhs = sorted([int(input()) for _ in range(N)])[::-1]\n\nmin_diff = 10 ** 10\nfor i in range(N-K+1):\n min_diff = min(min_diff, hs[i] - hs[i+K-1])\n\nprint(min_diff)\n']
['Wrong Answer', 'Accepted']
['s753958561', 's001929486']
[8252.0, 8280.0]
[272.0, 252.0]
[258, 194]
p03208
u509739538
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K, *h = map(int, open(0).read().split())\nh.sort()\nans=float("inf")\nfor i in range(len(h)-k+1):\n\tma = h[i+k-1]\n\tmi = h[i]\n\tans = min(ans,ma-mi)\n\nprint(ans)', 'N, K, *h = map(int, open(0).read().split())\nh = sorted(h)\nans=float("inf")\nfor i in range(len(h)-k+1):\n\tma = h[i+k-1]\n\tmi = h[i]\n\tans = min(ans,ma-mi)\n\nprint(ans)', 'n,k=map(int,input().split())\nh=[int(input()) for i in range(n)]\nh.sort()\nans=float("inf")\nfor i in range(len(h)-k+1):\n\tma = h[i+k-1]\n\tmi = h[i]\n\tans = min(ans,ma-mi)\n\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s177589853', 's279157394', 's997410373']
[20124.0, 20124.0, 13276.0]
[61.0, 62.0, 188.0]
[157, 162, 177]
p03208
u515364861
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k=map(int,input().split)\na=[]\nc=[]\nfor i in range(n):\n b=int(input())\n a.append(b)\nsorted(a)\nfor u in range(n-1):\n d=a[u+k-1]-a[u]\n c.append(d)\nprint(min(c))', 'n,k = map(int,input().split())\na=[]\nc=[]\nfor i in range(n):\n b=int(input())\n a.append(b)\na.sort()\nfor u in range(n-k+1):\n d=a[u+k-1]-a[u]\n c.append(d)\nprint(min(c))']
['Runtime Error', 'Accepted']
['s733352394', 's847651130']
[3064.0, 11164.0]
[17.0, 254.0]
[171, 176]
p03208
u516554284
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
[',k=map(int,input().split())\na=[]\nfor x in range(n):\n a.append(int(input()))\nans=1000000009\na=sorted(a)\nfor y in range(n-k+1):\n ans=min(a[y+k-1]-a[y],ans)\n \nprint(ans)\n\n', 'n,k=map(int,input().split())\na=[]\nfor i in range(n):\n a.append(int(input()))\nb=sorted(a)\nprint(b[n-1]-b[n-k+1])', 'n,k=map(int,input().split())\na=[]\nfor x in range(n):\n a.append(int(input()))\nans=1000000009\nsorted(a)\nfor y in range(n-k):\n ans(a[y+k-1]-a[y],ans)\n \nprint(ans)', 'n,k=map(int,input().split())\na=[]\nfor i in range(n):\n a.append(input())\nb=sort.a\nprint(b(n-1)-b(n-k+1))', 'n,k=map(int,input().split())\na=[]\nfor i in range(n):\n a.append(int(input()))\nb=sorted(a)\nprint(b[n-1]-b[n-k+1])\n', 'n,k=map(int,input().split())\na=[]\nfor x in range(n):\n a.append(int(input()))\nans=1000000009\na=sorted(a)\nfor y in range(n-k+1):\n ans=min(a[y+k-1]-a[y],ans)\n \nprint(ans)\n\n']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s046908091', 's347679113', 's382513412', 's806912788', 's994210998', 's087449327']
[8868.0, 8280.0, 14096.0, 10268.0, 8280.0, 13932.0]
[24.0, 225.0, 167.0, 152.0, 220.0, 198.0]
[171, 112, 162, 104, 113, 172]
p03208
u517447467
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, M = list(map(int, input().split()))\nK = [int(input()) for i in range(N)]\nK = sorted(K)\nprint(min([K[i+M-1]-K[i] for i in range(N-M+1)])', 'N, M = list(map(int, input().split()))\nK = [int(input()) for i in range(N)]\nK = sorted(K)\nprint(min([K[i+M-1]-K[i] for i in range(N-M+1)]))']
['Runtime Error', 'Accepted']
['s649083909', 's971870083']
[2940.0, 10868.0]
[17.0, 227.0]
[138, 139]
p03208
u518556834
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k = map(int,input().split())\na = [int(input()) for i in range(n)]\nb = [a[i+1]-a[i] for i in range(n-1)]\nc = []\np = 0\nm = 0\nfor i in range(n-k+1):\n for j in range(k-1):\n p += b[j+m]\n c.append(p)\n m += 1\n p = 0\nprint(min(c))\n \n', 'n,k = map(int,input())\na = [int(input()) for i in range(n)]\na.sort()\nans = []\nfor i in range(n-k+1):\n ans.append(a[i+k-1] - a[i])\nprint(min(ans))\n \n', 'n,k = map(int,input().split())\na = [int(input()) for i in range(n)]\na.sort()\nans = []\nfor i in range(n-k+1):\n ans.append(a[i+k-1] - a[i])\nprint(min(ans))\n \n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s417901650', 's878021139', 's908511181']
[15012.0, 3060.0, 11288.0]
[2104.0, 17.0, 230.0]
[229, 148, 156]
p03208
u518987899
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
["import sys\nN,K = list(map(int, input().strip().split(' ')))\ntrees = [int(line.strip()) for line in sys.stdin]\ntrees = sorted(trees)\nprint(min([trees[i+(N-1)]-trees[i] for i in range(len(trees)-(N-1))]))", "import sys\nN,K = list(map(int, input().strip().split(' ')))\ntrees = [int(line.strip()) for line in sys.stdin]\ntrees = sorted(trees)\nprint(min([trees[i+(K-1)]-trees[i] for i in range(len(trees)-(K-1))]))\n"]
['Wrong Answer', 'Accepted']
['s370723152', 's135510607']
[8276.0, 10936.0]
[89.0, 108.0]
[202, 203]
p03208
u525595811
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n, k = list(map(int, input().split()))\nh = []\nfor i in range(n):\n h.append(int(input()))\n\nm = 10e9\nh.sort()\nfor i in range(len(h)-k):\n if h[i+k-1]-h[i] <= m:\n print(h[i+k-1],h[i])\n m = h[i+k-1] - h[i]\nprint(m)\n', 'n, k = list(map(int, input().split()))\nh = []\nfor i in range(n):\n h.append(int(input()))\n\nm = []\nh.sort()\nfor i in range(len(h)-k+1):\n m.append(h[i+k-1] - h[i])\nprint(sorted(m)[0])']
['Wrong Answer', 'Accepted']
['s595643973', 's329550146']
[7512.0, 12056.0]
[238.0, 280.0]
[230, 186]
p03208
u527261492
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k=map(int,input().split())\nh=[int(input()) for i in range(n)]\nh.sort()\nd=[0]*(n-1)\nfor j in range(n-1):\n d[j+1]=d[j]+h[j+1]-h[j]\nm=1000000001\nfor l in range(n-k):\n m=min(m,d[l+k-1]-d[l])\nprint(m)\n \n \n \n ', 'n,k=map(int,input().split())\nh=[int(input()) for i in range(n)]\nh.sort()\nd=[0]*(n-1)\nfor j in range(n-1):\n d[j+1]=d[j]+h[j+1]-h[j]\nm=1000000001\nfor l in range(1,n-k+1):\n m=min(m,d[l+k-1]-d[l])\nprint(m)\n \n \n \n \n', "n,k=map(int,input().split())\nh=[int(input()) for i in range(n)]\nh.sort()\nd=[0]*(n-1)\nfor j in range(n-1):\n d[j+1]=d[j]+h[j+1]-h[j]\nm=float('inf')\nfor l in range(1,n-k+1):\n m=min(m,d[l+k-1]-d[l])\nprint(m)\n \n \n \n \n", "n,k=map(int,input().split())\nh=[int(input()) for i in range(n)]\nh.sort()\nd=[0]*n\nfor j in range(n-1):\n d[j+1]=d[j]+h[j+1]-h[j]\nm=float('inf')\nfor l in range(n-k+1):\n m=min(m,d[l+k-1]-d[l])\nprint(m)\n \n \n \n \n"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s102053218', 's152877969', 's607251906', 's306269723']
[10960.0, 10960.0, 11008.0, 11004.0]
[253.0, 251.0, 259.0, 290.0]
[211, 216, 218, 212]
p03208
u528748570
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\n\n#def sort(h):\n# if len(h) <= 1:\n# return h\n# base = h[-1]\n# low_temp = [];\n# high_temp = [];\n# base_count = 1\n\n# if h[i] < base:\n# low_temp.append(h[i])\n# elif h[i] > base:\n# high_temp.append(h[i])\n# else:\n# base_count += 1\n# low = sort(low_temp)\n# high = sort(high_temp)\n# return low + [base]*base_count + high\nh.sort()\nhantei = 10**10\nfor i in range(N-K+1):\n temp = h[i:i+K]\n temp_dif = temp_dif[-1] - temp_dif[0]\n if temp_dif < hantei:\n hantei = temp_dif\nprint(hantei)\n', 'N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\n\n\n#def sort(h):\n# if len(h) <= 1:\n# return h\n# base = h[-1]\n# low_temp = [];\n# high_temp = [];\n# base_count = 1\n\n# if h[i] < base:\n# low_temp.append(h[i])\n# elif h[i] > base:\n# high_temp.append(h[i])\n# else:\n# base_count += 1\n# low = sort(low_temp)\n# high = sort(high_temp)\n# return low + [base]*base_count + high\n\nh.sort()\nhantei = 10**10\nfor i in range(N-K+1):\n temp = h[i:i+K]\n if (temp[-1] - temp[0]) < hantei:\n hantei = temp_dif\n\nprint(hantei)\n', 'N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\n\n\n#def sort(h):\n# if len(h) <= 1:\n return h\n# base = h[-1]\n# low_temp = [];\n# high_temp = [];\n# base_count = 1\n\n# if h[i] < base:\n# low_temp.append(h[i])\n# elif h[i] > base:\n# high_temp.append(h[i])\n# else:\n# base_count += 1\n# low = sort(low_temp)\n# high = sort(high_temp)\n# return low + [base]*base_count + high\n\nh.sort()\nhantei = 10**10\nfor i in range(N-K+1):\n temp = h[i:i+K]\n temp_dif = max(temp) - min(temp)\n if temp_dif < hantei:\n hantei = temp_dif\n\nprint(hantei)\n', 'N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\n\n\n#def sort(h):\n# if len(h) <= 1:\n# return h\n# base = h[-1]\n# low_temp = [];\n# high_temp = [];\n# base_count = 1\n\n# if h[i] < base:\n# low_temp.append(h[i])\n# elif h[i] > base:\n# high_temp.append(h[i])\n# else:\n# base_count += 1\n# low = sort(low_temp)\n# high = sort(high_temp)\n# return low + [base]*base_count + high\n\nh.sort()\nhantei = 10*9\nfor i in range(N-K+1):\n if (h[i+K] - h[i]) < hantei:\n hantei = h[i+K] - h[i]\nprint(hantei)', '1 N, K = map(int, input().split())\n2 h = [int(input()) for i in range(N)]\n3 h.sort()\n4 print(min(h[i+K-1] - h[i] for i in range(N-K+1)))', 'N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\n\n\n#def sort(h):\n# if len(h) <= 1:\n# return h\n# base = h[-1]\n# low_temp = [];\n# high_temp = [];\n# base_count = 1\n\n# if h[i] < base:\n# low_temp.append(h[i])\n# elif h[i] > base:\n# high_temp.append(h[i])\n# else:\n# base_count += 1\n# low = sort(low_temp)\n# high = sort(high_temp)\n# return low + [base]*base_count + high\n\nh.sort()\nhantei = 10*9\nfor i in range(N-K+1):\n if (h[i+K-1] - h[i]) < hantei:\n hantei = h[i+K] - h[i]\nprint(hantei)\n', 'N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\nh.sort()\nprint(min(h[i+K-1] - h[i] for i in range(N-K+1)))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s190656275', 's384363392', 's430224758', 's577611084', 's631292244', 's698058880', 's757748744']
[7836.0, 7836.0, 2940.0, 7484.0, 2940.0, 7384.0, 7384.0]
[207.0, 206.0, 17.0, 219.0, 17.0, 252.0, 221.0]
[706, 679, 703, 655, 136, 658, 128]
p03208
u529012223
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
["\nN, K = map(int, input().split())\n\nh = [int(input()) for i in range(N)]\nans = float('INF')\nfor i in range(N - K +1):\n ans = min(ans, h[i + K -1] - h[i])\n \nprint(ans)", "\nN, K = map(int, input().split())\n\nh = [int(input()) for i in range(N)]\nans = float('INF')\nfor i in range(N - K +1):\n ans = min(ans, h[i + K -1] - h[i])\n \nprint(int(ans))", 'import numpy as np\nN, K = map(int, input().split())\n\nh = [int(input()) for i in range(N)]\nh = np.array(h)\nh_sort = np.sort(h)\nh_diff = h_sort[1:] - h_sort[:N-1]\nh_diff_sort = np.sort(h_diff)\n\nprint(np.sum(h_diff_sort[:K]))', "\nN, K = map(int, input().split())\n\nh = [int(input()) for i in range(N)]\nh.sort()\nans = float('INF')\nfor i in range(N - K +1):\n ans = min(ans, h[i + K -1] - h[i])\n \nprint(ans)"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s055424630', 's065967227', 's946731720', 's097699850']
[7076.0, 7072.0, 17124.0, 7384.0]
[210.0, 212.0, 331.0, 246.0]
[171, 176, 222, 180]
p03208
u536600145
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n, k = map(int,input().split(" "))\ntrees = []\nfor i in range(n):\n trees.append(int(input()))\n\ntrees.sort()\nmin_val = 0\nfor i in range(len(trees) - 1):\n min_val = min(abs(trees[i+1] - trees[i]), min_val)\n \nprint(min_val)', 'n, k = map(int,input().split(" "))\ntrees = []\nfor i in range(n):\n trees.append(int(input()))\n\nmin_val = 0\nfor i in range(len(trees) - 1):\n min_val = min(abs(trees[i+1] - trees[i]), min_val)\n \nprint(min_val)', 'n, k = map(int,input().split(" "))\ntrees = []\nfor i in range(n):\n trees.append(int(input()))\n\ntrees.sort()\nmin_val = trees[k-1] - trees[0]\nfor i in range(1, n - k + 1):\n min_val = min(abs(trees[i+k-1] - trees[i]), min_val)\nprint(min_val)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s327288882', 's648075231', 's325012255']
[7384.0, 7072.0, 7384.0]
[275.0, 230.0, 269.0]
[228, 215, 243]
p03208
u556225812
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int, input().split())\nlst = []\nfor i in range(N):\n x = int(input())\n lst.append(x)\nlst.sort()\nL = []\nfor i in range(N - K + 1):\n L.append(lst[i + K -1] - lst[i])\nL.sort()\nprint(L)\nprint(L[0])', 'N, K = map(int, input().split())\nlst = []\nfor i in range(N):\n lst.append(int(input()))\nlst.sort()\ndif = 10**9\nfor i in range(N):\n if lst[i+K-1] - lst[i] < dif:\n dif = lst[i+K-1] - lst[i]\nprint(dif)', 'N, K = map(int, input().split())\nlst = []\nfor i in range(N):\n lst.append(int(input()))\nlst.sort()\ndif = 10**9\nfor i in range(N-K+1):\n if lst[i+K-1] - lst[i] < dif:\n dif = lst[i+K-1] - lst[i]\nprint(dif)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s221848555', 's474732149', 's896156752']
[13220.0, 7384.0, 7384.0]
[289.0, 238.0, 239.0]
[211, 210, 214]
p03208
u556326496
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int, input().split())\nh = sorted([int(input()) for i in range(N)])\nprint(h)\n\ninf = 10**9\nmin_height = inf\nfor i in range(N-K+1):\n print(i+(K-1), h[i+(K-1)], i, h[i])\n min_height = min(min_height, h[i+(K-1)] - h[i])\n\nprint(min_height)\n', 'N, K = map(int, input().split())\nh = sorted([int(input()) for i in range(N)])\n# print(h)\n\ninf = 10**9\nmin_height = inf\nfor i in range(N-K+1):\n \n min_height = min(min_height, h[i+(K-1)] - h[i])\n\nprint(min_height)\n']
['Wrong Answer', 'Accepted']
['s643751835', 's820478462']
[12008.0, 8280.0]
[459.0, 257.0]
[251, 255]
p03208
u556849401
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['# -*- coding: utf-8 -*-\n"""\nCreated on Tue May 14 20:13:03 2019\n\n@author: avina\n"""\n\nn,k = map(int, input().split())\nl = []\nfor i in range(n):\n l.append(int(input()))\nl.sort(reverse=True)\ni = 0\nmins = 1e6\nwhile i < n - k +1:\n mins = min(mins, l[i+k-1] - l[i])\n i+=1\nprint(mins)', '# -*- coding: utf-8 -*-\n"""\nCreated on Tue May 14 20:13:03 2019\n\n@author: avina\n"""\n\nn,k = map(int, input().split())\nl = []\nfor i in range(n):\n l.append(int(input()))\nl.sort()\ni = 0\nmins = 1e10\nwhile i < n - k +1:\n mins = min(mins, l[i+k-1] - l[i])\n i+=1\nprint(mins)']
['Wrong Answer', 'Accepted']
['s190005880', 's587680096']
[7384.0, 7508.0]
[274.0, 273.0]
[282, 271]
p03208
u560867850
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n, k = [int(c) for c in input().split()]\nh = [int(input()) for _ in range(n)]\n\nh.sort()\n\nmin_d = 100000\nfor i in range(n-k+1):\n d = h[i+k] - h[i]\n if d < min_d:\n min_d = d\n\nprint(min_d)', 'n, k = [int(c) for c in input().split()]\nh = [int(input()) for _ in range(n)]\n\nh.sort()\n\nmin_d = 1000000000\nfor i in range(n-k+1):\n d = h[i+k-1] - h[i]\n if d < min_d:\n min_d = d\n\nprint(min_d)']
['Runtime Error', 'Accepted']
['s835433390', 's065967196']
[7436.0, 7436.0]
[241.0, 243.0]
[198, 204]
p03208
u561339958
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k = map(int,input().split())\nl = sorted([int(input()) for i in range(n)])\nansl = []\nfor m in range(n-k+1):\n ansl.append(max(l[m:m+k-1])-min(l[m:m+k-1]))\nprint(min(ansl))', 'n,k = map(int,input().split())\nl = sorted([int(input()) for i in range(n)])\nprint(min(l[i+k-1] - l[i] for i in range(n-k+1)))']
['Wrong Answer', 'Accepted']
['s049434098', 's267603683']
[8276.0, 8280.0]
[2104.0, 231.0]
[173, 126]
p03208
u568419568
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\nh.sort\nprint(min(h[i+K-1]-h[i] for i in range(N-K+1)))', 'N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\nh.sort()\nprint(min(h[i+K-1]-h[i] for i in range(N-K+1)))']
['Wrong Answer', 'Accepted']
['s157169052', 's423812677']
[7072.0, 7384.0]
[188.0, 226.0]
[124, 126]
p03208
u570018655
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n, k = map(int, input().split())\nh = [int(input()) for _ in range(n)]\nh.sort()\nmin = h[k-1] - h[0]\nfor i in range(len(h)-k+1):\n dif = h[i+k-1] - h[i]\n if t < min:\n min = t\nprint(min)\n', "n, k = map(int, input().split())\nh = [int(input()) for _ in range(n)]\nh.sort()\nmin = '100000'\nfor i in range(len(h)-k+1):\n if h[i+k-1] - h[i] < min:\n min = h[i+k-1] - h[i]\nprint(min)\n", 'n, k = map(int, input().split())\nh = [int(input()) for _ in range(n)]\nh.sort()\nmin = h[k-1] - h[0]\nfor i in range(len(h)-k+1):\n dif = h[i+k-1] - h[i]\n if dif < min:\n min = dif\nprint(min)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s073035769', 's316405684', 's552392920']
[7448.0, 7440.0, 7384.0]
[204.0, 214.0, 230.0]
[196, 193, 200]
p03208
u572142121
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N,K=map(int,input().split())\nH=[int(input()) for i in range(N)]\nA=sorted(H)[::-1]\nprint(A)\nans=10**9\nfor i in range(N-K+1):\n a=A[i]-A[i+K-1]\n print(a)\n ans=min(ans,a)\nprint(ans)', 'N,K=map(int,input().split())\nH=[int(input()) for i in range(N)]\nA=sorted(H)[::-1]\nans=10**9\nfor i in range(N-K+1):\n a=A[i]-A[i+K-1]\n ans=min(ans,a)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s804614355', 's790475205']
[12136.0, 8676.0]
[332.0, 254.0]
[180, 160]
p03208
u574226814
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['(n, k) = [int(x) for x in input().split()]\nbanig = []\nfor x in range(n):\n banig.append(int(input()))\nbanig.sort()\n\ndifBanig = []\nfor mini, maxi in zip(range(0,n-k+1), range(n-k,n+1)):\n difBanig.append(banig[maxi] - banig[mini])\nprint(max(difBanig))', '(n, k) = [int(x) for x in input().split()]\nbanig = []\nfor x in range(n):\n banig.append(int(input()))\nbanig.sort()\n\ndifBanig = []\nfor bot in range(n-k+1):\n difBanig.append(banig[bot+k-1] - banig[bot])\n\nprint(min(difBanig))']
['Runtime Error', 'Accepted']
['s698913695', 's197827759']
[9296.0, 11292.0]
[232.0, 254.0]
[250, 223]
p03208
u578501242
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['x,y=list(map(int, input().split()))\nlist=[]\nfor i in range(x):\n\tlist.append(int(input()))\nlist.sort()\nprint(list)\nans=10**10\n\nfor j in range(x-y+1):\n\tif list[j+y-1]-list[j]<ans:\n\t\tans=list[j+y-1]-list[j]\nprint(ans)', 'x,y=list(map(int, input().split()))\nlist=[]\nfor i in range(x):\n\tlist.append(int(input()))\nlist.sort()\nans=10**10\n\nfor j in range(x-y+1):\n\tif list[j+y-1]-list[j]<ans:\n\t\tans=list[j+y-1]-list[j]\nprint(ans)']
['Wrong Answer', 'Accepted']
['s925308633', 's278492126']
[10520.0, 7384.0]
[250.0, 245.0]
[214, 202]
p03208
u580093517
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N,K = map(int,input().split())\nH = sorted(int(input()) for _ in range(N))\nans = float("INF")\nprint(H)\nfor i in range(N-K):\n ans = min(H[i+K-1]-H[i],ans)\nprint(ans)', 'N,K = map(int,input().split())\nH = sorted(int(input()) for _ in range(N))\nans = float("INF")\nfor i in range(N-K+1):\n ans = min(H[i+K-1]-H[i],ans)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s100445613', 's475239901']
[10528.0, 7396.0]
[261.0, 258.0]
[166, 159]
p03208
u580362735
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['import numpy as np\nN,K = map(int,input().split())\nlist = []\nlist_tmp = [0]*(K-1)\nfor i in range(N):\n list.append(int(input()))\n if i < N-K:\n list_tmp.append(list[i])\nlist = sorted(list);\nlist_tmp = sorted(list_tmp);\ntmp = list[-K:];\ntmp_list = list_tmp[K:]\ntmp = np.array(tmp)\ntmp_list = np.array(tmp_list)\nprint(min(tmp - tmp_list))', 'import numpy as np\nN,K = map(int,input().split())\nlist = []\nfor i in range(N):\n list.append(int(input()))\nlist = sorted(list);\nprint(min(h[i+K-1] - h[i] for i in range(N-K+1)))', 'import numpy as np\nN,K = map(int,input().split())\nlist = []\nfor i in range(N):\n list.append(int(input()))\nlist = sorted(list);\nprint(min(list[i+K-1] - list[i] for i in range(N-K+1)))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s132517831', 's794508726', 's424697367']
[21684.0, 21260.0, 17492.0]
[451.0, 344.0, 382.0]
[335, 176, 182]
p03208
u589431621
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\nh.sort()\nprint(min(h[i+K-1] - h[i]) for i in range(N-K+1))', 'N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\nh.sort()\nprint(min(h[i+K-1] - h[i] for i in range(N-K+1)))']
['Wrong Answer', 'Accepted']
['s644841095', 's167371956']
[7384.0, 7384.0]
[205.0, 231.0]
[128, 128]
p03208
u589432040
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int, input().split())\nh = []\n[h.append(int(input())) for i in range(N)]\n\nh.sort()\nprint(h)\nl = []\nfor i in range(N-K+1):\n l.append(h[i+K-1] - h[i])\nprint(min(l))', 'N, K = map(int, input().split())\nh_in = []\n[h_in.append(int(input())) for i in range(N)]\n\nl = []\nfor i in range(N):\n a = []\n for j in range(N):\n if i != j and h[i]-h[j]>=0:\n a.append(h[i]-h[j])\n if len(a) >= K-1:\n l.append(a)\n\nl2 = []\nfor i in range(len(l)):\n a = min(l[i])\n l[i].remove(a)\n l2.append(min(l[i]))\nprint(min(l2))', 'N, K = map(int, input().split())\nh = []\n[h.append(int(input())) for i in range(N)]\n\nh.sort()\nl = []\nfor i in range(N-K+1):\n l.append(h[i+K-1] - h[i])\nprint(min(l))\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s693144209', 's861663081', 's007806632']
[12252.0, 7884.0, 10884.0]
[264.0, 201.0, 248.0]
[175, 369, 167]
p03208
u592778743
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['import numpy as np\n\nN,K = list(map(int, input().split(",")))\nh = []\nfor _ in range(N):\n h.append(int(input()))\nh = sorted(h)\nres = h[N-1] - h[0]\nfor i in np.arange(0,N-K+1,1):\n tmp = h[i+K-1] - h[i]\n if res > tmp:\n res = tmp\n \nprint(res)\n \n', 'import numpy as np\n\nN,K = list(map(int, input().split()))\nh = []\nfor _ in range(N):\n h.append(int(input()))\nh = sorted(h)\nres = h[N-1] - h[0]\nfor i in np.arange(0,N-K+1,1):\n tmp = h[i+K-1] - h[i]\n if res > tmp:\n res = tmp\n \nprint(res)\n \n']
['Runtime Error', 'Accepted']
['s771806170', 's665649082']
[21912.0, 17496.0]
[341.0, 563.0]
[262, 259]
p03208
u595375942
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k=map(int,input().split())\nL=sorted([int(input()) for _ in range(n)])\nans=0\nfor i in range(n-k):\n ans=min(L[i+k-1]-L[i],ans)\nprint(ans)', 'n,k=map(int,input().split())\nL=sorted([int(input()) for _ in range(n)])\nans=10**10\nfor i in range(n-k+1):\n ans=min(L[i+k-1]-L[i],ans)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s969578200', 's137042574']
[8280.0, 8280.0]
[240.0, 246.0]
[140, 147]
p03208
u597455618
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n, k = map(int, input().split())\nh = [0]*n\nfor i in range(n):\n h[i] = int(input())\nprint(h)\nans = 10**10\nfor i in range(n-k+1):\n if ans >= h[i+k-1] - h[i]:\n ans = h[i+k-1] - h[i]\nprint(ans)', 'n, k = map(int, input().split())\nh = [0]*n\nfor i in range(n):\n h[i] = int(input())\nans = 10**10\nfor i in range(n-k+1):\n if ans >= h[i+k-1] - h[i]:\n ans = h[i+k-1] - h[i]\nprint(ans)', 'n, k = map(int, input().split())\nh = [0]*n\nfor i in range(n):\n h[i] = int(input())\nh.sort()\nans = 10**10\nfor i in range(n-k+1):\n if ans >= h[i+k-1] - h[i]:\n ans = h[i+k-1] - h[i]\n if ans == 0:\n break\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s280938382', 's951294132', 's467389309']
[10480.0, 6900.0, 7472.0]
[206.0, 194.0, 232.0]
[196, 187, 225]
p03208
u604341914
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = list(map(int, input().split()))\nH = []\nfor i in range(N):\n h = int(input())\n H.append(h)\n\nH.sort()\nans = []\n\nfor i in range(N-K+1):\n print(i)\n dif = H[i+K-1] - H[i]\n ans.append(dif)\n \nprint(min(ans))\n ', 'N, K = map(int, input().split())\nH = []\n\nfor i in range(N):\n h = int(input())\n H.append(int(input()))\n\nH.sort()\n\nans = []\nfor i in range(N-K-1):\n # print(i)\n dif = H[i+K-1] - H[i]\n ans.append(dif)\n\nprint(min(ans))\n ', 'n,k=map(int,input().split())\nH=[]\nfor i in range(n):\n H.append(int(input()))\n \nH.sort()\n \n#print(H)\n \nans=H[n-1]-H[0]\n \nfor i in range(n-k+1):\n #print(H[i+k-1]-H[i])\n ans=min(ans,H[i+k-1]-H[i])\n \nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s137830705', 's711254801', 's074858331']
[11820.0, 5024.0, 7384.0]
[320.0, 181.0, 247.0]
[257, 257, 215]
p03208
u606033239
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k=map(int,input().split())\nh=list(int(input()) for _ in range(n))\na=[]\nh.sort(reverse=True)\nfor i in range(n-k+1):\n if h[i]-h[i+k-1]==0:\n print(0)\n exit()\n a.append(h[i]-h[i+-1])\nprint(min(a))', 'n,k=map(int,input().split())\nh=list(int(input()) for _ in range(n))\na=[]\nh.sort(reverse=True)\nfor i in range(0,n-k+1):\n a.append(h[i]-h[i+k-1])\nprint(min(a))\n']
['Wrong Answer', 'Accepted']
['s494910678', 's366636931']
[11280.0, 11228.0]
[277.0, 264.0]
[214, 161]
p03208
u606523772
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int, input().split())\nh_list = []\nfor i in range(N):\n h = int(input())\n h_list.append(h)\nh_list = sorted(h_list, reverse = True)\nfor i in range(N-K+1):\n cnt = h_list[i]-h_list[i+K-1]\n min1 = min(min1, cnt)\nprint(min1)', 'N, K = map(int, input().split())\nh_list = []\nmin1 = 10**10\nfor i in range(N):\n h = int(input())\n h_list.append(h)\nh_list = sorted(h_list, reverse = True)\nfor i in range(N-K+1):\n cnt = h_list[i]-h_list[i+K-1]\n min1 = min(min1, cnt)\nprint(min1)']
['Runtime Error', 'Accepted']
['s542437482', 's396607106']
[8280.0, 8280.0]
[224.0, 267.0]
[240, 254]
p03208
u607737438
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['NK = list(map(int, input().split()))\na = [0]*NK[0]\nfor i in range(len(a)):\n a[i] = int(input())\na.sort()\n\nb = [0]*NK[1]\noffsets = [0]*(NK[0]-NK[1]+1)\nfor i in range(len(offsets)):\n for j in range(NK[1]):\n b[j] = a[i+j]\n offsets[i] = b[K-1] - b[0]\n\nprint(min(offsets))\n', 'NK = list(map(int, input().split()))\na = [0]*NK[0]\nfor i in range(len(a)):\n a[i] = int(input())\na.sort()\nN = NK[0]\nK = NK[1]\n\nminimum = a[N-1]\nfor i in range(N-K+1):\n offset = a[i+K-1] - a[i]\n if minimum > offset:\n minimum = offset\n\nprint(minimum)\n']
['Runtime Error', 'Accepted']
['s656574140', 's443347339']
[7844.0, 7472.0]
[226.0, 245.0]
[284, 264]
p03208
u609814378
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = 5,3\nh = [5,7,5,7,7]\n\n\nsorted_h = sorted(h)\n\n\nans = 10**8\nfor i in range(N - K + 1):\n ans = min(ans, sorted_h[i + K - 1] - sorted_h[i])\nprint(ans)', 'N, K = 5,3\nh = [5,7,5,7,7]\n\n\nsorted_h = sorted(h)\n\n\nans = 10**8\nfor i in range(N - K + 1):\n ans = min(ans, sorted_h[i + K - 1] - sorted_h[i])\nprint(ans)', "n, k = map(int, input().split())\nhhh = [int(input()) for _ in range(n)]\nhhh.sort()\nans = float('inf')\nfor i in range(n - k + 1):\n ans = min(ans, hhh[i + k - 1] - hhh[i])\nprint(ans)\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s310310121', 's645328273', 's050697623']
[3060.0, 2940.0, 7384.0]
[18.0, 17.0, 243.0]
[155, 155, 184]
p03208
u612721349
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n, k = map(int, input().split())\nhl = [int(input()) for _ in range(n)]\nhl.sort()\nprint(min([hl[k - 1 + i] - hl[i] for i in range(0, n - k + 1)))\n', 'n, k = map(int, input().split())\nhl = [int(input()) for _ in range(n)]\nhl.sort()\nprint(min([hl[k - 1 + i] - hl[i] for i in range(0, n - k + 1)]))\n']
['Runtime Error', 'Accepted']
['s658378577', 's919585289']
[2940.0, 11252.0]
[18.0, 235.0]
[145, 146]
p03208
u620945921
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k = input().split()\nn=int(n)\nk=int(k)\nh = [int(input()) for i in range(n)]\nh.sort()\n#print(h)\nans=10000000000\n\nfor i in range(n-k+1):\n list1 = [h[j] for j in range(i,i+k)]\n print(list1)\n if max(list1)-min(list1) < ans:\n ans = max(list1)-min(list1)\nprint(ans)', 'n,k = input().split()\nn=int(n)\nk=int(k)\nh = [int(input()) for i in range(n)]\nh.sort()', 'n,k = input().split()\nn=int(n)\nk=int(k)\nh = [int(input()) for i in range(n)]\nh.sort()\n#print(h)\nans=10000000000\n\nfor i in range(n-k+1):\n# list1 = [h[j] for j in range(i,i+k)]\n# print(list1)\n if h[i+k-1]-h[i] < ans:\n ans = h[i+k-1]-h[i]\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s099719708', 's614477618', 's599868469']
[93120.0, 7504.0, 7384.0]
[2104.0, 206.0, 220.0]
[268, 85, 254]
p03208
u625963200
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k=map(int,input().split())\nhs=[int(input()) for _ in range(n)]\nhs.sort()\nk=k\n\npsa=0\nfor i in range(n):\n sa=hs[k+i]-hs[i]\n if psa>sa:\n psa=sa\n if k+i+1==n:\n break\n\nprint(psa)', 'n,k=map(int,input().split())\nhs=[int(input()) for _ in range(n)]\nhs.sort()\nk=k-1\n\npsa=0\nfor i in range(n):\n sa=hs[k+i]-hs[i]\n if psa>sa:\n psa=sa\n if k+i+1==n:\n break\n\nprint(psa)', "n,k=map(int,input().split())\nhs=[int(input()) for _ in range(n)]\nhs.sort()\n\npsa=float('inf')\nfor i in range(n-k+1):\n sa=hs[k+i-1]-hs[i]\n if psa>sa:\n psa=sa\n\nprint(psa)"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s729912192', 's931018796', 's466978805']
[7512.0, 7384.0, 7384.0]
[240.0, 250.0, 225.0]
[184, 186, 172]
p03208
u633105820
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
["def run(N, K, h):\n h = sorted(h)\n diff = [h[i+1] - h[i] for i in range(N-1)]\n diff_all = max(h) - min(h)\n r_diff_sum = [0]\n for d in diff:\n r_diff_sum.append(r_diff_sum[-1] + d)\n l_diff_sum = [0]\n for d in reversed(diff):\n l_diff_sum.append(l_diff_sum[-1] + d)\n print(r_diff_sum)\n print(l_diff_sum)\n ret = diff_all\n \n for i in range(N - K + 1):\n ret = min(ret, diff_all - r_diff_sum[i] - l_diff_sum[N - K - i])\n return ret\n\n\ndef main():\n N, K = map(int, input().split())\n h = []\n for _ in range(N):\n h.append(int(input()))\n print(run(N, K, h))\n\n\nif __name__ == '__main__':\n main()\n", "def run(N, K, h):\n h = sorted(h)\n diff = [h[i+1] - h[i] for i in range(N-1)]\n diff_all = max(h) - min(h)\n r_diff_sum = [0]\n for d in diff:\n r_diff_sum.append(r_diff_sum[-1] + d)\n l_diff_sum = [0]\n for d in reversed(diff):\n l_diff_sum.append(l_diff_sum[-1] + d)\n ret = diff_all\n \n for i in range(N - K + 1):\n ret = min(ret, diff_all - r_diff_sum[i] - l_diff_sum[N - K - i])\n return ret\n\n\ndef main():\n N, K = map(int, input().split())\n h = []\n for _ in range(N):\n h.append(int(input()))\n print(run(N, K, h))\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s035502076', 's176553068']
[24956.0, 20304.0]
[309.0, 279.0]
[698, 654]
p03208
u634079249
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['import sys\nimport os\nimport math\nimport string\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\nlcm = lambda x, y: x * y / math.gcd(x, y)\n\nMOD = 10 ** 9 + 7\nMAX = float(\'inf\')\n\n\ndef main():\n if os.getenv("LOCAL"):\n sys.stdin = open("input.txt", "r")\n\n N, K = il()\n H = [ii() for _ in range(N)]\n H = sorted(H, reverse=True)\n print(max(H[:K]) - min(H[:K]))\n\n\nif __name__ == \'__main__\':\n main()\n', 'import sys\nimport os\nimport math\nimport string\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\nlcm = lambda x, y: x * y / math.gcd(x, y)\n\nMOD = 10 ** 9 + 7\nMAX = float(\'inf\')\n\n\ndef main():\n if os.getenv("LOCAL"):\n sys.stdin = open("input.txt", "r")\n\n N, K = il()\n H = [ii() for _ in range(N)]\n H = sorted(H, reverse=True)\n cnt = len(H)-K+1\n ret = [0]*cnt\n for i in range(cnt):\n ret[i] = H[i] - H[i+K-1]\n print(min(ret))\n\n\nif __name__ == \'__main__\':\n main()\n']
['Wrong Answer', 'Accepted']
['s788924881', 's125416432']
[8876.0, 11488.0]
[120.0, 130.0]
[852, 934]
p03208
u635358463
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N,K = map(int, input().split())\nlist = [int(input()) for i in range(N)]\nmax(list())\nlist.sort()\nprint(min(list[i+K-1] - list[i] for i in range(N-K+1)))', 'N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\nh.sort()\nprint(min(h[i+K-1] - h[i] for i in range(N-K+1)))']
['Runtime Error', 'Accepted']
['s451504903', 's338039920']
[7072.0, 7384.0]
[176.0, 231.0]
[151, 128]
p03208
u636162168
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k=map(int,input().split())\nh=[int(input()) for i in range(n)]\nh.sort()\nans=[h[k+i]-h[i] for i in range(n-k+1)]\nprint(min(ans))', 'n,k=map(int,input().split())\nh=[int(input()) for i in range(n)]\nh.sort()\ndef get_(h,k):\n for i in range(n-k+1):\n yield h[i:k+i]\na=list(get_(h,k))\nans=10**9+1\nfor i in a:\n print(i)\n if max(i)-min(i)<ans:\n ans=max(i)-min(i)\nprint(ans)', 'n,k=map(int,input().split())\nh=[int(input()) for i in range(n)]\nh.sort()\n\nprint(min(h[i+k-1] - h[i] for i in range(n-k+1)))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s400346490', 's602213533', 's300488080']
[11264.0, 880848.0, 7488.0]
[235.0, 2161.0, 228.0]
[128, 255, 123]
p03208
u636775911
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['#coding:utf-8\ns=[int(i) for i in input().split()]\nn=[]\nfor i in range(s[0]):\n n.append(int(input()))\nn.sort()\nsa=abs(n[0]-n[s[1]]-1)\nfor i in range(s[1]):\n print(n[1],n[i+s[1]-1])\n if(sa>abs(n[i]-n[i+s[1]-1])):\n sa=abs(n[i]-n[i+s[1]-1])\nprint(sa)', '#coding:utf-8\ns=[int(i) for i in input().split()]\nn=[]\nfor i in range(s[0]):\n n.append(int(input()))\nn.sort()\nprint(n)\nsa=abs(n[0]-n[s[1]]-1)\nfor i in range(s[1]):\n print(n[1],n[i+s[1]-1])\n if(sa>abs(n[i]-n[i+s[1]-1])):\n sa=abs(n[i]-n[i+s[1]-1])\nprint(sa)', 'n=[int(i) for i in input().split()]\narray=[]\nfor i in range(n[0]):\n array.append(int(input()))\narray.sort()\nans=abs(array[0]-array[n[1]-1])\nfor i in range(n[0]-(n[1]-1)):\n if(ans>abs(array[i]-array[i+n[1]-1])):\n ans=abs(array[i]-array[i+n[1]-1])\nprint(ans)\n ']
['Runtime Error', 'Runtime Error', 'Accepted']
['s359670209', 's674455921', 's175824615']
[7888.0, 10520.0, 7384.0]
[284.0, 302.0, 254.0]
[252, 261, 264]
p03208
u638033979
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N,K = map(int, input().split())\nA = [0]*N\n\nfor i in range(N):\n A[i] = int(input())\n \nA.sort()\nprint(A)\n\nans = A[K-1]-A[0]\nfor i in range(N-K):\n if A[K+i]-A[i+1] < ans:\n ans = A[K+i]-A[i+1]\n \nprint(ans)', 'N,K = map(int, input().split())\nA = [0]*N\nDP=[0]*N\n\nfor i in range(N):\n A[i] = int(input())\n \nA.sort()\n\nans = A[K-1]-A[0]\nfor i in range(N-K):\n if A[K+i]-A[i+1] < ans:\n ans = A[K+i]-A[i+1]\n \nprint(ans)']
['Wrong Answer', 'Accepted']
['s151479508', 's414974031']
[10532.0, 8240.0]
[248.0, 241.0]
[224, 224]
p03208
u642528832
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['import itertools\n\nN,K = map(int,(input().split()))\nh = [int(input())for _ in range(N)]\n\nhmin = 10**18\n\nc = itertools.combinations(N,K)\n\nfor v in c:\n hmin = min(max(v)-min(v),hmin)\nprint(hmin)', 'N,K = map(int,(input().split()))\nh = [int(input())for _ in range(N)]\nh.sort()\n\nprint(min(h[i+K-1]-h[i] for i in range(N-K+1)))']
['Runtime Error', 'Accepted']
['s952247921', 's597903042']
[13124.0, 13268.0]
[144.0, 170.0]
[194, 126]
p03208
u648212584
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['import sys\ninput = sys.stdin.readline\n\ndef main():\n N,K = map(int,input().split())\n h = [int(input()) for _ in range(N)]\n h.sort()\n print(h)\n \n ans = 10**10\n for i in range(N-K+1):\n ans = min(ans,h[K+i-1]-h[i])\n \n print(ans)\n \nif __name__ == "__main__":\n main()\n', 'import sys\ninput = sys.stdin.readline\n\ndef main():\n N,K = map(int,input().split())\n h = [int(input()) for _ in range(N)]\n h.sort()\n \n ans = 10**10\n for i in range(N-K+1):\n ans = min(ans,h[K+i-1]-h[i])\n \n print(ans)\n \nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s945269723', 's113523305']
[10568.0, 7384.0]
[123.0, 123.0]
[306, 293]
p03208
u652081898
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n, k = map(int, input().split())\nlist_original = []\nfor i in range(n)\n list_original.append(int(input))\n\nlist = sorted(list_original)\nsub = 10000000000\n\nfor j in range(n-k+1):\n if list[j+k-1]-list[j] <= sub:\n sub =list[j+k-1]-list[j]\n else:\n pass\n\nprint(sub)', 'n, k = map(int, input().split())\nlist_original = []\nfor i in range(n):\n list_original.append(int(input()))\n\nlist = sorted(list_original)\nsub = 10000000000\n\nfor j in range(n-k+1):\n if list[j+k-1]-list[j] <= sub:\n sub =list[j+k-1]-list[j]\n else:\n pass\n\nprint(sub)']
['Runtime Error', 'Accepted']
['s694767914', 's432889201']
[2940.0, 8288.0]
[17.0, 245.0]
[281, 284]
p03208
u652656291
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k = map(int,input().split())\nA = [int(input()) for i in range(n)]\nA.sort()\nprint(A[-1]-A[-k])', 'n,k = map(int,input().split())\nA = [int(input()) for i in range(n)]\nA.sort()\nprint(min(A[i+k-1] - A[i] for i in range(n-k+1)))']
['Wrong Answer', 'Accepted']
['s345868505', 's469452870']
[7484.0, 7512.0]
[210.0, 218.0]
[95, 126]
p03208
u653363401
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k=[int(i) for i in input().split()]\na=[0]*n\nfor i in range(0,n,1):\n a[i]=int(input())\na.sort(reverse=True)\nsa=[0]*(n-k)\nfor j in range(0,n-k,1):\n sa[j]=a[j]-a[j+k]\nprint(min(sa))\n', 'n,k=[int(i) for i in input().split()]\na=[0]*n\nfor i in range(0,n,1):\n a[i]=int(input())\na.sort(reverse=True)\nsa=[1000000000]*100001\nj=0\nwhile(n!=(j+k-1)):\n sa[j]=a[j]-a[j+k-1]\n j=j+1\n\nprint(min(sa))']
['Wrong Answer', 'Accepted']
['s500556708', 's196820766']
[10916.0, 10948.0]
[238.0, 262.0]
[187, 207]
p03208
u653837719
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n, k = map(int, input().split())\nh = sorted([int(input()) for _ in range(n)])\nans = 1000000000\n\nfor i in range(n - k + 1):\n ans = min(ans, h[i + k - 11] - h[i])\n\nprint(ans)\n', 'n, k = map(int, input().split())\nh = sorted([int(input()) for _ in range(n)])\nans = 1000000000\n\nfor i in range(n - k + 1):\n ans = min(ans, h[i + k - 1] - h[i])\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s843004810', 's431316194']
[8280.0, 8280.0]
[240.0, 252.0]
[176, 175]
p03208
u657541767
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int, input().split())\nH = [int(input()) for _ in range(N)]\n\nH.sort()\nres = 10000000000\nfor i in range(N-K+1):\n print(H[i:i+K])\n res = min(res, max(H[i:i+K]) - min(H[i:i+K]))\nprint(res)', 'N, K = map(int, input().split())\nH = [int(input()) for _ in range(N)]\n\nH.sort()\nres = 10000000000\nfor i in range(0, N-K+1):\n res = min(res, H[i+K-1] - H[i])\nprint(res)']
['Wrong Answer', 'Accepted']
['s286657297', 's616668892']
[103076.0, 7384.0]
[2104.0, 250.0]
[201, 170]
p03208
u657901243
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n, k = int(input().split())\nh = [int(input())) for _ in range(n)]\nh.sort()\nprint(min([h[i+k-1]-h[i] for i in range(n-k+1)]) )', 'n, k = map(int, input().split())\nh = [int(input())) for _ in range(n)]\nh.sort()\nprint(min([h[i+k-1]-h[i] for i in range(n-k+1)]) )', 'n, k = map(int, input().split())\nh = [int(input()) for _ in range(n)]\nh.sort()\nprint(min([h[i+k-1]-h[i] for i in range(n-k+1)]) )']
['Runtime Error', 'Runtime Error', 'Accepted']
['s048346697', 's788829674', 's149312773']
[2940.0, 2940.0, 11272.0]
[18.0, 17.0, 242.0]
[125, 130, 129]
p03208
u662121130
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
["NK = input().split(' ')\nN, K = int(NK[0]), int(NK[1])\ntrees = []\ncurrent = 0\nfor i in range(N):\n tree = int(input())\n if len(trees) < K:\n trees.append(tree)\n elif tree > min(trees) and tree < max(trees):\n trees.append(tree)\n tmp1 = trees.remove(min(trees))\n tmp2 = trees.remove(max(trees))\n if max(tmp1)-min(tmp1) > max(tmp2)-min(tmp2):\n trees = tmp2\n else:\n trees = tmp1\nprint(max(trees)-min(trees))\n ", "NK = input().split(' ')\nN, K = int(NK[0]), int(NK[1])\ntrees = []\nfor i in range(N):\n trees.append(int(input()))\ntrees.sort(reversed=True)\nmin = 0\nfor i in range(N-K):\n h = trees[i+K]-trees[i]\n if h < min:\n min = h\nprint(min)", "NK = input().split(' ')\nN, K = int(NK[0]), int(NK[1])\ntrees = []\nfor i in range(N):\n trees.append(int(input()))\ntrees.sort()\nmin = 0\nfor i in range(N-K):\n h = trees[i]-trees[i+K]\n if h < min:\n min = h\nprint(min)", "NK = input().split(' ')\nN, K = int(NK[0]), int(NK[1])\ntrees = []\nfor i in range(N):\n trees.append(int(input()))\ntrees.sort()\nmin = 0\nfor i in range(N-K):\n h = trees[i+K]-trees[i]\n if h < min:\n min = h\nprint(min)", 'NK = input().split(\' \')\nN, K = int(NK[0]), int(NK[1])\ntrees = []\nfor i in range(N):\n trees.append(int(input()))\ntrees.sort()\nmin = float("inf")\nfor i in range(N-K+1):\n h = trees[i+K-1]-trees[i]\n if h < min:\n min = h\nprint(min)']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s081090575', 's150270963', 's401310396', 's744943971', 's630469088']
[7020.0, 7072.0, 7384.0, 7484.0, 7384.0]
[197.0, 185.0, 244.0, 247.0, 254.0]
[438, 230, 217, 217, 232]
p03208
u663014688
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N,K = map(int, input().split())\nh = [int(input()) for i in range(N)]\nh.sort()\nans = min(h[i+K-1] - h[i] for i in range(N-k+1))\nprint(ans)\n', 'N,K = map(int, input().split())\nh = [int(input()) for i in range(N)]\nh.sort()\nans = min(h[i+K-1] - h[i] for i in range(N-K+1))\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s612956896', 's284933653']
[7384.0, 7384.0]
[210.0, 224.0]
[138, 138]
p03208
u664884522
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N,K = [int(x) for x in input().split()]\nh = [0 for x in range(N)]\nfor i in range(N):\n h[i] = int(input())\nh = sorted(h)\ndis = []\nfor i in range(N-K+1):\n dis.append(h[i+K-1]-h[i])\n', 'N,K = [int(x) for x in input().split()]\nh = [0 for x in range(N)]\nfor i in range(N):\n h[i] = int(input())\nh = sorted(h)\ndis = []\nfor i in range(N-K+1):\n dis.append(h[i+K-1]-h[i])\nprint(min(dis))\n']
['Wrong Answer', 'Accepted']
['s163128963', 's454493692']
[16832.0, 16760.0]
[190.0, 194.0]
[185, 201]
p03208
u665038048
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int, input().split())\nh = [0]*N\nfor i in range(N):\n h[i] = int(input())\nh.sort()\nprint(min(h[i+K+1] - h[i] for i in range(N-K+1)))', 'N, K = map(int, input().split())\nh = [0] * N\nfor i in range(N):\n h[i] = int(input())\nh.sort()\nprint(min(h[i+K-1]-h[i] for i in range(N)))\n', 'N, K = map(int, input().split())\nh = [0] * N\nfor i in range(N):\n h[i] = int(input())\nh.sort()\nprint(min(h[i+K-1]-h[i] for i in range(N-K+1)))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s057426174', 's566453651', 's863107898']
[7472.0, 9204.0, 7472.0]
[234.0, 228.0, 235.0]
[144, 141, 145]
p03208
u666198201
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int, input().split())\nA=[]\nfor i in range(N):\n A.append(int(input()))\n\nA.sort()\nprint(A)\nmini=10000000000\nfor i in range(N-K+1):\n mini=min(mini,A[i+K-1]-A[i])\n\nprint(mini)', 'N, K = map(int, input().split())\nA=[]\nfor i in range(N):\n A.append(int(input()))\n\nA.sort()\n#print(A)\nmini=10000000000\nfor i in range(N-K+1):\n mini=min(mini,A[i+K-1]-A[i])\n\nprint(mini)']
['Wrong Answer', 'Accepted']
['s766609043', 's667549886']
[10520.0, 7384.0]
[276.0, 264.0]
[188, 189]
p03208
u668705838
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k = map(int, input().split())\nh = sorted(list(map(int, [input() for _ in range(n)])))\nprint(h)\nprint(min([h[i+k-1]-h[i] for i in range(n-k+1)]))', 'n,k = map(int, input().split())\nh = sorted(list(map(int, [input() for _ in range(n)])))\nprint(min([h[i+k-1]-h[i] for i in range(n-k+1)]))']
['Wrong Answer', 'Accepted']
['s138783081', 's324930700']
[14236.0, 14236.0]
[219.0, 219.0]
[146, 137]
p03208
u673361376
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N,K = map(int,input().split())\nH = sorted([int(input()) for _ in range(N)])\nprint(min([H[i+K]-H[i] for i in range(N-K)]))', 'N,K = map(int,input().split())\nH = sorted([int(input()) for _ in range(N)])\nprint(min([H[i+K-1]-H[i] for i in range(N-K+1)]))']
['Wrong Answer', 'Accepted']
['s662639959', 's348349624']
[10864.0, 10872.0]
[250.0, 239.0]
[121, 125]
p03208
u677312543
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n, k = map(int, input().split())\nh = [int(input()) for _ in range(n)]\nh = sorted(h)\n\nans = h[k] - h[0]\nfor i in range(1, n-k+1):\n ans = min(ans, h[i+k-1]-h[i])\n\nprint(ans)', 'n, k = map(int, input().split())\nh = [int(input()) for _ in range(n)]\n \nh = sorted(h)\n \nans = h[k-1] - h[0]\nfor i in range(1, n-k+1):\n ans = min(ans, h[i+k-1] - h[i])\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s097520862', 's072890778']
[8280.0, 8280.0]
[255.0, 251.0]
[174, 181]
p03208
u681110193
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n,k=map(int,input().split())\n', 'n,k=map(int,input().split())\nl=[int(input()) for i in range(n)]\nl.sort()\nans=10**9\nfor i in range(n-k+1):\n d=l[i+k-1]-l[i]\n\n if d<ans:\n ans=d\n \n\n\nprint(ans)\n\n']
['Wrong Answer', 'Accepted']
['s023369355', 's511794393']
[2940.0, 7384.0]
[18.0, 235.0]
[29, 164]
p03208
u686036872
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = map(int, input().split())\nH=[int(input()) for i in range(N)]\n\nH.sort()\n\nans = float("inf")\nfor i in range(N-K+1):\n ans = min(ans, H[i+N-K-1]-H[i])\n\nprint(ans)', 'N, K = map(int, input().split())\nH=[int(input()) for i in range(N)]\n\nH.sort()\n\nans = float("inf")\nfor i in range(N-K+1):\n ans = min(ans, H[K-N+i-1]-H[i])\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s997730789', 's637799291']
[7488.0, 7384.0]
[219.0, 246.0]
[168, 168]
p03208
u687053495
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['\nN, K = map(int, input().split())\nH = [int(input()) for i in range(N)]\n\nans = []\n\nfor h in sorted(H):\n if len(ans) < K:\n ans.append(h)\n else:\n m = min(ans)\n tmp = ans[:]\n tmp.remove(m)\n tmp.append(h)\n if max(ans) - m >= max(tmp) - min(tmp):\n ans = tmp\n\nprint(max(ans) - min(ans), ans)', '\nN, K = map(int, input().split())\nH = sorted([int(input()) for _ in range(N)])\n\nans = float("inf")\nfor i in range(N-K+1):\n ans = min(ans, H[i+K-1]-H[i])\nprint(ans)']
['Wrong Answer', 'Accepted']
['s303257214', 's729412005']
[12120.0, 8280.0]
[2104.0, 245.0]
[310, 164]
p03208
u687764591
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
["def main():\n N, K = map(int, input().split())\n h = [int(input()) for count in range(n)]\n h.sort()\n min_value = min(h[i + K - 1] - h[i] for i in range(N - K + 1))\n print(min_value)\n\n\nif __name__ == '__main__':\n main()\n", "def main():\n N, K = map(int, input().split())\n h = [int(input()) for count in range(N)]\n h.sort()\n min_value = min(h[i + K - 1] - h[i] for i in range(N - K + 1))\n print(min_value)\n\n\nif __name__ == '__main__':\n main()\n"]
['Runtime Error', 'Accepted']
['s637766768', 's909000476']
[3060.0, 7384.0]
[17.0, 219.0]
[235, 235]
p03208
u691896522
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n , k = list(map(input().split()))\nh = []\nfor i in range(n):\n h.append(int(input()))\nh.sort()\nmin = h[-1]\nfor i in range(n - k):\n if min > h[i + k] - h[i]:\n min = h[i + k] - h[i]\nprint(min)', 'n , k = list(map(int, input().split()))\nh = []\nfor i in range(n):\n h.append(int(input()))\nh.sort()\nmin = h[-1]\nfor i in range(n - k + 1):\n if min > h[i + k - 1] - h[i]:\n min = h[i + k - 1] - h[i]\nprint(min)']
['Runtime Error', 'Accepted']
['s832256785', 's071231299']
[3060.0, 7392.0]
[17.0, 241.0]
[202, 219]
p03208
u694506377
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n = nnk[0]\nk = nnk[1]\n\nhs = [int(input()) for l in range(n)]\nhs.sort()\n\nnum = n - k + 1\n\nhmmm = []\nfor l in range(num):\n hmmm.append(hs[k+l-1] - hs[l])\n\nhmmm.sort()\nprint(hmm[0])\n', '#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\nnnk = list(map(lambda x: int(x), input().split(" ")))\nn = nnk[0]\nk = nnk[1]\n\nhs = [int(input()) for l in range(n)]\nhs.sort()\n\nnum = n - k + 1\n\nhmmm = []\nfor l in range(num):\n hmmm.append(hs[k+l-1] - hs[l])\n\nhmmm.sort()\nprint(hmm[0])', '#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\nnnk = list(map(lambda x: int(x), input().split(" ")))\nps = [int(input()) for l in range(nnk[0])]\nps.sort()\n\nhmax = ps[-1]\nhmin = ps[-nnk[1]]\n\nprint(hmax - hmin)', 'nnk = list(map(lambda x: int(x), input().split(" ")))\nn = nnk[0]\nk = nnk[1]\n\nhs = [int(input()) for l in range(n)]\nhs.sort()\n\nnum = n - k + 1\n\nhmmm = []\nfor l in range(num):\n hmmm.append(hs[k+l-1] - hs[l])\n\nhmmm.sort()\nprint(hmmm[0])']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s230691752', 's444784914', 's963799924', 's034140746']
[2940.0, 11288.0, 7388.0, 11292.0]
[18.0, 270.0, 207.0, 278.0]
[182, 285, 210, 236]
p03208
u695079172
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
["import heapq\n\ndef main():\n n,k = map(int,input().split())\n tree_heights = []\n\n for i in range(n):\n tree_heights.append(int(input()))\n tree_heights.sort()\n #print(tree_heights)\n\n mn = 1000000000000000000000000000000\n for i in range(n-k+1):\n print(i,abs(tree_heights[i]-tree_heights[i+k-1]))\n mn = min(abs(tree_heights[i]-tree_heights[i+k-1]),mn)\n print(mn)\n\n #print(tree_heights)\n #print(tree_diffs)\n #print(sum(tree_diffs[0:k]))\n\n\n\n\n\nif __name__ == '__main__':\n main()\n", "import heapq\n\ndef main():\n n,k = map(int,input().split())\n tree_heights = []\n heapq.heapify(tree_heights)\n\n for i in range(n):\n heapq.heappush(tree_heights,int(input()))\n print(tree_heights)\n\n tree_diffs = [0]\n first = heapq.heappop(tree_heights)\n while tree_heights:\n second = heapq.heappop(tree_heights)\n tree_diffs.append(abs(first-second))\n first = second\n\n tree_diffs.sort()\n\n #print(tree_heights)\n #print(tree_diffs)\n print(sum(tree_diffs[0:k]))\n\n\n\n\n\nif __name__ == '__main__':\n main()\n", "import heapq\n\ndef main():\n n,k = map(int,input().split())\n tree_heights = []\n\n for i in range(n):\n tree_heights.append(int(input()))\n tree_heights.sort()\n print(tree_heights)\n\n mn = 1000000000000000000000000000000\n for i in range(n-k+1):\n print(i,abs(tree_heights[i]-tree_heights[i+k-1]))\n mn = min(abs(tree_heights[i]-tree_heights[i+k-1]),mn)\n print(mn)\n\n #print(tree_heights)\n #print(tree_diffs)\n #print(sum(tree_diffs[0:k]))\n\n\n\n\n\nif __name__ == '__main__':\n main()\n", "import heapq\n\ndef main():\n n,k = map(int,input().split())\n tree_heights = []\n\n for i in range(n):\n tree_heights.append(int(input()))\n tree_heights.sort()\n #print(tree_heights)\n\n mn = 1000000000000000000000000000000\n for i in range(n-k+1):\n #print(i,abs(tree_heights[i]-tree_heights[i+k-1]))\n mn = min(abs(tree_heights[i]-tree_heights[i+k-1]),mn)\n print(mn)\n\n #print(tree_heights)\n #print(tree_diffs)\n #print(sum(tree_diffs[0:k]))\n\n\n\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s695817742', 's881353990', 's882473790', 's696995376']
[8572.0, 10684.0, 10688.0, 7556.0]
[373.0, 325.0, 373.0, 241.0]
[526, 559, 525, 527]
p03208
u695857481
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N, K = (int(x) for x in input().split())\n\ntrees = list()\n\nfor i in range(N):\n trees.append(int(input()))\n \ntrees = sorted(trees)\nprint(trees)\ndiff_list = []\n\nfor i in range(N - K + 1):\n diff = trees[i + K - 1] - trees[i]\n diff_list.append(diff)\n \nprint(diff_list)\nprint(min(diff_list))', 'N, K = (int(x) for x in input().split())\n\ntrees = list()\n\nfor i in range(N):\n trees.append(int(input()))\n \ntrees = sorted(trees)\ndiff_list = []\n\nfor i in range(N - K + 1):\n diff = trees[i + K - 1] - trees[i]\n diff_list.append(diff)\n \nprint(min(diff_list))']
['Wrong Answer', 'Accepted']
['s898363273', 's889833565']
[14788.0, 10892.0]
[276.0, 253.0]
[290, 260]
p03208
u697658632
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['n, k = map(int, input().split())\nh = sorted[int(input()) for i in range(n)]\nans = 1e9\nfor i in range(n - k + 1):\n ans = min(ans, h[i + k - 1] - h[i])\nprint(ans)\n', 'n, k = map(int, input().split())\nh = sorted([int(input()) for i in range(n)])\nans = 1e9\nfor i in range(n - k + 1):\n ans = min(ans, h[i + k - 1] - h[i])\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s938012062', 's333385724']
[2940.0, 8280.0]
[17.0, 238.0]
[162, 164]
p03208
u698176039
2,000
1,048,576
In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?
['N,K = map(int,input().split())\nh = [int(input()) for _ in range(N)]\n\nh = sorted(h)\nLh = len(h)\nwhile Lh > K:\n print(h)\n head = h[1] - h[0]\n tail = h[Lh-1]-h[Lh-2]\n if head > tail:\n h = h[1:]\n else:\n h = h[:Lh-1]\n Lh = len(h)\n \nprint(h[Lh-1]-h[0])\n', 'N,K = map(int,input().split())\nh = [int(input()) for _ in range(N)]\n\nh = sorted(h)\nhK = h[0:K]\nans = hK[K-1]-h[0]\nfor i in range(N-K+1):\n ans = min(ans,h[i+K-1]-h[i])\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s042680978', 's471535813']
[141660.0, 8280.0]
[1855.0, 239.0]
[286, 182]