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 | u103208639 | 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,k=map(int,input().split())\nh=[0]*n\nfor i in range(n):\n h[i]=int(input())\n\nans=10**9\nfor i in range(n-k):\n ans= min(h[i+k]-h[i], ans)\nprint(ans)\n', 'n,k =map(int,input().split())\nh=[0]*n\nfor i in range(n):\n h[i]=int(input())\nh.sort()\nans=10**9\nfor i in range(n-k+1):\n ans= min(h[i+k-1]-h[i], ans)\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s703845406', 's731966076'] | [6900.0, 7472.0] | [101.0, 257.0] | [188, 165] |
p03208 | u103902792 | 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 = float('inf')\n\nfor i in range(n-k+1):\n ans = min(H[i+k-1]-H[i])\nprint(ans)", "n,k = map(int,input().split())\nH = [int(input()) for _ in range(n)]\nH.sort()\nans = float('inf')\n\nfor i in range(n-k+1):\n ans = min(H[i+k-1]-H[i], ans)\nprint(ans)\n\n"] | ['Runtime Error', 'Accepted'] | ['s965131612', 's717907034'] | [7384.0, 7384.0] | [206.0, 241.0] | [157, 164] |
p03208 | u106181248 | 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 = 100000000\n\nfor i in range(len(h)-k+1):\n if h[i+k-1] - h[i] < ans:\n ans = h[i+k-1] - h[i]\n if ans = 0:\n break\n\nprint(ans)', 'n, k = map(int,input().split())\nh =[int(input()) for i in range(n)]\nh.sort()\nans = 1000000000000\n\nfor i in range(len(h)-k+1):\n if h[i+k-1] - h[i] < ans:\n ans = h[i+k-1] - h[i]\n if ans == 0:\n break\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s621840313', 's955771325'] | [2940.0, 7384.0] | [17.0, 232.0] | [231, 236] |
p03208 | u112247039 | 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(ans[j+k-1]-ans[j] for j in range(n-k+1)))', 'n,k = map(int,input().split())\nh = sorted([int(input()) for _ in range(n)])\nprint(min(h[j+k-1]-h[j] for j in range(n-k+1)))'] | ['Runtime Error', 'Accepted'] | ['s283040907', 's477117527'] | [14032.0, 14000.0] | [158.0, 173.0] | [127, 123] |
p03208 | u114366889 | 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}? | ['from collections import deque\n\nN,K = map(int,input().split())\nH_input = list()\nH = deque(maxlen=K)\ncount = 0\n\nfor i in range(N):\n H_input.append(int(input()))\nH_input.sort()\n\nfor h in H_input:\n if count <= K:\n H.append(h)\n else:\n if abs(H[0]-H[K]) >= abs(H[1]-h):\n H.append(h)\n# print(H)\nprint(abs(H[0]-H[K-1]))\n\n', "N,K = map(int,input().split())\nH_input = list()\nABS = float('inf')\n\nfor i in range(N):\n H_input.append(int(input()))\nH_input.sort()\n\n# print(H_input)\nfor i in range(N-K+1):\n \n if ABS > (H_input[i+K-1] - H_input[i]):\n # print('Before:',ABS)\n ABS = H_input[i+K-1] - H_input[i]\n # print('After:',ABS)\nprint(ABS)"] | ['Wrong Answer', 'Accepted'] | ['s482083726', 's863801444'] | [8032.0, 7384.0] | [235.0, 249.0] | [347, 363] |
p03208 | u121879791 | 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=sorted(h)\nprint(min(h_sort[j+k-1]-h[j] for j in range(n-k+1)))', 'n,k=map(int,input().split())\nh=[]\nfor i in range(n):\n h.append(int(input()))\nh_sort=sorted(h)\nprint(min(h[j+k-1]-h[j] for j in range(n-k+1)))', 'n,k=map(int,input().split())\nh=[]\nfor i in range(n):\n h.append(int(input()))\nh_sort=sorted(h)\nprint(min(h_sort[j+k-1]-h_sort[j] for j in range(n-k+1)))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s057514809', 's227337216', 's191853196'] | [8280.0, 8280.0, 8280.0] | [242.0, 238.0, 234.0] | [149, 144, 154] |
p03208 | u123745130 | 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=[int(input()) for _ in range(n)]\nlst=sorted(lst)\nab=lst[k-1]-lst[0]\ncd=lst[-1]-lst[-k]\nprint(ans=min(ab,cd))', 'n,k=map(int,input().split())\nlst=[int(input()) for _ in range(n)]\nlst=sorted(lst)\nans=float("inf")\nfor i in range(n+1-k):\n ans=min(ans,lst[k-1+i]-lst[i])\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s857012940', 's815817560'] | [8280.0, 8280.0] | [209.0, 248.0] | [141, 165] |
p03208 | u129836004 | 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\ndef c():\n n, k = map(int, input().split())\n h = []\n for i in range(n):\n h.append(int(input()))\n h.sort()\n d = collections.deque(maxlen = k)\n mins = []\n while len(d) < k:\n d.append(h.pop())\n while h:\n mins.append(d[k-1] - d[0])\n d.append(h.pop())\n mins.append(d[k-1] - d[0])\n print(min(mins))\nc()\n\n', 'import collections\nn, k = map(int, input().split())\nh = []\nfor i in range(n):\n h.append(int(input()))\nh.sort()\nd = collections.deque(maxlen = k)\nmins = []\nwhile len(d) < k:\n d.append(h.pop())\nwhile h:\n mins.append(max(d) - min(d))\n d.append(h.pop())\nprint(min(mins))\n\n', 'import collections\ndef c():\n n, k = map(int, input().split())\n h = []\n for i in range(n):\n h.append(int(input()))\n h.sort()\n d = collections.deque(maxlen = k)\n mins = []\n while len(d) < k:\n d.append(h.pop())\n while h:\n mins.append(d[0] - d[k-1])\n d.append(h.pop())\n mins.append(d[0] - d[k-1])\n print(min(mins))\nc()\n\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s278865548', 's502686305', 's380460785'] | [7984.0, 7988.0, 7988.0] | [234.0, 2104.0, 248.0] | [374, 280, 374] |
p03208 | u130900604 | 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\nq=sorted(h)\nansList=[]\nfor c,d in zip(q,q[k-1:]):\n print(c,d)\n ansList.append(d-c)\n\nprint(min(ansList))', 'n,k=map(int,(input().split()))\nh=[int(input()) for i in range(n)]\n\nq=sorted(h)\nansList=[]\nfor c,d in zip(q,q[k-1:]):\n ansList.append(d-c)\n\nprint(min(ansList))'] | ['Wrong Answer', 'Accepted'] | ['s974328326', 's676592753'] | [14580.0, 12800.0] | [357.0, 237.0] | [172, 159] |
p03208 | u133936772 | 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,k = map(int,input().split())\nl = sorted([int(input()) for _ in range(n)])\nprint(min(l[i+k]-l[i] for i in range(n-k+1))) ', 'n,k=map(int,input().split())\nl=sorted(int(input()) for _ in range(n))\na=10**9\nfor i in range(n-k+1):\n a=min(a,l[i+k-1]-l[i])\nprint(a)'] | ['Runtime Error', 'Accepted'] | ['s927277434', 's624889992'] | [8280.0, 13340.0] | [108.0, 187.0] | [160, 134] |
p03208 | u135116520 | 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=sorted(h)\nt=[]\nfor i in range(N-K+1):\n s=h[i+k-1]-h[i]\n t.append(s)\nprint(min(t))\n ', 'N,K=map(int,input().split())\nh=list(int(input()) for i in range(N))\nh=sorted(h)\nt=[]\nfor i in range(N-K+1):\n s=h[i+K-1]-h[i]\n t.append(s)\nprint(min(t))\n '] | ['Runtime Error', 'Accepted'] | ['s938553700', 's716839200'] | [8280.0, 10904.0] | [205.0, 251.0] | [152, 156] |
p03208 | u135197221 | 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 = Input()\n data = sorted(int(input()) for _ in range(n))\n print(min([data[i+k-1] - data[i] for i in range(n-k+1)]))\nmain()', 'def main():\n n, k = map(int, input().split(" "))\n data = sorted(int(input()) for _ in range(n))\n print(min([data[i+k-1] - data[i] for i in range(n-k+1)]))\nmain()'] | ['Runtime Error', 'Accepted'] | ['s802111509', 's926466388'] | [9036.0, 17116.0] | [24.0, 177.0] | [149, 170] |
p03208 | u136090046 | 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()\nprint(n, k)\nN = int(n)\nK = int(k)\n\nh_array = []\nfor i in range(N):\n tree = int(input())\n h_array.append(tree)\n\nh_array.sort()\n\n\nresult = float("inf")\n\nfor i in range(k - 1, N):\n result = min(result, h_array[i] - h_array[i - k + 1])\n\nprint(result)\n', 'n, k = input().split()\nprint(n, k)\nN = int(n)\nK = int(k)\n\nh_array = []\nfor i in range(N):\n tree = int(input())\n h_array.append(tree)\n\nh_array.sort()\n\n\nresult = float("inf")\n\nfor i in range(K - 1, N):\n result = min(result, h_array[i] - h_array[i - K + 1])\n\nprint(result)\n', 'n, k = input().split()\nN = int(n)\nK = int(k)\n\nh_array = []\nfor i in range(N):\n tree = int(input())\n h_array.append(tree)\n\nh_array.sort()\n\n\nresult = float("inf")\n\nfor i in range(k - 1, n):\n result = min(result, h_array[i] - h_array[i - k + 1])\n\nprint(result)', 'n, k = input().split()\nN = int(n)\nK = int(k)\n\nh_array = []\nfor i in range(N):\n tree = int(input())\n h_array.append(tree)\n\nh_array.sort()\n\n\nresult = float("inf")\n\nfor i in range(K - 1, N):\n result = min(result, h_array[i] - h_array[i - K + 1])\n\nprint(result)'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s346062316', 's836162742', 's915584931', 's583559658'] | [7384.0, 7384.0, 7384.0, 7384.0] | [225.0, 262.0, 227.0, 259.0] | [379, 379, 366, 366] |
p03208 | u136395536 | 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())\n\nh = []\nfor i in range(N):\n H = int(input())\n h.append(H)\n\n\nh.sort()\nprint(h)\nsmallest = 10**9\n\nfor i in range(N-K+1):\n print(h[i+K-1],h[i])\n diff = h[i+K-1] - h[i]\n if diff < smallest:\n smallest = diff\n\nprint(smallest)', 'N,K = (int(i) for i in input().split())\n\nh = []\nfor i in range(N):\n h.append(int(input()))\n\nh.sort()\n\ndifference = []\n\nfor i in range(N-K+1):\n #difference.append(h[N-1-i] - h[K-1-i])\n difference.append(h[K-1+i]-h[i])\n \nprint(min(difference))'] | ['Wrong Answer', 'Accepted'] | ['s325331560', 's254715682'] | [10520.0, 11212.0] | [380.0, 251.0] | [281, 253] |
p03208 | u140191608 | 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 = (map(int , input().split()))\ntree = []\nfor i in range(N):\n tree.append(int(input()))\nsort_tree = sorted(tree , reverse = True)\nprint(max(sort_tree[:M]) - min(sort_tree[:M]))', 'N , M = (map(int , input().split()))\ntree = []\nfor i in range(N):\n tree.append(int(input()))\nsort_tree = sorted(tree)\nprint(min([sort_tree[i+M-1] - sort_tree[i] for i in range(N-M+1)]))'] | ['Wrong Answer', 'Accepted'] | ['s117071396', 's008158706'] | [8604.0, 12060.0] | [235.0, 245.0] | [184, 188] |
p03208 | u145600939 | 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}? | ["h,n = map(int,input().split())\nh = [0]*n\nfor i in range(n):\n h[i] = int(input())\nh.sort()\nans = float('inf')\nfor i in range(n-k):\n ans = min(ans,abs(h[i+k-1]-h[i])\nprint(ans)\n", "n,k = map(int,input().split())\nh = [int(input()) for _ 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])\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s001799920', 's580220042'] | [2940.0, 7384.0] | [17.0, 250.0] | [181, 162] |
p03208 | u153064216 | 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(s) for s in input().split(' ')]\n \nh = []\nwhile len(h) != N:\n heapq.heappush(h, int(input()))\n \nmin_height = 1000000000\nh.sort()\nfor start in range(0, N - k + 1):\n end = start + k - 1\n diff = h[end] - h[start]\n if diff < min_height:\n min_height = diff\nprint(min_height)", "import heapq\n \nN, k = [int(s) for s in input().split(' ')]\n \nh = []\nwhile N > 0:\n heapq.heappush(h, int(input()))\n N -= 1\n \ntrees = heapq.nlargest(k, h)\nif len(trees) <= 1:\n print(0)\nelse:\n print(trees[0] - trees[-1])", "import heapq\n \nN, k = [int(s) for s in input().split(' ')]\n \nh = []\nwhile N > 0:\n heapq.heappush(h, int(input()))\n N -= 1\n \ntrees = heapq.nlargest(k, h)\nif len(trees) <= 1:\n print(0)\nelse:\n print(trees[-1] - trees[0])", 'import heapq\n\nN, k = int(input()), int(input())\n\nh = []\nwhile N > 0:\n heapq.heappush(h, int(input()))\n N -= 1\n \ntrees = heapq.nlargest(k, h)\nif len(trees) <= 1:\n print(0)\nelse:\n print(trees[-1] - trees[0])', "N, k = [int(s) for s in input().split(' ')]\n \nh = []\nwhile len(h) != N:\n h.append(int(input()))\n \nmin_height = 1000000000\nh.sort()\nfor start in range(0, N - k + 1):\n end = start + k - 1\n diff = h[end] - h[start]\n if diff < min_height:\n min_height = diff\nprint(min_height)"] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s324047265', 's456214550', 's456473160', 's819559248', 's793938510'] | [3064.0, 18456.0, 18472.0, 3188.0, 7484.0] | [18.0, 329.0, 326.0, 19.0, 262.0] | [300, 222, 222, 210, 291] |
p03208 | u156931988 | 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}? | ['tree_num,choice_num = map(int,input().split())\ntree_list = sorted([int(input()) for _ in range(tree_num)])\nmi = 99999\nfor idx in range(tree_num-choice_num):\n cand = tree_list[idx+choice_num-1] - tree_list[idx]\n if cand < mi:\n mi = cand\nprint(cand)', 'tree_num,choice_num = map(int,input().split())\ntree_list = sorted([int(input()) for _ in range(tree_num)])\nmi = 999999999999999999999999\nfor idx in range(tree_num-choice_num+1):\n cand = tree_list[idx+choice_num-1] - tree_list[idx]\n if cand < mi:\n mi = cand\nprint(mi)'] | ['Wrong Answer', 'Accepted'] | ['s358198767', 's070051850'] | [8280.0, 8280.0] | [232.0, 230.0] | [260, 279] |
p03208 | u159335277 | 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()))\n\ntrees = []\nfor _ in range(0, n):\n trees.append(int(input()))\ntrees.sort()\ntrees.reverse()\nans = 100000000000\nfor i in range(0, n-k):\n ans = min(ans, trees[i] - trees[i+k-1])\nprint(ans)', 'n, k = list(map(int, input().split()))\n\ntrees = []\nfor _ in range(0, n):\n trees.append(int(input()))\ntrees.sort()\ntrees.reverse()\nprint(trees[0] - trees[n-k])', 'n, k = list(map(int, input().split()))\n\ntrees = []\nfor _ in range(0, n):\n trees.append(int(input()))\ntrees.sort()\ntrees.reverse()\nans = 100000000000\nfor i in range(0, n-k+1):\n ans = min(ans, trees[i] - trees[i+k-1])\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s428952777', 's571188652', 's494755010'] | [7384.0, 7384.0, 7384.0] | [251.0, 225.0, 252.0] | [226, 159, 228] |
p03208 | u159994501 | 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 = 1000000000\nh = list(map(int, [input() for i in range(N)]))\nh.sort()\nprint(h)\nfor i in range(N-K+1):\n a = min(a, h[i+K-1]-h[i])\nprint(a)\n', '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(ans, h[i + K - 1] - h[i])\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s626952451', 's772513225'] | [14236.0, 8280.0] | [237.0, 246.0] | [175, 174] |
p03208 | u160244242 | 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}? | ['start = list(map(int, input().split()))\nn,k = start[0], start[1]\n\nlst = [int(input()) for i in range(n)]\n\nlst.sort()\nlst.reverse()\n\ndiff_lst = list()\nfor i in range(n-k+1):\n diff_lst.append(lst[i] - lst[i+k-1])\nmin(diff_lst)', 'start = list(map(int, input().split()))\nn,k = start[0], start[1]\n\nlst = [int(input()) for i in range(n)]\n\nlst.sort()\nlst.reverse()\n\ndiff_lst = list()\nfor i in range(n-k+1):\n diff_lst.append(lst[i] - lst[i+k-1])\nprint(min(diff_lst))'] | ['Wrong Answer', 'Accepted'] | ['s316374229', 's596789081'] | [11272.0, 11292.0] | [253.0, 242.0] | [227, 234] |
p03208 | u161442663 | 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=int(input())\nListNK=NK.split() #ListNK[0]=N,[1]=K\nN=ListNK[0]\nK=ListNK[1]\nListh=[]\nListQ=[]\nfor i in range(0,N,1):\n hi=int(input())\n Listh.append(hi)\n\nListh.sort() \nfor i in range(0,N-K+1,1):\n Q=int(Listh[K+i-1]-Listh[i]) \n ListQ.append(Q)\nListQ.sort()\nprint(ListQ[0])\n', 'NK=int(input())\nListNK=NK.split() #ListNK[0]=N,[1]=K\nN=int(ListNK[0])\nK=int(ListNK[1])\nListh=[]\nListQ=[]\nfor i in range(0,N,1):\n hi=int(input())\n Listh.append(hi)\n\nListh.sort() \nfor i in range(0,N-K,1):\n Q=int(Listh[K+i-1]-Listh[i]) \n ListQ.append(Q)\nListQ.sort()\nprint(ListQ[0])\n', 'NK=input()\nListNK=NK.split() #ListNK[0]=N,[1]=K\nN=int(ListNK[0])\nK=int(ListNK[1])\nListh=[]\nListQ=[]\nfor i in range(0,N,1):\n hi=int(input())\n Listh.append(hi)\n\nListh.sort() \nfor i in range(0,N-K+1,1):\n Q=int(Listh[K+i-1]-Listh[i]) \n ListQ.append(Q)\nListQ.sort()\nprint(ListQ[0])\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s435585265', 's648919869', 's940583821'] | [3060.0, 3064.0, 11224.0] | [17.0, 17.0, 294.0] | [363, 371, 368] |
p03208 | u163320134 | 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())\narr=[int(input()) for _ in range(n)]\narr=sorted(arr)\nans=10**10\nfor i in range(n-k):\n ans=min(ans,arr[i+k]-arr[i])\nprint(ans)', 'n,k=map(int,input().split())\narr=[int(input()) for _ in range(n)]\narr=sorted(arr)\nans=10**10\nfor i in range(n-k):\n ans=min(ans,sum(arr[i:i+k]))\nprint(ans)', 'n,k=map(int,input().split())\narr=[int(input()) for _ in range(n)]\narr=sorted(arr)\nans=10**10\nfor i in range(n-k+1):\n ans=min(ans,arr[i+k-1]-arr[i])\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s392066337', 's733233039', 's666931868'] | [8280.0, 8280.0, 8280.0] | [249.0, 2104.0, 241.0] | [155, 155, 159] |
p03208 | u163421511 | 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()\n\nfor i in range(n-k+1):\n a = h[i+k-1]-h[i]\n ans = a if i == 0 else min(ans, a)\n\nprint(ans)\n', 'n, k = map(int, input().split())\nh = [int(i) for i in range(n)]\nh.sort()\n\nfor i in range(n-k+1):\n a = h[i+k-1]-h[i-1]\n ans = a if i == 0 else min(ans, a)\n\nprint(ans)\n', 'n, k = map(int, input().split())\nh = [int(input()) for _ in range(n)]\nh.sort()\n\nfor i in range(n-k+1):\n a = h[i+k-1]-h[i]\n ans = a if i == 0 else min(ans, a)\n\nprint(ans)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s533610169', 's700694143', 's774596518'] | [9072.0, 12916.0, 13216.0] | [27.0, 78.0, 191.0] | [175, 172, 176] |
p03208 | u163501259 | 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\ndef main():\n N, K = map(int, input().split())\n h = [int(input()) for i in range(N)]\n H = sorted(h)\n ans = H[N-1] - H[N-K]\n print(ans)\n\nif __name__ == '__main__':\n main()", "import sys\ninput = sys.stdin.readline\ndef main():\n N, K = map(int, input().split())\n h = [int(input()) for i in range(N)]\n H = sorted(h)\n\n ans = 10**9 +1\n for i in range(N-K+1):\n high = H[i+K-1] - H[i] \n ans = min(ans, high)\n print(ans)\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s063553324', 's127047605'] | [8280.0, 8280.0] | [92.0, 112.0] | [225, 307] |
p03208 | u166621202 | 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 random\n\nN,K = map(int,input().split())\nH = [int(input()) for _ in range(N) ]\n\ntmp = random.sample(H,K)\nscr = max(tmp) - min(tmp)\nprint(scr)\n', 'N,K = map(int,input().split())\nH = [int(input()) for _ in range(N) ]\nH.sort()\n\ntmp = [H[i+K-1]-H[i] for i in range(N-K+1)]\n\nprint(min(tmp))\n'] | ['Wrong Answer', 'Accepted'] | ['s454137570', 's283383131'] | [9108.0, 11216.0] | [250.0, 232.0] | [147, 140] |
p03208 | u167523937 | 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=sorted(h)\n\ndef_list = [h[i+K-1]-h[i] for i in range(N-K+1)]\nprint(def_list)\nprint(min(def_list))', 'N,K=map(int,input().split())\nh=[int(input()) for i in range(N)]\nh=sorted(h)\n\ndef_list = [h[i+K-1]-h[i] for i in range(N-K+1)]\nprint(min(def_list))'] | ['Wrong Answer', 'Accepted'] | ['s680028720', 's970526019'] | [13560.0, 10872.0] | [251.0, 240.0] | [208, 196] |
p03208 | u167908302 | 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\nn, k = map(int, input().split())\nh = [int(input()) for _ in range(n)]\nh.sort()\nans = h[0]\n\nprint(min(h[i + k - 1] - h[i] for i in range(n - k + 1))\n', '# coding:utf-8\nn, k = map(int, input().split())\nh = [int(input()) for _ in range(n)]\nh.sort()\nans = h[0]\n\nprint(min(h[i + k - 1] - h[i] for i in range(n - k + 1)))\n'] | ['Runtime Error', 'Accepted'] | ['s849953157', 's102710368'] | [8896.0, 13312.0] | [25.0, 172.0] | [163, 164] |
p03208 | u172569352 | 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\ndef q49(n, k, h):\n h.sort()\n a = [h[i+k-1]-h[i] for i in range(n-1)]\n return min(a)\n \nN, K = [int(i) for i in input().split()]\nh = []\nfor _ in range(N):\n h.append(int(input()))\nprint(q49(N, K, h))', 'import itertools\n\ndef q49(n, k, h):\n h.sort()\n a = [h[i+k-1]-h[i] for i in range(n-k+1)]\n return min(a)\n \nN, K = [int(i) for i in input().split()]\nh = []\nfor _ in range(N):\n h.append(int(input()))\nprint(q49(N, K, h))'] | ['Runtime Error', 'Accepted'] | ['s036398163', 's218257186'] | [11316.0, 11316.0] | [240.0, 230.0] | [237, 239] |
p03208 | u177040005 | 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\nH = []\nfor i in range(N):\n h = 100000#int(input())\n H.append(h)\n\nH = sorted(H)\n\ntmp = 0\nans = H[-1]\nfor i in range(N-K+1):\n tmp = H[i+K-1] - H[i]\n# print(H[i:i+K])\n\n ans = min(ans, tmp)\n\nprint(ans)\n', 'N,K = map(int,input().split())\n\nH = []\nfor i in range(N):\n h = int(input())\n H.append(h)\n\nH = sorted(H)\n\ntmp = 0\nans = H[-1]\nfor i in range(N-K+1):\n tmp = H[i+K-1] - H[i]\n# print(H[i:i+K])\n\n ans = min(ans, tmp)\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s684969887', 's656397084'] | [4656.0, 8280.0] | [73.0, 266.0] | [245, 238] |
p03208 | u185249212 | 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}? | ['from __future__ import print_function\nimport numpy as np\nimport sys\nimport math,string,itertools,fractions,heapq,collections,re,array,bisect,copy,functools\n# from itertools import accumulate\n# from collections import deque\nimport random\n\ndef eprint(*args, **kwargs):\n print(*args, file=sys.stderr, **kwargs)\n\nn,k = map(int, input().split())\nh = np.zeros(n, dtype = int)\nfor i in range(n):\n h[i] = int(input())\n\nh.sort()\n\nll = np.zeros(n-k+1,dtype=int)\nfor i in range(n-(k-1)):\n ll[i] = abs(h[i] - h[i+(k-1)])\n \nprint(ll)\nprint(ll.min())\n \n \n\n# np.sort(h)\n# h.sort()\n# print(h)\n\n\n', 'from __future__ import print_function\nimport numpy as np\nimport sys\nimport math,string,itertools,fractions,heapq,collections,re,array,bisect,copy,functools\n# from itertools import accumulate\n# from collections import deque\nimport random\n\ndef eprint(*args, **kwargs):\n print(*args, file=sys.stderr, **kwargs)\n\nn,k = map(int, input().split())\nh = np.zeros(n, dtype = int)\nfor i in range(n):\n h[i] = int(input())\n\nh.sort()\n\nll = np.zeros(n-k+1,dtype=int)\nfor i in range(n-(k-1)):\n ll[i] = abs(h[i] - h[i+(k-1)])\n \n\nprint(ll.min())\n \n \n\n# np.sort(h)\n# h.sort()\n# print(h)\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s563655988', 's896212939'] | [14944.0, 14940.0] | [443.0, 433.0] | [619, 622] |
p03208 | u185325486 | 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\nmin_all = 1000000\n \nN,K = [int(i) for i in input().split(" ")]\nH = [int(input()) for _ in range(N)]\nH.sort()\nprint(H)\n \nfor i in range(N+1-K):\n min_now = H[K-1+i] - H[i]\n if min_all > min_now:\n min_all = min_now\nprint(min_all)\n ', 'import itertools\nmin_all = 1000000000000000000000000\n \nN,K = [int(i) for i in input().split(" ")]\nH = [int(input()) for _ in range(N)]\nH.sort()\n \nfor i in range(N+1-K):\n min_now = H[K-1+i] - H[i]\n if min_all > min_now:\n min_all = min_now\nprint(min_all)'] | ['Wrong Answer', 'Accepted'] | ['s109373270', 's128463134'] | [10548.0, 7540.0] | [244.0, 233.0] | [263, 263] |
p03208 | u185802209 | 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()\nmin=h[-1]-h[0]\nfor i in range(n-k+1):\n if h[i+k-1]-h[i] < min:\n min = h[i+k-1]-h[i]', 'n, k = map(int,(input().split()))\nh = []\nfor i in range(n):\n h.append(int(input()))\nh.sort()\nmin=h[-1]-h[0]\nfor i in range(n-k+1):\n if h[i+k-1]-h[i] < min:\n min = h[i+k-1]-h[i]\nprint(min)'] | ['Wrong Answer', 'Accepted'] | ['s155520324', 's951355621'] | [7384.0, 7384.0] | [234.0, 238.0] | [189, 200] |
p03208 | u186206732 | 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\n\nN,K = map(int,input().split())\n\ntrees = []\n\nfor i in range(N):\n trees.append(int(input()))\n\n\ntrees.sort(reverse=True)\n\ndiff_list =[]\n\nfor i in range(N-1):\n diff_list.append(trees[i]-trees[i+1])\n\ndiff_list.sort()\n\n\nprint(min(diff_list[:K]))\n', '\nN,K = map(int,input().split())\n\ntrees = []\n\nfor i in range(N):\n trees.append(int(input()))\n\n\ntrees.sort()\n\nans = 1000000000\nfor i in range(N-K+1):\n aa = trees[i+K-1]-trees[i]\n if aa < ans:\n ans = aa\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s841664403', 's996920284'] | [11852.0, 7384.0] | [280.0, 244.0] | [265, 228] |
p03208 | u189188797 | 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=map(int,input().split())\ntree=[]\nfor i in range(n):\n tree.append(int(input()))\nheikin=int(sum(tree)/len(tree))\nfor i in range(n):\n tree[i]=tree[i]-heikin\ntree.sort()\ntree.reverse()\nprint(tree)\nprint(abs(tree[1]-tree[m-1]))', 'n,k=map(int,input().split())\nanswer=0\ntree=[]\ndef tree_keisan(x,y): \n ans=tree[x+y-1]-tree[x]\n return ans\nfor i in range(n):\n tree.append(int(input()))\ntree.sort()\nanswer=tree_keisan(0,k)\nfor i in range(n-k+1):\n sa=tree_keisan(i,k)\n if answer>sa:\n answer=sa\nprint(answer)\n'] | ['Wrong Answer', 'Accepted'] | ['s806207976', 's200279551'] | [10572.0, 7388.0] | [253.0, 245.0] | [232, 337] |
p03208 | u189487046 | 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\nsys.setrecursionlimit(10 ** 6)\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\nN, K = map(int, input().split())\nH = [0]*N\nfor i in range(N):\n H[i] = int(input())\n\nH.sort()\nprint(H)\nans = 10**10\nfor i in range(N-K):\n ans = min(ans, H[i+(K-1)]-H[i])\nprint(ans)\n', 'import sys\nsys.setrecursionlimit(10 ** 6)\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\nN, K = map(int, input().split())\nH = [0]*N\nfor i in range(N):\n H[i] = int(input())\n\nH.sort()\nans = 10**10\nfor i in range(N-(K-1)):\n ans = min(ans, H[i+(K-1)]-H[i])\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s088558066', 's984997429'] | [10532.0, 7472.0] | [166.0, 159.0] | [282, 277] |
p03208 | u191635495 | 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()\nres = [h[i+k-1]-h[i] for i in range(n-k+1) ]\nprint(res)\n', 'n, k = map(int, input().split())\nh = [int(input()) for _ in range(n)]\nh.sort()\nres = [h[i+k-1]-h[i] for i in range(n-k+1) ]\nprint(min(res))'] | ['Wrong Answer', 'Accepted'] | ['s043433714', 's493958895'] | [13204.0, 11216.0] | [229.0, 233.0] | [135, 139] |
p03208 | u197968862 | 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)]\nans = max(h) - min(h)\nh.sort(reverse=True)\n\nprint(h)\nh_n = []\nfor i in range(0,n):\n l = h[i:i+k]\n if len(l) == k:\n h_n.append(l)\n\nseed = max(h)\nfor i in range(0,len(h_n)):\n high = max(h_n[i]) - min(h_n[i])\n if seed > high:\n seed = high\n\nprint(seed)', 'n, k = map(int,input().split())\nh = [int(input()) for i in range(n)]\nh.sort(reverse=True)\n\nseed = h[0]\nfor i in range(0,n-k+1):\n high = h[i] - h[i+k-1]\n seed = min(high,seed)\n\nprint(seed)'] | ['Wrong Answer', 'Accepted'] | ['s176659062', 's140124428'] | [882552.0, 7384.0] | [2157.0, 250.0] | [343, 193] |
p03208 | u201856486 | 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()))\n\na = [int(input()) for _ in range(n)]\na.sort()\nb = 0\nans = []\nprint(a)\nfor i in range(n - k + 1):\n b = a[i + k - 1] - a[i]\n ans.append(b)\nans.sort()\nprint(ans[0])', 'n,k=list(map(int, input().split()))\na=[int(input()) for _ in range(n)]\na.sort()\nc=[a[i+k-1]-a[i] for i in range(n-k+1)]\nprint(min(c))'] | ['Wrong Answer', 'Accepted'] | ['s403419737', 's726394887'] | [12268.0, 11292.0] | [280.0, 233.0] | [207, 133] |
p03208 | u209620426 | 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_li = [int(input()) for i in range(n)]\ndp = [[-1]*1000000010]*100010\n\ndef dfs(i, choosed):\n if i == n:\n if len(choosed) != k:\n dif = 10000000010\n else:\n dif = max(choosed) - min(choosed)\n\n elif len(choosed) >= 2 and dp[len(choosed)][max(choosed)-min(choosed)] != -1:\n dif = dp[len(choosed)][max(choosed)-min(choosed)]\n \n elif len(choosed) == k:\n dif = max(choosed) - min(choosed)\n else:\n dif = min(\n dfs(i+1, choosed + [h_li[i]]),\n dfs(i+1, choosed)\n )\n\n return dif\n\nprint(dfs(0, []))', 'n, k = map(int, input().split())\nh = [int(input()) for i in range(n)]\nh = sorted(h)\ndif = 10**9\n\nfor i in range(n-k+1):\n if dif > h[i+k-1] - h[i]:\n dif = h[i+k-1] - h[i]\n\nprint(dif)'] | ['Runtime Error', 'Accepted'] | ['s053627127', 's861973725'] | [7072.0, 8280.0] | [168.0, 223.0] | [630, 191] |
p03208 | u210827208 | 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\nx=[]\nfor i in range(n):\n x.append(int(input()))\n\nx.sort(reverse=True)\n\nprint(x[0]-x[k])', 'n,k=map(int,input().split())\n\nx=[]\nfor i in range(n):\n x.append(int(input()))\n\nx.sort()\n\ny=[]\n\nfor j in range(n):\n p=x[j+k-1]-x[j]\n y.append(p)\n\ny.sort()\n\nprint(y[0])', 'n,k=map(int,input().split())\n\nx=[]\nfor i in range(n):\n x.append(int(input()))\n\nx.sort()\n\ny=[]\n\nfor j in range(n-k+1):\n p=x[j+k-1]-x[j]\n y.append(p)\n\ny.sort()\n\nprint(y[0])'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s041409403', 's867425409', 's501969125'] | [7384.0, 11292.0, 11292.0] | [228.0, 252.0, 284.0] | [120, 171, 175] |
p03208 | u215743476 | 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()\n\nans = max(h) - min(h)\nfor i in range(n-k+1):\n ans = min(ans, h[i+k-1] - h[i])\n', 'n, k = map(int, input().split())\nh = [int(input()) for _ in range(n)]\nh.sort()\n\nans = max(h) - min(h)\nfor i in range(n-k+1):\n ans = min(ans, h[i+k-1] - h[i])\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s717151267', 's036017025'] | [7384.0, 7488.0] | [242.0, 252.0] | [161, 172] |
p03208 | u217086212 | 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 = [int(input()) for i in range(N)]\ncandidate = None\nh.sort()\nfor i in range(N-K+1):\n tmp = h[i+K+1] - h[i]\n if candidate == None or tmp < candidate:\n candidate = tmp\nprint(candidate)', 'N,K = list(map(int, input().split()))\nh = [int(input()) for i in range(N)]\ncandidate = None\nh.sort()\nfor i in range(N-K-1):\n tmp = h[i+K+1] - h[i]\n if candidate == None or tmp < candidate:\n candidate = tmp\nprint(candidate)', 'import numpy as np\nimport copy\nfor i in range(N-K+1):\n \n diff = 0\n print("h[i] is {}".format(h[i]))\n for j in range(K-1):\n if(h[i] >= h[j]):\n target = [a for a in h if a <= h[i] and a >= h[j]]\n print("0")\n exit()\n else :\n target = [a for a in h if a > h[i] and a < h[j]]\n media = (a.pop(np.abs(np.asarray(a) - h[i]).argmin()))\n choose_h =[h[i],h[j],media]\n diff = max(choose_h)-min(choose_h)\n if(diff < candidate):\n candidate = diff\nprint(candidate)', 'N,K = list(map(int, input().split()))\nh = [int(input()) for i in range(N)]\ncandidate = None\nh.sort()\nfor i in range(N-K+1):\n tmp = h[i+K-1] - h[i]\n if candidate == None or tmp < candidate:\n candidate = tmp\nprint(candidate)'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s549038970', 's722462284', 's759868490', 's420467379'] | [7384.0, 7384.0, 12472.0, 7384.0] | [240.0, 247.0, 148.0, 236.0] | [235, 235, 559, 235] |
p03208 | u222207357 | 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()))\n\nh.sort()\nans = 1e9\n\nprint(h)\nfor i in range(0,N-K+1):\n ans = min(ans,h[i+K-1]-h[i])\n print(i,ans)\nprint(ans)', 'N,K = map(int,input().split())\nh = []\nfor i in range(N):\n h.append(int(input()))\n\nh.sort()\nans = 1e9\n\n\nfor i in range(0,N-K+1):\n ans = min(ans,h[i+K-1]-h[i])\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s616782011', 's540553651'] | [10520.0, 7384.0] | [384.0, 262.0] | [199, 175] |
p03208 | u223133214 | 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()))\nn,k=n_k[0],n_k[1]\nh_list=[]\nfor i in range(n):\n h_list.append(int(input()))\nh_list.sort()\nmax = 99999999\nfor i in range(n-k+1):\n if max>h_list[n-1]-h_list[n-k]:\n max=h_list[n-1]-h_list[n-k]\nprint(max)', 'n_k=list(map(int,input().split()))\nn,k=n_k[0],n_k[1]\nh_list=[]\nfor i in range(n):\n h_list.append(int(input()))\nh_list=h_list.sort()\nmax = 99999999\nfor i in range(n-k+1):\n if max>h_list[i+k-1]-h_list[i]:\n max=h_list[i+k-1]-h_list[i]\nprint(max)\n \n', 'n_k = list(map(int, input().split()))\nn, k = n_k[0], n_k[1]\ntree_list = []\nfor i in range(n):\n tree_list.append(int(input()))\ntree_list.sort()\nmin = 1000000001\nfor i in range(n-k+1):\n if tree_list[i+k-1]-tree_list[i] <= min:\n\n min = tree_list[i+k-1]-tree_list[i]\nprint(int(min))\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s656215383', 's734367177', 's595470519'] | [7384.0, 7384.0, 7384.0] | [240.0, 230.0, 245.0] | [248, 261, 292] |
p03208 | u223904637 | 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())\nli=range(n)\nfor i in range(n):\n li[i]=int(input())\nli.sort()\nans=100000000000\nfor i in range(n-k+1):\n if ans>(li[i+k-1]-li[i]):\n ans=li[i+k-1]-li[i]\nprint(ans)\n \n ', 'n,k = map(int,input().split())\nli=list(range(n))\nfor i in range(n):\n li[i]=int(input())\nli.sort()\nans=100000000000\nfor i in range(n-k+1):\n if ans>(li[i+k-1]-li[i]):\n ans=li[i+k-1]-li[i]\nprint(ans)\n \n \n'] | ['Runtime Error', 'Accepted'] | ['s715703999', 's661374807'] | [3060.0, 7472.0] | [17.0, 243.0] | [217, 224] |
p03208 | u233288243 | 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}? | ['l = input().split(" ")\nalltrees = int(l[0])\nlighttrees = int(l[1])\ntl = []\nfor i in range(alltrees):\n tl.append(int(input()))\ntl= sorted(tl,reverse=True)\nh=0\ni = 0\nwhile(i<alltrees-lighttrees-1):\n h = min(tl[i]-tl[i+lighttrees-1], tl[i+1]-tl[i+lighttrees])\n i+=1\nprint(h)', '\n\nl = input().split(" ")\nalltrees = int(l[0])\nlighttrees = int(l[1])\ntl = []\nfor i in range(alltrees):\n tl.append(int(input()))\ntl= sorted(tl,reverse=True)\nh=0\nwhile(i<=alltrees-lighttrees):\n h = min(tl[i]-tl[i+lighttrees-1], tl[i+1]-tl[i+lighttrees])\nprint(h)', 'l = input().split(" ")\nalltrees = int(l[0])\nlighttrees = int(l[1])\ntl = []\nfor i in range(alltrees):\n tl.append(int(input()))\ntl= sorted(tl,reverse=True)\ntl.append(0)\nh=0\ni = 0\nwhile():\n h = min(tl[i]-tl[i+lighttrees-1], tl[i+1]-tl[i+lighttrees])\n i+=1\n if(tl[i+lighttrees]==0):\n break\nprint(h)', 'l = input().split(" ")\ntrees = int(l[0])\nlights = int(l[1])\nls=[]\nfor i in range(trees):\n ls.append(int(input()))\nls = sorted(ls,reverse=True)\nh = ls[0]-ls[lights-1]\nfor i in range(trees -lights):\n if h >min(ls[i]-ls[i+lights-1],ls[i+1]-ls[i+lights]):\n h = min(ls[i]-ls[i+lights-1],ls[i+1]-ls[i+lights])\nprint(h)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s029272924', 's041455759', 's312849696', 's841171001'] | [8280.0, 8280.0, 8280.0, 8280.0] | [306.0, 225.0, 215.0, 272.0] | [280, 266, 313, 323] |
p03208 | u240630407 | 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 = int(input())\n H.append(h)\nH = sorted(H)\nmi = 10**9\nfor i in range(N-K+1):\n _ = H[i+K] - H[i]\n if mi > _:\n mi = _\nprint(mi)', 'N, K = map(int, input().split())\nH = []\nfor i in range(N):\n h = int(input())\n H.append(h)\nH = sorted(H)\nmi = 10**9\nfor i in range(N-K):\n _ = H[i+K] - H[i]\n if mi > _:\n mi = _\nprint(mi)', 'N, K = map(int, input().split())\nH = []\nfor i in range(N):\n h = int(input())\n H.append(h)\nH = H.sorted()\nmi = 10**9\nfor i in range(N-K+1):\n _ = H[i+K] - H[i]\n if mi > _:\n mi = _\nprint(mi)', 'N, K = map(int, input().split())\nH = map(int, open(0))\nH = H.sorted()\nmi = 10**9\nfor i in range(N-K+1):\n _ = H[i+K] - H[i]\n if mi > _:\n mi = _\nprint(mi)', 'N, K = map(int, input().split())\nH = []\nfor i in range(N):\n h = int(input())\n H.append(h)\nH = sorted(H)\nmi = 10**9\nfor i in range(N-K+1):\n _ = H[i+(K-1)] - H[i]\n if mi > _:\n mi = _\nprint(mi)'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s102689695', 's500933387', 's974288105', 's991440287', 's040565919'] | [8280.0, 8280.0, 7076.0, 3060.0, 8276.0] | [248.0, 236.0, 187.0, 19.0, 242.0] | [205, 203, 206, 165, 209] |
p03208 | u253952966 | 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())\nan = list(map(int, input().split()))\n\nan.sort()\ndn = [-1 for _ in range(n - k + 1)]\nfor i in range(n - k + 1):\n dn[i] = an[i+k] - an[i]\n\nprint(min(dn))\n\n ', 'n, k = map(int, input().split())\nan = []\nfor _ in range(n):\n an.append(int(input()))\n\nan.sort()\ndn = [-1 for _ in range(n - k + 1)]\nfor i in range(n - k + 1):\n dn[i] = an[i+k-1] - an[i]\n\nprint(min(dn))\n\n '] | ['Runtime Error', 'Accepted'] | ['s518705891', 's778599440'] | [3864.0, 11288.0] | [21.0, 256.0] | [189, 207] |
p03208 | u257050137 | 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 = []\ndiff = 10 ** 9\nfor n in range(N):\n tree.append(int(input()))\ntree.sort()\nfor i in range(N - (K - 1)):\n print(tree[i], tree[i + 1], tree[i + 2])\n if tree[i + K - 1] - tree[i] < diff:\n diff = tree[i + K - 1] - tree[i]\nprint(diff)', 'N, K = map(int, input().split())\ntree = [int(input()) for n in range(N)]\ndiff = 10 ** 9\ntree.sort()\nfor i in range(N - (K - 1)):\n if tree[i] == tree[i + 1] == tree[i + 2]:\n diff = 0\n break\n elif tree[i + K - 1] - tree[i] < diff:\n diff = tree[i + K - 1] - tree[i]\nprint(diff)\n'] | ['Runtime Error', 'Accepted'] | ['s953340092', 's629185918'] | [10060.0, 7384.0] | [433.0, 251.0] | [286, 302] |
p03208 | u259861571 | 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()\nm = sum(h)\n\nfor i in range(n - k):\n m = min(h[i + k] - h[i], m)\nprint(m)\n', '#AtCoder\n\nN, K = (int(x) for x in input().split())\nS = (int(input()) for _ in range(N))\n\nlst = list(S)\n\nprint(max(lst)-min)', 'n, k = map(int, input().split())\nh = [int(input()) for _ in range(n)]\n\nh.sort()\nm = sum(h)\n\nfor i in range(n - k + 1):\n m = min(h[i + k - 1] - h[i], m)\nprint(m)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s382567593', 's995151624', 's082356919'] | [2940.0, 7084.0, 7384.0] | [17.0, 184.0, 242.0] | [156, 123, 164] |
p03208 | u266014018 | 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 numpy as np\n\n# import os\n# path = os.getcwd()\n# path = os.path.join(path,"input.txt")\n\n\ninput = sys.stdin.readline\nN,K = map(int,input().split())\nh = [int(input()) for _ in range(N)]\nh.sort()\nprint(h)\nans = float("inf")\nfor i in range(N-K+1):\n ans = min(ans,h[i+K-1]-h[i])\nprint(ans)', 'import sys\nimport numpy as np\n\n# import os\n# path = os.getcwd()\n# path = os.path.join(path,"input.txt")\n\n\ninput = sys.stdin.readline\nN,K = map(int,input().split())\nh = [int(input()) for _ 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])\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s544147687', 's518652676'] | [19808.0, 16740.0] | [271.0, 265.0] | [328, 319] |
p03208 | u273201018 | 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 func(L):\n return sum([L[i+1] - L[i] for i in range(len(L)-1)])\n\n\nN, K = map(int, input().split())\n\nH = []\n\nfor n in range(N):\n H.append(int(input()))\n\nH.sort()\n\nprint(min(H)) \n', 'def func(L):\n return sum([L[i+1] - L[i] for i in range(len(L)-1)])\n\n\nN, K = map(int, input().split())\n\nH = []\n\nfor n in range(N):\n H.append(int(input()))\n\nH.sort()\n\nR = [H[i:i+K] for i in range(N+1-K)]\n\nprint(0)\n', 'N, K = map(int, input().split())\n\nH = [int(input()) for n in range(N)]\n\nH.sort()\n\nR = [H[i+K-1] - H[i] for i in range(N+1-K)]\n\nprint(min(R))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s035822472', 's101340101', 's066212565'] | [7384.0, 880208.0, 11216.0] | [225.0, 2158.0, 243.0] | [202, 218, 141] |
p03208 | u276317406 | 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 = []\nfor i in range(n):\n h.append(int(input()))\nh.sort()\ndiffs = []\nfor i in range(n-k+1):\n diffs = h[i+k] - h[i]\nprint(min(diffs))\n", "n,k = input().split(' ')\nn = int(n)\nk = int(k)\nh = []\nfor i in range(n):\n h.append(int(input()))\nh.sort()\ndiffs = []\nfor i in range(n-k+1):\n diffs.append(h[i+k] - h[i])\nprint(min(diffs))\n", "n,k = input().split(' ')\nn = int(n)\nk = int(k)\nh = []\nfor i in range(n):\n h.append(int(input()))\nh.sort()\ndiffs = []\nfor i in range(n-k+1):\n diffs.append(h[i+k-1] - h[i])\nprint(min(diffs))\n"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s307806735', 's395589755', 's426900878'] | [7444.0, 11208.0, 11288.0] | [251.0, 235.0, 256.0] | [187, 193, 195] |
p03208 | u281303342 | 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()\nans = 10**10\nfor i in range(N-K+1):\n ans = min(ans, H[i-1+K]-H[i])\n print(i,ans)\n\nprint(ans)', '# Python3 (3.4.3)\nimport sys\ninput = sys.stdin.readline\n\n# -------------------------------------------------------------\n# function\n# -------------------------------------------------------------\n\n\n# -------------------------------------------------------------\n# main\n# -------------------------------------------------------------\nN,K = map(int,input().split())\nH = [int(input()) for _ in range(N)]\n\nH.sort()\n\nans = 10**10\nfor i in range(N-K+1):\n ans = min(ans, H[i+K-1]-H[i])\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s198714206', 's633940823'] | [8400.0, 7488.0] | [352.0, 141.0] | [176, 493] |
p03208 | u298945776 | 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(" "))\ntreehight = []\ndifference = []\nfor i in range(N):\n treehight.append(int(input()))\ntreehight.sort()\nfor j in range(N - 1):\n difference.append(treehight[j+1]-treehight[j])\n\nprint(min(difference))\n', 'N, K = map(int, input().split(" "))\ntreehight = []\ndifference = []\nfor i in range(N):\n treehight.append(int(input()))\ntreehight.sort()\nfor j in range(N - K + 1):\n difference.append(treehight[j+K-1]-treehight[j])\n\nprint(min(difference))\n'] | ['Wrong Answer', 'Accepted'] | ['s274929659', 's704394869'] | [11216.0, 11288.0] | [247.0, 248.0] | [236, 242] |
p03208 | u303037478 | 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())\nhList=[]\nfor i in range(n):\n hList.append(int(input()))\nhList.sort()\n//print(hList)\nans=100000000000000\nfor i in range(n-k+1):\n tmp=hList[i+k-1]-hList[i]\n if(ans>tmp):\n ans=tmp\nprint(ans)', 'n,k=map(int,input().split())\nhList=[]\nfor i in range(n):\n hList.append(int(input()))\nhList.sort()\n//print(hList)\nans=100000000000000\nfor i in range(n-k+1):\n tmp=hList[i+k-1]-hList[i]\n if(ans>tmp):\n ans=tmp\nprint(ans)\n', 'n,k=map(int,input().split())\nhList=[]\nfor i in range(n):\n hList.append(int(input()))\nhList.sort()\n#print(hList)\nans=100000000000000\nfor i in range(n-k+1):\n tmp=hList[i+k-1]-hList[i]\n if(ans>tmp):\n ans=tmp\nprint(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s269998655', 's961611360', 's247438066'] | [2940.0, 2940.0, 7384.0] | [17.0, 17.0, 257.0] | [222, 223, 222] |
p03208 | u304630225 | 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=[]\nfor i in range(N) :\n L.append(int(input()))\nM=[]\nfor x,y in zip(L,L[K-1:]) :\n M.append(y-x)\nprint(min(M))', 'N,K=map(int,input().split())\nL=[]\nfor i in range(N) :\n L.append(int(input()))\nL.sort()\nM=[]\nfor x,y in zip(L,L[K-1:]) :\n M.append(y-x)\nprint(min(M))'] | ['Wrong Answer', 'Accepted'] | ['s430092785', 's286023837'] | [11804.0, 11980.0] | [206.0, 247.0] | [141, 150] |
p03208 | u305018585 | 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\n\nN, K = map(int, input().split(' '))\n\nP = sorted([int(input()) for i in range(N)])\n\n\n\ndef eva(L):\n h_l = min(L)\n h_h = max(L)\n return h_h -h_l\n\ncandidate = []\nresult = eva(P[:3])\n\ndef dfs(now_l,k,l):\n global result\n print(now_l)\n if len(now_l)== k :\n f = eva(now_l)\n if f < result :\n result = f\n return \n for i in range(len(l)) :\n dfs(now_l+[l[i]], k,l[i+1:])\n if len(now_l) == k-1 :\n break\n return \n\nif any([i>= K for i in collections.Counter(P).values()]) :\n print(0)\nelse :\n dfs([],K, P) \n print(result)", 'N,K = map(int,input().split())\nh = [int(input()) for _ in range(N)]\nh = sorted(h)\nr = 10**10\n\nfor i in range(N-K+1):\n r = min(r,h[i+K-1]-h[i])\nprint(r)'] | ['Wrong Answer', 'Accepted'] | ['s914581103', 's723097306'] | [642316.0, 8284.0] | [2144.0, 250.0] | [615, 152] |
p03208 | u306071800 | 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())\n\ntree = [int(input()) for i in range(n)]\ntree.sort()\n\nres = (tree[i+k-1] - tree[i] for i in range(n-k+1))\nprint(min(res))', 'n, k = map(int, input())\n\ntree = [int(input()) for i in range(n)]\ntree.sort()\n\nres = (tree(i+k-1) - tree(i) for i range(n-k+11)\nprint(min(res))', 'n, k = map(int, input())\n\ntree = [int(input()) for i in range(n)]\ntree.sort()\n\nres = (tree(i+k-1) - tree(i) for i in range(n-k+1))\nprint(min(res))', 'n, k = map(int, input())\n\ntree = [int(input()) for i in range(n)]\ntree.sort()\n\nres = (tree(i+k-1) - tree(i) for i range(n-k+1))\nprint(min(res))', 'n, k = map(int, input().split())\n\ntree = [int(input()) for i in range(n)]\ntree.sort()\n\nres = (tree[i+k-1] - tree[i] for i in range(n-k+1))\nprint(min(res))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s000836957', 's073020519', 's301020684', 's643043252', 's078958983'] | [3060.0, 2940.0, 3060.0, 2940.0, 7384.0] | [17.0, 17.0, 17.0, 17.0, 226.0] | [146, 143, 146, 143, 154] |
p03208 | u312025627 | 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 = (int(i) for i in input().split())\n H = [int(i) for i in input().split()]\n H.sort()\n ans = 10**12\n for i in range(N-K+1):\n ans = min(ans, H[i+K-1] - H[i])\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "def main():\n N, K = (int(i) for i in input().split())\n H = [int(input()) for i in range(N)]\n H.sort()\n ans = 10**12\n for i in range(N-K+1):\n ans = min(ans, H[i+K-1] - H[i])\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Accepted'] | ['s004723384', 's514462379'] | [3060.0, 7384.0] | [17.0, 233.0] | [252, 251] |
p03208 | u314050667 | 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())2h=[int(input())foriinrange(N)]3h.sort()4print(min(h[i+K-1]-h[i]foriinrange(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'] | ['s842747922', 's894777962'] | [2940.0, 7384.0] | [17.0, 226.0] | [113, 127] |
p03208 | u317713173 | 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\nh = []\nfor i in range(N):\n h.append(int(input()))\n\nh.sort(reverse=True)\nprint(h)\ndh_max = h[0]\n\nfor i in range(N - K + 1):\n dh = max(h[i:K+i]) - min(h[i:K+i])\n if dh < dh_max:\n dh_max = dh\n\nprint(dh_max)', 'N, K = map(int, input().split())\n\nh = []\nfor i in range(N):\n h.append(int(input()))\n\nh.sort(reverse=True)\n\ndh_max = h[0]\n\nfor i in range(N - K + 1):\n dh = h[i] - h[K+i-1]\n if dh < dh_max:\n dh_max = dh\n\nprint(dh_max)'] | ['Wrong Answer', 'Accepted'] | ['s244746502', 's437872331'] | [10520.0, 7384.0] | [2104.0, 249.0] | [253, 231] |
p03208 | u318427318 | 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-*-\nimport sys\ninput=sys.stdin.readline\n\ndef ngram(numbers,n):\n return list([numbers[i:i+n] for i in range(len(numbers)-2)])\n\ndef main():\n numbers=[]\n s_numbers=[]\n dp=[]\n n,m = map(int,input().split())\n [numbers.append(int(input())) for _ in range(n)]\n s_numbers=sorted(numbers)\n n_list=ngram(s_numbers,3)\n print(n_list)\n\n for data in n_list:\n if len(data)==3:\n min_data=min(data)\n max_data=max(data)\n dp.append(max_data-min_data)\n else:\n break\n print(min(dp))\n\nif __name__=="__main__":\n main()', '#-*-coding:utf-8-*-\nimport sys\ninput=sys.stdin.readline\nimport numpy as np\n\ndef main():\n numbers=[]\n n,m = map(int,input().split())\n [numbers.append(int(input())) for _ in range(n)]\n n_numbers=np.array(numbers,dtype=int)\n n_numbers.sort()\n print(min(n_numbers[i+m-1] - n_numbers[i] for i in range(n-m+1)))\n\nif __name__=="__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s031508814', 's562450332'] | [31940.0, 30876.0] | [236.0, 190.0] | [605, 360] |
p03208 | u319818856 | 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 christmas_eve(N: int, K: int, H: list) -> int:\n sorted_H = sorted(H, reverse=True)\n return sorted_H[0] - sorted_H[K-1]\n\n\nif __name__ == "__main__":\n N, K = [int(s) for s in input().split()]\n H = [int(input()) for _ in range(N)]\n ans = christmas_eve(N, K, H)\n print(ans)\n', 'def christmas_eve(N: int, K: int, H: list) -> int:\n sorted_H = sorted(H, reverse=True)\n return min(sorted_H[i] - sorted_H[i + K - 1] for i in range(N - K + 1))\n\n\nif __name__ == "__main__":\n N, K = [int(s) for s in input().split()]\n H = [int(input()) for _ in range(N)]\n ans = christmas_eve(N, K, H)\n print(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s105868290', 's441157047'] | [8280.0, 8280.0] | [206.0, 246.0] | [292, 329] |
p03208 | u321623101 | 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())\nh=[]\nfor i in range(N):\n h.append(int(input()))\n\nh.sort()\nm=abs(h[0]-h[K-1])\nfor i in range(1,N-K):\n if m>abs(h[i]-h[K-1]):\n m=abs(h[i]-h[K-1])\nprint(m)', 'N,K=(int(i) for i in input().split())\nh=[]\nfor i in range(N):\n h.append(input())\n\nh.sort(reverse=True)\n\nm=int(h[0])-int(h[K-1])\nprint(m)', 'N,K=(int(i) for i in input().split())\nh=[]\nfor i in range(N):\n h.append(int(input()))\n\nh.sort()\nm=abs(h[0]-h[K-1])\nfor i in range(1,N-K+1):\n if m>abs(h[i]-h[i+K-1]):\n m=abs(h[i]-h[i+K-1])\nprint(m)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s418071245', 's629931604', 's499380919'] | [7384.0, 10584.0, 7388.0] | [249.0, 204.0, 245.0] | [203, 139, 209] |
p03208 | u325227960 | 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()))\n\nH.sort()\n\nprint(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)\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)\n'] | ['Wrong Answer', 'Accepted'] | ['s022769469', 's881711174'] | [10520.0, 7384.0] | [286.0, 252.0] | [210, 211] |
p03208 | u325956328 | 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, reverse=True)\nh = h[:K]\n# print(h)\nprint(max(h) - min(h))\n\n', 'N, K = map(int, input().split())\nh = [int(input()) for _ in range(N)]\nh = sorted(h, reverse=True)\nh = h[:K]\nprint(h)\nprint(max(h) - min(h))\n\n', 'import numpy as np\n\nN, K = map(int, input().split())\nh = [int(input()) for _ in range(N)]\nh = np.array(sorted(h))\ndiff_h = np.zeros(N, dtype=np.int16)\ndiff_h[1:] = np.diff(h)\nprint(h)\nprint(diff_h)\ncum_diff_h = np.cumsum(diff_h)\nprint(cum_diff_h)\ns = cum_diff_h[K - 1 :] - cum_diff_h[: -K + 1]\nprint(min(s))', 'import numpy as np\n\nN, K = map(int, input().split())\nh = [int(input()) for _ in range(N)]\nh = np.array(sorted(h))\ndiff_h = np.zeros(N, dtype=np.int32)\ndiff_h[1:] = np.diff(h)\n# print(h)\n# print(diff_h)\ncum_diff_h = np.cumsum(diff_h)\n# print(cum_diff_h)\ns = cum_diff_h[K - 1 :] - cum_diff_h[: -K + 1]\n# print(s)\nprint(min(s))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s035527503', 's392228517', 's474695232', 's956337019'] | [8280.0, 11316.0, 17896.0, 17908.0] | [215.0, 219.0, 360.0, 351.0] | [143, 141, 307, 324] |
p03208 | u328694671 | 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\n\nN,K=(int(x) for x in input().split())\n\nh=[]\nfor i in range(N):\n\th.append(int(input()))\t\nh.sort()\n\nminimum=10**10\ntmp=N-K\nfor i in range(N-K+1):\n\t#print("i/minimun",i,minimum)\n\tif h[i+K-1]-h[i] < minimum:\n\t\tminimum=h[i+K-1]-h[i]\n\n#print(minimum)\n#print(h)', 'import sys\n\nN,K=(int(x) for x in input().split())\n\nh=[]\nfor i in range(N):\n\th.append(int(input()))\t\nh.sort()\n\nminimum=10**10\ntmp=N-K\nfor i in range(N-K+1):\n\t#print("i/minimun,h[i+K-1],h[i]",i,minimum,h[i+K-1],h[i])\n\tif h[i+K-1]-h[i] < minimum:\n\t\tminimum=h[i+K-1]-h[i]\n\nprint(minimum)\n#print(h)'] | ['Wrong Answer', 'Accepted'] | ['s750342320', 's798131719'] | [7384.0, 7384.0] | [241.0, 237.0] | [266, 293] |
p03208 | u329058683 | 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=[]\nfor i in range(len(h)-K+1):\n b=h[K+1-i]-h[i]\n ans.append(b)\nprint(min(b))', 'N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\nh.sort()\nans=[]\nfor i in range(len(h)-K+1):\n b=h[K+i-1]-h[i]\n ans.append(b)\nprint(min(ans))'] | ['Runtime Error', 'Accepted'] | ['s879344256', 's376762300'] | [11212.0, 11288.0] | [246.0, 241.0] | [161, 163] |
p03208 | u329865314 | 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())\nlis = []\nfor _ in range(n):\n lis.append(int(input()))\nans = 100000000000000\nfor i in range(n-k+1):\n s = lis[i+k-1]-lis[i]\n if s < ans:\n ans = s\nprint(ans)', 'n, k = map(int,input().split())\nlis = []\nfor _ in range(n):\n lis.append(int(input()))\nans = 100000000000000\nlis.sort()\nfor i in range(n-k+1):\n s = lis[i+k-1]-lis[i]\n if s < ans:\n ans = s\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s849283137', 's703593890'] | [7072.0, 7484.0] | [219.0, 250.0] | [192, 203] |
p03208 | u337626942 | 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] - h[0]\nfor i in range(N-K+1):\n if h[K+i] - h[i+1] < Min:\n Min = h[K+i] - h[K]\n \nprint(Min)', 'N, K = map(int, input().split())\nh = [int(input()) for _ in range(N)]\nh.sort()\nMin = h[K] - h[0]\nfor i in range(N-K+1):\n if h[K+i-1] - h[i] < Min:\n Min = h[K+i-1] - h[i]\n \nprint(Min)'] | ['Runtime Error', 'Accepted'] | ['s263576450', 's747232189'] | [7384.0, 7384.0] | [229.0, 231.0] | [187, 189] |
p03208 | u339550873 | 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}? | ['#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN, K = [int(x) for x in input().split()]\nheight = []\nfor _ in range(N):\n height.append(int(input()))\n\nheight.sort()\nheight.reverse()\nsublist = []\nfor i in range(N-K+1):\n hmax-hmin = height[i]-height[i+K-1]\n sublist.append(hmax-hmin)\n\nprint(min(sublist))\n', '#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN, K = [int(x) for x in input().split()]\nheight = []\nfor _ in range(N):\n height.append(int(input()))\n\nheight.sort()\nheight.reverse()\nsublist = []\nfor i in range(N-K+1):\n hmaxhmin = height[i]-height[i+K]\n sublist.append(hmaxhmin)\n\nprint(min(sublist))\n', '#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN, K = [int(x) for x in input().split()]\nheight = []\nfor _ in range(N):\n height.append(int(input()))\n\nheight.sort()\nheight.reverse()\nsublist = []\nfor i in range(N-K+1):\n hmaxhmin = height[i]-heght[i+K]\n sublist.append(hmaxhmin)\n\nprint(min(sublist))\n\n', '#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN, K = [int(x) for x in input().split()]\nheight = []\nfor _ in range(N):\n height.append(int(input()))\n\nheight.sort()\nheight.reverse()\nsublist = []\nfor i in range(N-K+1):\n hmax-hmin = height[i]-heght[i+K]\n sublist.append(hmax-hmin)\n\nprint(min(sublist))\n', '#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN, K = [int(x) for x in input().split()]\nheight = []\nfor _ in range(N):\n height.append(int(input()))\n\nheight.sort()\nheight.reverse()\nsublist = []\nfor i in range(N-K+1):\n hmaxhmin = height[i]-height[i+K-1]\n sublist.append(hmaxhmin)\n\nprint(min(sublist))\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s364350616', 's906205683', 's934038140', 's989085067', 's807204967'] | [2940.0, 11208.0, 7384.0, 3056.0, 11288.0] | [18.0, 245.0, 219.0, 17.0, 281.0] | [311, 307, 307, 308, 309] |
p03208 | u340781749 | 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}? | ['from operator import sub\n\nn, k = map(int, input().split())\nhhh = sorted(int(input()) for _ in range(n))\nprint(min(map(sub, zip(hhh[k - 1:], hhh))))\n', 'from itertools import starmap\nfrom operator import sub\n\nn, k = map(int, input().split())\nhhh = sorted(int(input()) for _ in range(n))\nprint(min(starmap(sub, zip(hhh[k - 1:], hhh))))\n'] | ['Runtime Error', 'Accepted'] | ['s047300158', 's092711202'] | [7908.0, 7928.0] | [214.0, 224.0] | [148, 182] |
p03208 | u343671593 | 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\tH.append(int(input()))\n\nH.sort()\nans = 100007\nprint(H)\nfor i in range(0,len(H)-K+1):\n\t\n\tif ans >= H[i+K-1] - H[i]:\n\t\tans = H[i+K-1] - H[i]\n\t\t# print(ans)\nprint(ans)\n\n', 'N,K = map(int,input().split())\nH = []\nfor i in range(N):\n\tH.append(int(input()))\n\nH.sort()\nans = H[N-1]\n# print(H)\nfor i in range(0,len(H)-K+1):\n\t\n\tif ans > H[i+K-1] - H[i]:\n\t\tans = H[i+K-1] - H[i]\n\t\t# print(ans)\nprint(ans)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s554441947', 's444030749'] | [10520.0, 7384.0] | [251.0, 236.0] | [258, 260] |
p03208 | u345778634 | 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()\nminim = 1e10\nfor i in range(N-K):\n print(H[i], H[i+K-1])\n minim = min(minim, H[i+K-1] - H[i])\nprint(minim)', 'N, K = map(int, input().split())\nH = [int(input()) for _ in range(N)]\nH.sort()\nminim = 1e10\nfor i in range(N-K+1):\n minim = min(minim, H[i+K-1] - H[i])\nprint(minim)'] | ['Wrong Answer', 'Accepted'] | ['s177516080', 's714709595'] | [13212.0, 13232.0] | [252.0, 186.0] | [191, 167] |
p03208 | u346194435 | 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()]\nheights = [int(input()) for i in range(n)]\n\nheights.sort()\n\n\nanswer = max(heights) - min(heights)\n\nfor i in range(0, n-k+1):\n x = heights[i:i + k]\n print(x)\n candidate = max(x) - min(x)\n if candidate < answer:\n answer = candidate\n\nprint(answer)', 'n, k = [int(i) for i in input().split()]\nheights = []\nfor i in range(0,n):\n heights.append(int(input()))\n\n\nheights.sort()\nordered = heights[0:k-1]\nitem = max(ordered) - min(ordered)\n\n\nheights.sort(reverse=True)\nordered = ordered = heights[0:k-1]\nitem2 = max(ordered) - min(ordered)\n\nif item > item2:\n print(item2)\nprint(item)', 'n, k = [int(i) for i in input().split()]\nheights = [int(input()) for i in range(n)]\n\nheights.sort()\n\n\nanswer = max(heights) - min(heights)\n\nfor i in range(0, n-k+1):\n candidate = heights[i+k-1] - heights[i]\n if candidate < answer:\n answer = candidate\n\nprint(answer)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s413455936', 's585249035', 's247528276'] | [116404.0, 8572.0, 7384.0] | [2104.0, 242.0, 236.0] | [339, 338, 313] |
p03208 | u350093546 | 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()\nx=10**9\nfor i in range(n-k+1):\n x=min(x,a[i+k-1]-a[k])\nprint(x)', 'n,k=map(int,input().split())\na=[int(input()) for i in range(n)]\na.sort()\nx=10**9\nfor i in range(n-k+1):\n x=min(x,a[i+k-1]-a[i])\nprint(x)\n'] | ['Wrong Answer', 'Accepted'] | ['s679933702', 's471563319'] | [7384.0, 7384.0] | [242.0, 240.0] | [137, 138] |
p03208 | u352499693 | 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() for i in range(n)]))\nh.sort()\nres = 10**10\nfor i in range(k-1, n):\n res = min(res, h[i]-[i-k+1])\nprint(res)', 'n, k = map(int, input().split())\nh = list(map(int, [input() for i in range(n)]))\nh.sort()\nres = 10**10\nfor i in range(k-1, n):\n res = min(res, h[i]-h[i-k+1])\nprint(res)\n'] | ['Runtime Error', 'Accepted'] | ['s804448944', 's656605674'] | [14236.0, 14236.0] | [188.0, 228.0] | [170, 172] |
p03208 | u354915818 | 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}? | ['h = []\nfor i in range(N) : \n s = input()\n h.append(int(s))\n \nh = sorted(h)\nminDiff = h[len(h) - 1] - h[0]\nfor i in range(N) : \n try : \n diff = h[len(h) - K + i] - h[i]\n print(f"diff={h[len(h) - K + i]} - {h[i]} = {diff}")\n minDiff = min(minDiff , diff)\n \n except : \n if i == 0 : minDiff = 0\n continue\nprint(minDiff)', 's = input().split(" ")\nN = int(s[0])\nK = int(s[1])\n\nh = []\nfor i in range(N) : \n s = input()\n h.append(int(s))\n \nh = sorted(h)\nminDiff = h[len(h) - 1] - h[0]\nfor i in range(N) : \n try : \n diff = h[len(h) - K + i] - h[i]\n print(f"diff={h[len(h) - K + i]} - {h[i]} = {diff}")\n minDiff = min(minDiff , diff)\n \n except : \n if i == 0 : minDiff = 0\n continue\nprint(minDiff)\n ', 'h = []\nfor i in range(N) : \n s = input()\n h.append(int(s))\n \nh = sorted(h)\nminDiff = h[len(h) - 1] - h[0]\nfor i in range(N) : \n try : \n diff = h[len(h) - K + i] - h[i]\n print(f"diff={h[len(h) - K + i]} - {h[i]} = {diff}")\n minDiff = min(minDiff , diff)\n \n except : \n if i == 0 : minDiff = 0\n continue\nprint(minDiff)', 's = input().split(" ")\nN = int(s[0])\nK = int(s[1])\n\nh = []\nfor i in range(N) : \n s = input()\n h.append(int(s))\n \nh = sorted(h)\nminDiff = h[len(h) - 1] - h[0]\nfor i in range(N) : \n try : \n diff = h[i + K - 1] - h[i]\n minDiff = min(minDiff , diff)\n \n except : \n if i == 0 : minDiff = 0\n continue\nprint(minDiff)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s330233264', 's411686119', 's469807205', 's730437018'] | [2940.0, 2940.0, 2940.0, 8280.0] | [18.0, 18.0, 17.0, 269.0] | [372, 429, 372, 358] |
p03208 | u361826811 | 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 itertools\n\n# import numpy as np\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN, K, *H = map(int, read().split())\nH.sort()\nprint(min(H[i+K-1]-H[i]) for i in range(N-K+1))\n', 'import sys\nimport itertools\n\n# import numpy as np\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN, K, *H = map(int, read().split())\nH.sort()\nprint(min(H[i+K-1]-H[i] for i in range(N-K+1)))\n'] | ['Wrong Answer', 'Accepted'] | ['s744804060', 's743443573'] | [13040.0, 13040.0] | [76.0, 96.0] | [250, 250] |
p03208 | u363407238 | 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(h)\nmi=float('inf')\n \nfor i in range(n-k+1):\n mi = min(mi, h[i+k-1]-h[i])\n \nprint(mi)", "n,k = map(int,input().split())\nh=sorted(list(int(input()) for i in range(n)))\nh+=h\nmi=float('inf')\nansma=0\nansmi=0\na=0\nfor i in range(n):\n tmpma=h[i+k]\n tmpmi=h[i]\n if n <= i:\n break\n if mi > tmpma - tmpmi:\n a=i\n mi=tmpma-tmpmi\n\nprint(h[a]-h[a+k])", "n,k = map(int,input().split())\nh=[int(input()) for i in range(n)]\nh=sorted(h)\nmi=float('inf')\n \nfor i in range(n-k+1):\n mi = min(mi, h[i+k-1]-h[i])\n \nprint(mi)\n"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s456721811', 's734705499', 's749848486'] | [7072.0, 8268.0, 8280.0] | [172.0, 263.0, 243.0] | [160, 280, 163] |
p03208 | u365858785 | 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}? | ['a=list(map(int,input().split()))\nb=list(sorted([int(input()) for i in range(a[0])]))\nans=[]\nfor i in range(a[0]-a[1]+1):\n ans+=[abs(b[a[1]-1]-b[i])]\nprint(min(ans))', 'a=list(map(int,input.split()))\nlis=[]\nfor i in range(a[0]):\n lis+=int(input())\nlis=lis.sort()\nprint(lis)', 'a=list(map(int,input().split()))\nb=list(sorted([int(input()) for i in range(a[0])]))\nans=[]\nfor i in range(a[0]-a[1]+1):\n ans+=[abs(b[a[1]-1+i]-b[i])]\nprint(min(ans))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s351033647', 's802513144', 's085286713'] | [10924.0, 2940.0, 10924.0] | [242.0, 17.0, 246.0] | [165, 105, 167] |
p03208 | u368796742 | 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 = [int(input()) for i in range(n)]\nl.sort()\nans = l[-1]\nfor i in range(n-k):\n ans = min(ans,l[i+k]-l[i])\n if ans = 0\n print(0)\n exit()\n \nprint(ans)\n ', 'n,k = map(int,input().split())\nl = [int(input()) for i in range(n)]\nl.sort()\nans = l[-1]\nfor i in range(n-k+1):\n ans = min(ans,l[i+k-1]-l[i])\n if ans == 0:\n print(0)\n exit()\n \nprint(ans)\n \n'] | ['Runtime Error', 'Accepted'] | ['s774716965', 's676599887'] | [2940.0, 7384.0] | [17.0, 238.0] | [188, 199] |
p03208 | u370331385 | 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\nH = []\nfor i in range(N):\n h = int(input())\n H.append(h)\nH.sort()\n\nhmax_hmin = []\nfor i in range(N-K+1):\n print(H[i+K-1],H[i])\n hmax_hmin.append(H[i+K-1] - H[i]) \n \nprint(min(hmax_hmin))', 'N,K = map(int,input().split())\n\nH = []\nfor i in range(N):\n h = int(input())\n H.append(h)\nH.sort()\n\nhmax_hmin = []\nfor i in range(N-K+1):\n hmax_hmin.append(H[i+K-1] - H[i]) \nprint(min(hmax_hmin))'] | ['Wrong Answer', 'Accepted'] | ['s188524505', 's499349217'] | [13052.0, 11288.0] | [391.0, 248.0] | [223, 197] |
p03208 | u370793182 | 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())\nh = []\nfor i in range(N):\n h.append(int(input()))\nh.sort()\nmini = 1e9\nfor i in range(N-K+1):\n sub = h[i+K-1] - h[i]\n if(sub < mini){\n mini = sub\nprint(mini)', 'N, K = map(int, input().split())\nh = []\nfor i in range(N):\n h.append(int(input()))\nh.sort()\nmini = 1e9\nfor i in range(N-K+1):\n sub = h[i+K-1] - h[i]\n if(sub < mini){\n mini = sub\nprint(mini)\n', 'N, K = map(int, input().split())\nh = []\nfor i in range(N):\n h.append(int(input()))\nh.sort()\nmini = 1e9\nfor i in range(N-K+1):\n sub = h[i+K-1] - h[i]\n if(sub < mini):\n mini = sub\nprint(mini)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s534214313', 's996626322', 's708822524'] | [2940.0, 2940.0, 7384.0] | [17.0, 17.0, 242.0] | [187, 196, 196] |
p03208 | u371132735 | 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())\nhn = []\nfor i in range(N):\n hn.append(int(input()))\nhn = sorted(hn,reverse=True)\nmin = 99999999\nfor i in range(N-K+1):\n print("hn[i] is {} , hn[K+i] is {}".format(hn[i],hn[K+i-1]))\n if min > (hn[i]-hn[K+i-1]):\n min = hn[i]-hn[K+i-1]\nprint(min)\n', '\nN, K = map(int,input().split())\nM = [int(input()) for i in range(N)]\nM.sort()\nlis = [0]*(N-K+1)\nfor i in range(N-K+1):\n lis[i] = abs(M[i]-M[i+K-1])\nprint(min(lis))\n'] | ['Wrong Answer', 'Accepted'] | ['s565543253', 's475564185'] | [11196.0, 11036.0] | [367.0, 238.0] | [283, 193] |
p03208 | u371467115 | 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=0\n\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 \nprint(ans)', 'n,k=map(int,input().split())\nh=[i for i in range(n)]\nh.sort()\nl=[]\nfor i in range(k-2):\n l.appwnd(abs(h[i]-h[i+k-1]))\nprint(min(l))', 'n,k=map(int,input().split())\nh=[int(input()) for _ in range(n)]\nh.sort()\nans=0\n\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 \nprint(ans)\n', 'n,k=map(int,input().split())\nh=[int(input()) for _ in range(n)]\nh.sort()\nl=[]\nfor i in range(len(h)-k+1):\n l.append(abs(h[i]-h[i+k-1]))\nprint(min(l))\n'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s425237154', 's631933571', 's819785055', 's879112570'] | [7484.0, 7088.0, 7384.0, 11292.0] | [227.0, 26.0, 228.0, 238.0] | [164, 132, 165, 151] |
p03208 | u375282392 | 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\ta.append(int(input()))\n\nsa = sorted(a)\nv=1000000\nfor i in range(n-k+1):\n\tif v > sa[i+k-1]-sa[i] \n\t\tv = sa[i+k-1]-sa[i]\nprint(v)', 'n,k = map(int,input().split())\na=[]\nfor i in range(n):\n\ta.append(int(input()))\n\nsa = sorted(a)\nv=10**9\nfor i in range(n-k+1):\n\tif v > sa[i+k-1]-sa[i]:\n\t\tv = sa[i+k-1]-sa[i]\nprint(v)'] | ['Runtime Error', 'Accepted'] | ['s712766008', 's895213394'] | [2940.0, 8280.0] | [17.0, 249.0] | [183, 181] |
p03208 | u375695365 | 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\n\n', 'n,k=map(int,input().split())\nh=[int(input()) for _ in range(n)]\nh.sort()\nmin1=10**9*1\nsoezi=0\ncount=0\nfor i in range(n-(k-1)):\n count=h[i+(k-1)]-h[i]\n if min1>count:\n min1=count\nprint(min1)\n'] | ['Wrong Answer', 'Accepted'] | ['s958732488', 's959646089'] | [7072.0, 7384.0] | [171.0, 228.0] | [82, 203] |
p03208 | u379440427 | 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())\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 = sorted(list(map(int, [input() for i in range(n)])))\nans = h[n-1]\nfor j in range(n-k+1):\n ans = min(ans, (h[j+k]-h[j]))\nprint(ans)', 'n,k = map(int,input().split())\nh = sorted(list(map(int, [input() for i in range(n)])))\nans = h[n-1]\nfor j in range(n-k):\n ans = min(ans, (h[j+k]-h[j]))\nprint(ans)\n', 'n,k = map(int,input().split())\nh = sorted(list(map(int, [input() for i in range(n)])))\n\nprint(min(max(h[j:j+k])-min(h[j:j+k])) for j in range(n-k+1))\n', 'n,k = map(int,input().split())\nh = list(map(int, [input() for i in range(n)])).sort()\ndif = []\nfor j in range(n-k+1):\n dif.appned(max(h[j:j+k-1])-min(h[j:j+k-1]))\nprint(min(dif))\n', 'n,k = map(int,input().split())\nh = list(map(int, [input() for i in range(n)])).sort()\ndif = []\nfor j in range(n-k+1):\n dif.appned(max(h[i:i+k-1])-min(h[i:i+k-1]))\nprint(min(dif))', 'n,k = map(int,input().split())\nh = sorted(list(map(int, [input() for i in range(n)])))\nprint(min(h[j+k-1]-h[j] for j in range(n-k+1)))\n#for j in range(n-k):\n \n#print(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s211852862', 's631687294', 's776393004', 's825996155', 's876211798', 's989260661', 's558185206'] | [2940.0, 14236.0, 14236.0, 14236.0, 14236.0, 14236.0, 14236.0] | [18.0, 226.0, 228.0, 196.0, 193.0, 190.0, 212.0] | [134, 167, 166, 150, 180, 179, 206] |
p03208 | u386782537 | 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_list = [int(input()) for _ in range(N)]\ntree_list = sorted(tree_list)\nans = 10**9\nfor i in range(N-K-1):\n compare = tree_list[i+K]-tree_list[i]\n if ans > compare:\n ans = compare\nprint(ans)\n ', 'N,K = map(int,input().split())\ntree_list = [int(input()) for _ in range(N)]\ntree_list = sorted(tree_list)\nans = 10**9\nfor i in range(N-K+1):\n compare = tree_list[i+K-1]-tree_list[i]\n if ans > compare:\n ans = compare\nprint(ans)\n '] | ['Wrong Answer', 'Accepted'] | ['s273945248', 's972905552'] | [8280.0, 8280.0] | [237.0, 238.0] | [242, 244] |
p03208 | u390618988 | 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}? | ['from sys import stdin\nN, K = [int(x) for x in stdin.readline().rstrip().split()]\nh = [int(stdin.readline().rstrip()) for _ in range(N)]\nh.sort()\ndiff = [h[k + K] - h[k] for k in range(N - K)]\ndiff.sort()\nprint(diff[0])\n', 'from sys import stdin\nN, K = [int(x) for x in stdin.readline().rstrip().split()]\nh = [int(stdin.readline().rstrip()) for _ in range(N)]\nh.sort()\ndiff = [h[k + K - 1] - h[k] for k in range(N - K + 1)]\ndiff.sort()\nprint(diff[0])'] | ['Wrong Answer', 'Accepted'] | ['s956085842', 's148742230'] | [11212.0, 11292.0] | [153.0, 153.0] | [219, 226] |
p03208 | u393558821 | 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, x = map(int, input().split(' '))\nlst = []\nfor i in range(n):\n lst.append(int(input()))\n lst.sort()\n minn = 999999999999\n for i in range(0, n-x+1):\n if lst[i+x]-lst[i] < minn:\n minn = lst[i+x] - lst[i]\n print(minn)", "n, x = map(int, input().split(' '))\nlst = []\nfor i in range(n):\n\tlst.append(int(input()))\nlst.sort()\nminn = 999999999999\nfor i in range(n-1, x, -1):\n\tif lst[i]-lst[i-x] <= minn:\n\t\tminn = lst[i] - lst[i-x]\n\tif minn == 0:\n\t\tbreak\nprint(minn)", "n, x = map(int, input().split(' '))\nlst = []\nfor i in range(n):\n\tlst.append(int(input()))\nlst.sort()\nminn = 999999999999\nfor i in range(n-1, 0, -1):\n\tif lst[i]-lst[i-1] < minn:\n\t\tminn = lst[i] - lst[i-1]\n\tif minn == 0:\n\t\tbreak\nprint(minn)", "n, x = map(int, input().split(' '))\nlst = []\nfor i in range(n):\n\tlst.append(int(input()))\nlst.sort()\nminn = 999999999999\nfor i in range(n-1, x-1, -1):\n\tif lst[i]-lst[i-x+1] <= minn:\n\t\tminn = lst[i] - lst[i-x+1]\n\tif minn == 0:\n\t\tbreak\nprint(minn)", "n, x = map(int, input().split(' '))\nlst = []\nfor i in range(n):\n\tlst.append(int(input()))\nlst.sort()\nminn = 999999999999\nfor i in range(n-1, x, -1):\n\tif lst[i]-lst[i-x+1] <= minn:\n\t\tminn = lst[i] - lst[i-x+1]\n\tif minn == 0:\n\t\tbreak\nprint(minn)", "n, m = map(int, input().split(' '))\nlst = [int(input()) for i in range(n)]\nlst.sort()\nprint(min(lst[i+m-1]-lst[i] for i in range(n-m+1)))"] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s270760864', 's280195348', 's357430438', 's406591098', 's624808543', 's490039426'] | [3060.0, 7384.0, 7384.0, 7508.0, 7512.0, 7384.0] | [18.0, 243.0, 241.0, 249.0, 248.0, 225.0] | [229, 239, 238, 245, 243, 137] |
p03208 | u395202850 | 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)]\nhMin = 10**9\nfor i in range(n - k + 1):\n if h[k + i - 1]-h[i] < hMin:\n hMin = h[k + i - 1]-h[i]\nprint(hMin)\n', 'n, k = map(int, input().split())\nh = sorted([int(input()) for _ in range(n)])\nprint(min(h[k+i-1]-h[i] for i in range(n-k+1)))\n'] | ['Wrong Answer', 'Accepted'] | ['s766789947', 's931130874'] | [7072.0, 8280.0] | [191.0, 219.0] | [188, 126] |
p03208 | u398846051 | 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 = 1<<31\nfor i in range(N-K)+1:\n ans = min(ans, h[i+K-1]-h[i]\nprint(ans)', 'N, K = map(int, input().split())\nh = [int(input()) for _ in range(N)]\nh.sort()\nans = 1<<31\nfor i in range(N-K+1):\n ans = min(ans, h[i+K-1]-h[i])\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s711696894', 's462656523'] | [2940.0, 7384.0] | [18.0, 244.0] | [155, 156] |
p03208 | u405256066 | 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\nfrom sys import stdin\nN,K=[int(x) for x in stdin.readline().rstrip().split()]\ndata=[]\nfor i in range(N):\n data.append(int(input()))\ndata.sort()\ndata.reverse()\nans=float("inf")\nfor i in range(N-K+1):\n tmp=data[i]-data[i+K-1]\n if ans > tmp:', 'import numpy as np\nfrom sys import stdin\nN,K=[int(x) for x in stdin.readline().rstrip().split()]\ndata=[]\nfor i in range(N):\n data.append(int(input()))\ndata.sort()\ndata.reverse()\nans=float("inf")\nfor i in range(N-K+1):\n tmp=data[i]-data[i+K-1]\n if ans > tmp:\n ans=tmp\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s998799101', 's790135618'] | [3060.0, 21544.0] | [17.0, 769.0] | [266, 293] |
p03208 | u411544692 | 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())\nlengths = list(int(input()) for i in range(N))\nsorted_lengths = sorted(lengthes)\nmin_score = 2**100\n\nfor i in range(N-K+1):\n score = sorted_lengths[i+K-1] - sorted_lengths[i]\n min_score = min(min_score, score)\n\nprint(min_score)', 'N, K = map(int, input().split())\nlengths = list(int(input()) for i in range(N))\nsorted_lengths = sorted(lengths)\nmin_score = 2**100\n\nfor i in range(N-K+1):\n score = sorted_lengths[i+K-1] - sorted_lengths[i]\n min_score = min(min_score, score)\n\nprint(min_score)'] | ['Runtime Error', 'Accepted'] | ['s064589423', 's683540667'] | [7084.0, 8284.0] | [182.0, 252.0] | [262, 261] |
p03208 | u411923565 | 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, reverse = True)\nprint(h)\n\ndiff = 10**9\nfor i in range(N-K+1):\n a = h[i]-h[i+K-1]\n if diff > a:\n diff = a\n if diff == 0:\n break\nprint(diff)', '#C - Christmas Eve\nN,K = map(int,input().split())\nh = [int(input()) for _ in range(N)]\nh = sorted(h, reverse = True)\n\ndiff = 10**9\nfor i in range(N-K+1):\n a = h[i]-h[i+K-1]\n if diff > a:\n diff = a\n if diff == 0:\n break\nprint(diff)'] | ['Wrong Answer', 'Accepted'] | ['s205530226', 's357880614'] | [15980.0, 14176.0] | [193.0, 178.0] | [244, 254] |
p03208 | u416758623 | 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())\nls = k[int(input()) for _ in range(n)]\nls.sort()\ntmp = 10 ** 9\nfor i in range(n-k+1):\n diff = ls[i+k-1] - ls[i]\n if diff < tmp:\n tmp = diff\nprint(diff)', 'n,k = map(int, input().split())\nh = [int(input()) for _ in range(n)]\nh.sort()\ndis = []\nfor i, j in zip(h, h[1:]):\n dis += [j - i]\nprint(dis)\nprint(sum((sorted(dis)[:k-1])))', "n, k = map(int, input().split())\nls = sorted([int(input()) for _ in range(n)])\nans = float('inf')\n\nfor i in range(n-k+1):\n ans = min(ans, abs(ls[i] - ls[i+k-1]))\nprint(ans)"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s057455647', 's474793280', 's509371642'] | [2940.0, 12992.0, 8280.0] | [17.0, 277.0, 252.0] | [196, 175, 175] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.