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 | u698771758 | 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())\np=[int(input()) for i in range(n)]\np.sort()\nq=9999999999999\nfor i in range (n-k+1):\n print(p[k+i-1])\n print(p[i])\n if p[k+i-1]-p[i]<q:\n q=p[k+i-1]-p[i]\nprint(q)', 'n,k=map(int,input().split())\np=[int(input()) for i in range(n)]\np.sort()\nq=9999999999999\nfor i in range (n-k+1):\n if p[k+i-1]-p[i]<q:\n q=p[k+i-1]-p[i]\nprint(q)'] | ['Wrong Answer', 'Accepted'] | ['s624187947', 's168735620'] | [9032.0, 7440.0] | [374.0, 221.0] | [205, 169] |
p03208 | u704001626 | 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())\nc = [int(input()) for i in range(N)]\nc.sort()\noutput = c[K-1] - c[0]\nfor i in range(N-K):\n output = c[K+i] - c[i+1] if output > c[K+i] - c[i+1]\nprint(output)\n', '# -*- coding: utf-8 -*-\nN,K = map(int,input().split())\nc = [int(input()) for i in range(N)]\nc.sort()\noutput = c[K-1] - c[0]\nfor i in range(N-K):\n if output > c[K+i] - c[i+1]:output = c[K+i] - c[i+1]\nprint(output)\n'] | ['Runtime Error', 'Accepted'] | ['s608093557', 's621599164'] | [2940.0, 7444.0] | [18.0, 230.0] | [216, 216] |
p03208 | u707870100 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['# -*- coding: utf-8 -*-\n#ABC115C\nimport sys\n\ntmp = input().split()\nhoge = list(map(lambda a: int(a), tmp))\nn = hoge[0]\nk = hoge[1]\n\nh=[]\nfor i in range(0,n):\n\ttmp = int(input())\n\th.append(tmp)\n\nh.sort()\n#print(h)\n\nsum=0\nfor i in range(0,k):\n\tsum += h[i]\nminsum=sum\nfor i in range(0,n-k):\n\tsum += h[i+k]\n\tsum -= h[i]\n\tminsum = min(minsum,sum)\nprint(minsum)', '# -*- coding: utf-8 -*-\n#ABC115C\nimport sys\n\ntmp = input().split()\nhoge = list(map(lambda a: int(a), tmp))\nn = hoge[0]\nk = hoge[1]\n\nh=[]\nfor i in range(0,n):\n\ttmp = int(input())\n\th.append(tmp)\n\nh.sort()\n#print(h)\n#print(n)\n#print(k)\n\nres=h[k-1]-h[0]\n#print(res)\n\nfor i in range(1,n-k+1):\n\tres = min(res,h[k+i-1]-h[i])\n\t#print("i:{} res:{}".format(i,res))\nprint(res)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s728578276', 's637912826'] | [7432.0, 7384.0] | [274.0, 258.0] | [355, 367] |
p03208 | u709746636 | 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 = int(input())\nK = int(input())\nh = [int(input()) for i in range(N)]\nh.sort()\nprint(min(h[i+K-1] - h[i] for i in range(N-K+1)))', 'N = int(input())\nK = int(input())\nh = [int(input()) for i in range(N)]\nh.sort()\nprint(min(h[i+K-1] - h[i] for i in range(N-K+1)))', 'N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\nh.sort()\nprint(min(h[i+K-1] - h[i] for i in range(N-K+1)))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s774255486', 's829188523', 's566926263'] | [3060.0, 3060.0, 7488.0] | [17.0, 17.0, 221.0] | [129, 129, 128] |
p03208 | u712768978 | 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 functools import reduce\nn, k = map(int, input().split())\n\nheights = []\nfor _ in range(n):\n\theights.append(int(input()))\n\nheights.sort()\n\ndiff = [0]*n\n\nfor i in range(k,len(heights)):\n\tdiff[i] = heights[i]-heights[i-k]\n\t\nprint(reduce(min, diff[k:], 1000000002))', 'from functools import reduce\nn, k = map(int, input().split())\n\nheights = []\nfor _ in range(n):\n\theights.append(int(input()))\n\nheights.sort()\n\ndiff = [0]*n\n\nfor i in range(k-1,len(heights)):\n\tdiff[i] = heights[i]-heights[i-k+1]\n\t\nprint(reduce(min, diff[k-1:], 1000000002))'] | ['Wrong Answer', 'Accepted'] | ['s961056069', 's286445985'] | [12344.0, 12300.0] | [271.0, 260.0] | [265, 271] |
p03208 | u719183609 | 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 = []\n\nfor i in range(N):\n li.append(int(input()))\n\nli.sort()\n\nco = K - 1\nhmin = 1000000\nfor i in range(N):\n if hmin > li[i+co] - li[i]:\n hmin = li[i+co] - li[i]\n if hmin == 0:\n break\nprint(hmin)', 'N, K = map(int,input().split())\nli = []\n\nfor i in range(N):\n li.append(int(input()))\n\nli.sort()\n\nco = K - 1\nhmin = 1000000\nfor i in range(N-K+2):\n if hmin > li[i+co] - li[i]:\n hmin = li[i+co] - li[i]\n if hmin == 0:\n break\nprint(hmin)', 'N, K = map(int,input().split())\nli = []\n\nfor i in range(N):\n li.append(int(input()))\n\nli.sort()\n\nco = K - 1\nhmin = li[co] - li[0]\nfor i in range(N-K+1):\n if hmin > li[i+co] - li[i]:\n hmin = li[i+co] - li[i]\n if hmin == 0:\n break\nprint(hmin)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s089414750', 's585505753', 's031149127'] | [7384.0, 7384.0, 7484.0] | [252.0, 238.0, 233.0] | [296, 300, 307] |
p03208 | u720551456 | 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 = input().split()\nn = int(n)\nk = int(k)\nh =[]\nfor i in range(n):\n h.append(int(input()))\n\nh = h.sort(reverse=True)\nc = collections.Counter(h)\nflg = False\nfor i in c:\n if c[i] >= 3:\n print(0)\n flg = True\n break\n\ndiff=[]\nfor i in range(0,n-k+1,k):\n diff.append(abs(h[i] - h[i+k-1]))\nprint(min(diff))', 'import collections\n\nn,k = input().split()\nn = int(n)\nk = int(k)\nh =[]\nfor i in range(n):\n h.append(int(input()))\n\nh.sort(reverse=True)\nc = collections.Counter(h)\nflg = False\nfor i in c:\n if c[i] >= k:\n print(0)\n flg = True\n break\n\ndiff=[]\nfor i in range(0,n-k+1,k):\n diff.append(abs(h[i] - h[i+k-1]))\nprint(diff)', 'import collections\n\nn,k = input().split()\nn = int(n)\nk = int(k)\nh =[]\nfor i in range(n):\n h.append(int(input()))\n\nh = sorted(h)\nc = collections.Counter(h)\nflg = False\nfor i in c:\n if c[i] >= 3:\n print(0)\n flg = True\n break\n\nif flg == False:\n print(abs(h[n] - h[n-k]))', 'import collections\n\nn,k = input().split()\nn = int(n)\nk = int(k)\nh =[]\nfor i in range(n):\n h.append(int(input()))\n\nh.sort(reverse=True)\nc = collections.Counter(h)\nflg = False\nfor i in c:\n if c[i] >= k:\n print(0)\n flg = True\n break\n\ndiff=[]\nfor i in range(0,n-k+1,k):\n diff.append(abs(h[i] - h[i+k-1]))\nprint(min(diff))', 'import collections\n\nn,k = input().split()\nn = int(n)\nk = int(k)\nh =[]\nfor i in range(n):\n h.append(int(input()))\n\nh.sort(reverse=True)\n# c = collections.Counter(h)\n# flg = False\n\n# if c[i] >= k:\n# print(0)\n# flg = True\n# break\n\ndiff=[]\nfor i in range(0,n-k+1):\n diff.append(abs(h[i] - h[i+k-1]))\nprint(min(diff))'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s052063341', 's212836742', 's213595696', 's296845823', 's185462406'] | [7744.0, 16672.0, 16688.0, 16572.0, 11520.0] | [224.0, 279.0, 258.0, 267.0, 258.0] | [351, 342, 297, 347, 359] |
p03208 | u728498511 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['n, k, *h = map(int, open(0).read().split())\nh.sort()\nans = 0\nfor i in range(n-k+1):\n\tans = min(ans, h[i+k-1]-h[i])\nprint(ans)', 'n, k, *h = map(int, open(0).read().split())\nh.sort()\nans = 10e9+7\nfor i in range(n-k+1):\n\tans = min(ans, h[i+k-1]-h[i])\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s738673446', 's194216032'] | [14092.0, 14092.0] | [118.0, 120.0] | [125, 130] |
p03208 | u731028462 | 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()))\na=[]\nfor i in range(N):\n a.append(int(input()))\na.sort(reverse=True)\nprint(a[0]-a[K-1])', 'N,K=list(map(int,input().split()))\na=[]\nfor i in range(N):\n a.append(int(input()))\na.sort(reverse=True)\nans=a[0]-a[K-1]\nfor i in range(N-K+1):\n ans = min(ans, a[i]-a[i+K-1])\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s390290528', 's434873274'] | [7384.0, 7384.0] | [228.0, 260.0] | [123, 186] |
p03208 | u732468087 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['N, K = map(int, input().split())\nh = []\nfor _ in range(N):\n h.append(int(input()))\n\nh.sort()\n\nans = 10 ** 9\nfor i in range(N-K+1):\n print(h[i:i+K])\n ans = min(ans, max(h[i:i+K])-min(h[i:i+K]))\n\nprint(ans)', 'N, K = map(int, input().split())\nh = []\nfor _ in range(N):\n h.append(int(input()))\n\nh.sort()\n\nans = 10 ** 9\nfor i in range(N-K+1):\n ans = min(ans, h[i+K]-h[i])\n\nprint(ans)', 'N, K = map(int, input().split())\nh = []\nfor _ in range(N):\n h.append(int(input()))\n\nh.sort()\n\nans = 10 ** 9\nfor i in range(N-K+1):\n ans = min(ans, h[i+K-1]-h[i])\n\nprint(ans)\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s463172922', 's951905888', 's884948951'] | [104788.0, 7384.0, 7384.0] | [2104.0, 255.0, 249.0] | [213, 177, 180] |
p03208 | u733814820 | 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}? | ['# ABC 115 C\n\nN, K = map(int, input().split())\n\nh = [int(input()) for _ in range(N)]\n\nh.sort()\n\nans = 1.0e+9\n\nprint(h)\n\nfor i in range(N-K+1):\n ans = min(ans, h[i+K-1] - h[i])\n\nprint(ans)\n', 'def resolve():\n n, k = map(int, input().split())\n h = []\n for i in range(n):\n h.append(int(input()))\n h.sort()\n ans = 1e+9\n for i in range(n-k+1):\n ans = min(ans, h[i+k-1] - h[i])\n print(ans)\n\n return\n\nif __name__ == "__main__":\n resolve()\n'] | ['Wrong Answer', 'Accepted'] | ['s817826789', 's529600263'] | [10520.0, 7444.0] | [248.0, 225.0] | [190, 255] |
p03208 | u734548018 | 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 math\nimport sys\nfrom operator import itemgetter\n\n# N, K = map(int, input().split())\n# h = list(map(int, input().split()))\n# S = [input() for _ in range(H)]\n# X = [[0 for j in range(100)] for i in range(200)]\n\n\ndef solve(n, k, h):\n\th = sorted(h)\n\tprint(h)\n\t\n\tans = h[-1]\n\tfor i in range(k-1, n):\n\t\tans = min(ans, h[i] - h[i - k + 1])\n\tprint(ans)\n\nif __name__ == '__main__':\n\t### input\n\tn, k = map(int, input().split())\n\th = []\n\tfor i in range(n):\n\t\th.append(int(input()))\n\t###solve\n\tsolve(n, k, h)\n\t\n\t", "import math\nimport sys\nfrom operator import itemgetter\n\n# N, K = map(int, input().split())\n# h = list(map(int, input().split()))\n# S = [input() for _ in range(H)]\n# X = [[0 for j in range(100)] for i in range(200)]\n\n\ndef solve(n, k, h):\n\th = sorted(h)\n\t\n\tans = h[-1]\n\tfor i in range(k-1, n):\n\t\tans = min(ans, h[i] - h[i - k + 1])\n\tprint(ans)\n\nif __name__ == '__main__':\n\t### input\n\tn, k = map(int, input().split())\n\th = []\n\tfor i in range(n):\n\t\th.append(int(input()))\n\t###solve\n\tsolve(n, k, h)\n\t\n\t"] | ['Wrong Answer', 'Accepted'] | ['s764487782', 's775784282'] | [11432.0, 8356.0] | [260.0, 254.0] | [507, 497] |
p03208 | u735355352 | 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(n):\n ans.append(h[i + k - 1] - h[i])\nprint(min(ans))', 'n, k = map(int, input().split())\nh = [int(input()) for i in range(n)]\nh.sort()\nans = []\nfor i in range(n - k + 1):\n ans.append(h[i + k - 1] - h[i])\nprint(min(ans))\n'] | ['Runtime Error', 'Accepted'] | ['s833710469', 's511370581'] | [17148.0, 16924.0] | [182.0, 186.0] | [158, 167] |
p03208 | u744920373 | 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**8)\ndef ii(): return int(sys.stdin.readline())\ndef mi(): return map(int, sys.stdin.readline().split())\ndef li(): return list(map(int, sys.stdin.readline().split()))\ndef li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]\ndef dp2(ini, i, j): return [[ini]*i for i2 in range(j)]\ndef dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]\n\n#from collections import defaultdict #d = defaultdict(int) d[key] += value\n#from collections import Counter # a = Counter(A).most_common()\n#from itertools import accumulate #list(accumulate(A))\n\nN, K =mi()\nA = [ii() for _ in range(N)]\n\ntmp = float('inf')\nfor i in range(N-K+1):\n if A[i+K-1] - A[i] < tmp:\n tmp = A[i+K-1] - A[i]\nprint(tmp)\n", "import sys\nsys.setrecursionlimit(10**8)\ndef ii(): return int(sys.stdin.readline())\ndef mi(): return map(int, sys.stdin.readline().split())\ndef li(): return list(map(int, sys.stdin.readline().split()))\ndef li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]\ndef dp2(ini, i, j): return [[ini]*i for i2 in range(j)]\ndef dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]\n\n#from collections import defaultdict #d = defaultdict(int) d[key] += value\n#from collections import Counter # a = Counter(A).most_common()\n#from itertools import accumulate #list(accumulate(A))\n\nN, K =mi()\nA = sorted([ii() for _ in range(N)])\n\ntmp = float('inf')\nfor i in range(N-K+1):\n if A[i+K-1] - A[i] < tmp:\n tmp = A[i+K-1] - A[i]\nprint(tmp)\n"] | ['Wrong Answer', 'Accepted'] | ['s986855159', 's381919268'] | [7088.0, 8296.0] | [91.0, 127.0] | [811, 819] |
p03208 | u748377775 | 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 = []\n\nfor _ in range(N):\n h_list.append(int(input()))\n\nh_list.sort()\nanswer = h_list[N-1] - h_list[0]\n\nfor i in range(N-K+1):\n a = h_list[i+K-2] - h_list[i]\n answer = min(a,answer)\n\nprint(answer)', 'N, K = map(int, input().split())\nh_list = []\n\nfor _ in range(N):\n h_list.append(int(input()))\n\nh_list.sort()\nanswer = h_list[N-1] - h_list[0]\n\nfor i in range(N-K+1):\n a = h_list[i+K-1] - h_list[i]\n answer = min(a,answer)\n\nprint(answer)'] | ['Wrong Answer', 'Accepted'] | ['s526878699', 's985936313'] | [7488.0, 7384.0] | [263.0, 256.0] | [244, 244] |
p03208 | u748452487 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['N,K=(int(x) for x in input().split())\ni=1\np=[]\nwhile i<=N:\n p.append(int(input()))\n i=i+1\n\np.sort()\nhigh=[]\ni=0\nwhile i+K<=N:\n L=int(K+i)\n a = p[int(L-1)]\n b = p[i]\n deff = int(a - b)\n high.append(int(deff))\n i = i + 1\n\nprint(p)\nprint(high)\nprint(int(min(high)))', 'N,K=(int(x) for x in input().split())\ni=1\np=[]\nwhile i<=N:\n p.append(int(input()))\n i=i+1\n\np.sort()\nhigh=[]\ni=0\nwhile i+K<=N:\n L=int(K+i)\n a = p[int(L-1)]\n b = p[i]\n deff = int(a - b)\n high.append(int(deff))\n i = i + 1\n\nprint(int(min(high)))'] | ['Wrong Answer', 'Accepted'] | ['s364742900', 's623220739'] | [14844.0, 11192.0] | [348.0, 338.0] | [310, 289] |
p03208 | u761087127 | 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 itertools import combinations\n\nN, K = [int(n) for n in input().split()]\nh = [int(input()) for _ in range(N)]\nans = []\nfor c in combinations(h, K):\n ans.append(c[K-1]-c[0])\nprint(min(ans))\n', 'from itertools import combinations\n\nN, K = [int(n) for n in input().split()]\nh = [int(input()) for _ in range(N)]\nans = 0\nfor c in combinations(h, K):\n mc = max(c)-min(c)\n if ans < mc:\n ans = mc\nprint(ans)\n', 'N, K = [int(n) for n in input().split()]\nh = sorted([int(input()) for _ in range(N)])\nans = 10**9\nfor i in range(N-K+1):\n ans = min(ans, h[i+K-1]-h[i])\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s235098790', 's589157040', 's997941160'] | [366008.0, 10264.0, 8256.0] | [2126.0, 2104.0, 262.0] | [196, 217, 166] |
p03208 | u762420987 | 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 = [int(input()) for _ in range(N)]\nh_sorted = sorted(hlist)\nmae_3 = sum(h_sorted)[:3]\nusiro_3 = sum(h_sorted)[-3:]\nprint(mae_3 if mae_3 < usiro_3 else usiro_3)', 'N, K = map(int, input().split())\nhlist = sorted([int(input()) for _ in range(N)])\nans = 10**9\nfor i in range(N-K):\n ans = min(ans, hlist[i+K]-hlist[i])\nprint(ans)\n', 'N, K = map(int, input().split())\nhlist = sorted([int(input()) for _ in range(N)])\nans = 10**9\nfor i in range(N-K+1):\n ans = min(ans, abs(hlist[i] - hlist[i+K-1]))\nprint(ans)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s108079553', 's634919547', 's154425630'] | [8276.0, 8284.0, 8280.0] | [212.0, 249.0, 254.0] | [198, 166, 177] |
p03208 | u764956288 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['N,K = map(int, input().split())\ntrees = [int(input()) for _ in range(N)]\n\ntrees.sort()\n\ndiffs = []\nfor i,h in trees[:N-K]:\n min_h = h\n max_h = trees[i+K]\n diffs.append(max_h-min_h)\n\nprint(min(diffs))\n', 'N,K = map(int, input().split())\ntrees = [int(input()) for _ in range(N)]\n\ndef solve(N,K,trees):\n trees.sort()\n\n diffs = []\n for i,h in enumerate(trees[:N-K+1]):\n min_h = h\n max_h = trees[i+K-1]\n print(min_h,max_h)\n diffs.append(max_h-min_h)\n\n print(min(diffs))\nreturn\n\nsolve(N,K,trees)', 'N,K = map(int, input().split())\ntrees = [int(input()) for _ in range(N)]\n\ntrees.sort()\n\nprint(min([max_h-min_h for min_h,max_h in zip(trees,trees[K-1:])]))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s182314042', 's235974957', 's422845706'] | [7884.0, 3060.0, 11980.0] | [209.0, 17.0, 219.0] | [203, 325, 155] |
p03208 | u766566560 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['import itertools\n\nN, K = map(int, input().split())\nH = [int(input()) for i in range(N)]\n\nans = float("inf")\n\nfor s in itertools.permutations(H, K):\n list(s).sort()\n ans = min(ans, H[K-1] - H[0])\n \nprint(ans)', 'N, K = map(int, input().split())\nH = [int(input()) for i in range(N)]\nH.sort()\n\nans = 1000000000\n\nfor i in range(N-K+1):\n ans = min(ans, H[i+K-1] - H[i])\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s636530804', 's382345001'] | [11712.0, 7384.0] | [2104.0, 243.0] | [210, 166] |
p03208 | u767432305 | 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()\nprint(h)\n\ndef h_find(list,n):\n k=list[n-1]-list[0]\n for i in range(1,len(list)-n+1):\n k2=list[i+n-1]-list[i]\n if k2<k:\n k=k2\n if k==0:\n break\n return k\n\nprint(h_find(h,K))', 'N,K=map(int,input().split())\nh=[int(input()) for _ in range(N)]\nh.sort()\n\ndef h_find(list,n):\n k=list[n-1]-list[0]\n for i in range(1,len(list)-n+1):\n k2=list[i+n-1]-list[i]\n if k2<k:\n k=k2\n if k==0:\n break\n return k\n\nprint(h_find(h,K))'] | ['Wrong Answer', 'Accepted'] | ['s251160074', 's547692510'] | [10648.0, 7384.0] | [242.0, 221.0] | [296, 287] |
p03208 | u768896740 | 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\ntrees = []\n\nfor i in range(n):\n trees.append(int(input()))\n\ntrees.sort()\nprint(trees)\nmin_diff = 10**10\nfor j in range(n-k+1):\n diff = abs(trees[j] - trees[j+k-1])\n if diff < min_diff:\n min_diff = diff\n\nprint(min_diff)', 'n , k = map(int, input().split())\n\ntrees = []\n\nfor i in range(n):\n trees.append(int(input()))\n\ntrees.sort()\nmin_diff = 10**10\nfor j in range(n-k+1):\n diff = abs(trees[j] - trees[j+k-1])\n if diff < min_diff:\n min_diff = diff\n\nprint(min_diff)'] | ['Wrong Answer', 'Accepted'] | ['s327848588', 's916849308'] | [10520.0, 7492.0] | [267.0, 247.0] | [269, 256] |
p03208 | u770077083 | 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\nlis = []\n\nfor _ in range(n):\n lis.append(int(input())\n\nlis.sort()\n\nmin = 10**10\nfor i in range(len(lis)-k+1):\n dist = lis[i+k-1] - lis[i]\n if min > dist: min = dist\nprint(min)\n', 'n, k = map(int, input().split())\n\nlis = []\n\nfor _ in range(n):\n lis.append(int(input()))\n\nlis.sort()\n\nmin = 10**10\nfor i in range(len(lis)-k+1):\n dist = lis[i+k-1] - lis[i]\n if min > dist: min = dist\nprint(min)\n'] | ['Runtime Error', 'Accepted'] | ['s510377758', 's608885472'] | [2940.0, 7444.0] | [17.0, 244.0] | [219, 220] |
p03208 | u771532493 | 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())\nhlist=[int(input()) for i in range(N)]\nhlist.sort()\nprint(hlist)\ndif=[]\nfor j in range(N-K+1):\n dif.append(hlist[j+K-1]-hlist[j])\nprint(min(dif))', 'N,K=(int(i) for i in input().split())\nhlist=[]\nfor _ in range(N):\n hlist.append(int(input()))\nhlist.sort()\nfor j in range(N-K+2):\n dif=[hlist[j+k]-hlist[j]]\nprint(min(dif))', 'N,K=(int(i) for i in input().split())\nhlist=[int(input()) for l in range(N)]\nhlist.sort()\nfor j in range(N-K+2):\n dif=[hlist[j+k]-hlist[j]]\nprint(min(dif))', 'N,K=(int(i) for i in input().split())\nhlist=[int(input()) for i in range(N)]\nhlist.sort()\nprint(hlist)\ndif=[]\nfor j in range(N-K):\n dif.append(hlist[j+K-1]-hlist[j])\nprint(min(dif))', 'N,K=(int(i) for i in input().split())\nhlist=[int(input()) for i in range(N)]\nhlist.sort()\ndif=[]\nfor j in range(N-K+1):\n dif.append(hlist[j+K-1]-hlist[j])\nprint(min(dif))'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s093751374', 's276380159', 's458199287', 's978827181', 's550070485'] | [11972.0, 7384.0, 7384.0, 11972.0, 11288.0] | [253.0, 220.0, 213.0, 241.0, 242.0] | [186, 178, 158, 184, 173] |
p03208 | u773686010 | 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}? | ['#AtCorder Begginer Contest 161 Christmas Eve\nN,K= map(int, input().split())\nTree_List= [int(input()) for i in range(N)]\nTree_List=np.array(sorted(Tree_List))\nAnswer=min(Tree_List[K-1:]-Tree_List[:-(K-1)])\nprint(Answer)', '#AtCorder Begginer Contest 161 Christmas Eve\nN,K= map(int, input().split())\nTree_List= [int(input()) for i in range(N)]\nTree_List=np.array(sorted(Tree_List))\nmin(Tree_List[K-1:]-Tree_List[:-(K-1)])', '#AtCorder Begginer Contest 161 Christmas Eve\nimport numpy as np\nN,K= map(int, input().split())\nTree_List= [int(input()) for i in range(N)]\nTree_List=np.array(sorted(Tree_List))\nAnswer=min(Tree_List[K-1:]-Tree_List[:-(K-1)])\nprint(Answer)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s148727696', 's928776717', 's957564628'] | [7072.0, 7072.0, 17904.0] | [178.0, 171.0, 365.0] | [218, 197, 237] |
p03208 | u780475861 | 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.sort()\nprint(min(h[i + k - 1] - h[i] for i in range(n - k + 1)))\n', 'n,k = map(int, input().split())\nlst = [int(input()) for _ in range(n)]\nlst.sort()\nprint(min(lst[i + k - 1] - lst[i] for i in range(n - k + 1)))\n'] | ['Runtime Error', 'Accepted'] | ['s363774939', 's946326505'] | [7384.0, 7384.0] | [216.0, 231.0] | [140, 144] |
p03208 | u780698286 | 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 = 10 ** 10\nfor i in range(n-k+1):\n ans = min(ans, (max(a[i:i+k])-min(a[i:i+k])))\nprint(ans)', 'n, k = map(int, input().split())\nh = [int(input()) for i in range(n)]\nh.sort()\nans = 10 ** 10\nfor i in range(n-k+1):\n ans = min(ans, h[i:i+k][-1] - a[i:i+k][0])\nprint(ans)', 'n, k = map(int, input().split())\nh = [int(input()) for i in range(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)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s439275562', 's442644665', 's209475030'] | [13308.0, 13680.0, 13324.0] | [153.0, 152.0, 195.0] | [175, 172, 161] |
p03208 | u781262926 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['n, k, H = map(int, open(0).read().split())\nH.sort()\nans = 10 ** 10\nfor h0, h1 in zip(H, H[k-1:]):\n ans = min(ans, h1-h0)\nprint(ans)', 'n, k, *H = map(int, open(0).read().split())\nH.sort()\nans = 10 ** 10\nfor h0, h1 in zip(H, H[k-1:]):\n ans = min(ans, h1-h0)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s812991722', 's887382800'] | [11200.0, 14092.0] | [26.0, 110.0] | [132, 133] |
p03208 | u792512290 | 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\ntrees = []\nfor _i in range(n):\n trees.append(int(input())\n\ntrees.sort()\nans = float('inf')\n\nfor i in range(n - k + 1):\n diff = trees[i + k - 1] - trees[i]\n if ans > diff:\n ans = diff\n\nprint(ans)", "n, k = map(int, input().split())\n\ntrees = []\nfor _i in range(n):\n tree = int(input())\n trees.append(tree)\n\ntrees.sort()\nans = float('inf')\n\nfor i in range(n - k + 1):\n diff = trees[i + k - 1] - trees[i]\n if ans > diff:\n ans = diff\n\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s377343849', 's130806744'] | [8660.0, 13232.0] | [24.0, 192.0] | [234, 249] |
p03208 | u793174294 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['#Coding:Utf-8\n\nN,K=list(map(int, input().split()))\na=[int(input()) for i in range(N)]\n\na.sort()\n\nmin=a[N-1]-a[0]\nprint(a)\nfor l in range(N-K+1):\n if min>a[l+K-1]-a[l]:\n min=a[l+K-1]-a[l]\n\nprint(min)\n', '#Coding:Utf-8\n\nN,K=list(map(int, input().split()))\na=[int(input()) for i in range(N)]\n\na.sort()\n\nmin=a[N-1]-a[0]\nfor l in range(N-K+1):\n if min>a[l+K-1]-a[l]:\n min=a[l+K-1]-a[l]\n\nprint(min)\n'] | ['Wrong Answer', 'Accepted'] | ['s930705155', 's480527115'] | [10520.0, 7384.0] | [231.0, 227.0] | [209, 200] |
p03208 | u794910686 | 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=sorted([int(input()) for _ in range(N)])\nprint(h)\n\nans=10**9\n\nfor i in range(N-2):\n if ans>h[i+2]-h[i]:\n ans=h[i+2]-h[i]\n else:\n continue\nprint(ans)\n', 'N,K=[int(i) for i in input().split()]\nh=sorted([int(input()) for _ in range(N)])\n\nans=10**9\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 else:\n continue\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s929365828', 's692936406'] | [11368.0, 8204.0] | [256.0, 237.0] | [209, 206] |
p03208 | u799065076 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['import numpy as np\n\nN,K=list(map(int,input().split()))\nh=np.zeros(N)\nfor i in range(N):\n h[i]=int(input())\n \nh=np.sort(h)\nh_min=10**9\nfor i in range(N-K+1):\n dh=h[i+K-1]-h[i]\n if dh<dh_min:\n dh_min=dh\nprint(dh_min)', 'import numpy as np\n \nN,K=list(map(int,input().split()))\nh=np.zeros(N)\nfor i in range(N):\n h[i]=int(input())\n \nh=np.sort(h)\ndh_min=10**9\nfor i in range(N-K+1):\n dh=h[i+K-1]-h[i]\n if dh<dh_min:\n dh_min=dh\nprint(int(dh_min))'] | ['Runtime Error', 'Accepted'] | ['s052020928', 's308420951'] | [23440.0, 14008.0] | [360.0, 460.0] | [233, 240] |
p03208 | u799691369 | 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 = int(input())\nsentences = [[] for i in range(n)]\n\nfor i in range(n):\n nn = int(input())\n\n for j in range(nn):\n p, t = map(int, input().split())\n sentences[i].append([p - 1, t])\n\nans = 0\ncount = 0\nfor i in range(2 ** n):\n check = {}\n success = True\n for j in range(n):\n \n if ((i >> j) & 1):\n sentence = sentences[j]\n\n for pp, tt in sentence:\n if pp in check:\n if check[pp] == tt:\n pass \n else:\n success = False\n break\n else:\n check[pp] = tt\n #print(check)\n else:\n sentence = sentences[j]\n\n for pp, tt in sentence:\n if pp in check:\n if check[pp] != tt:\n pass \n else:\n success = False\n break\n else:\n if tt == 1:\n check[pp] = 0\n else:\n check[pp] = 1\n\n if success == False:\n # print('break')\n break\n\n if success:\n # print(check)\n count = bin(i).count('1') \n ans = max(ans, count)\n\n # print('c, a:', count, ans)\n\nprint(ans)\n", "n, k = map(int, input().split())\n\ninput_list = []\nfor i in range(n):\n input_list.append(int(input()))\n\ninput_list.sort()\n\nans = float('inf')\nans_index = 0\nfor i in range(n-k+1):\n h = input_list[i+k-1] - input_list[i]\n ans = min(ans, h)\n\nprint(ans)\n\n "] | ['Runtime Error', 'Accepted'] | ['s223918316', 's464030185'] | [3064.0, 7384.0] | [18.0, 261.0] | [1440, 262] |
p03208 | u806855121 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\n\nh = sorted(h)\nans = 10**9\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 print(i, ans)\n\nprint(ans)\n', 'N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\n\nh = sorted(h)\nans = 10**9\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'] | ['Wrong Answer', 'Accepted'] | ['s544353990', 's676719377'] | [8512.0, 8280.0] | [337.0, 228.0] | [210, 192] |
p03208 | u812354010 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['N,K = int(input().split())\nh = [int(input()) for i in range(N)]\n \n \nlist2=list()\n \nh.sort()\n \nfor i in range(N-K):\n list2.append(h[i+K]-h[i+1])\n continue\nprint(min(list2))', 'N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\n \n \nlist2=list()\n \nh.sort()\n \nfor i in range(N-K):\n list2.append(h[i+K]-h[i+1])\n continue\nprint(min(list2))', 'K,N = int(input().split())\nh = [int(input()) for i in range(N)]\n\n\nlist2=list()\n\nh.sort()\n\nfor i in range(N-K):\n list2.append(h[i+K]-h[i+1])\n continue\nprint(min(list2))', 'N, K = map(int, input().split())\nh = [int(input()) for i in range(N)]\n\nlist2=list()\nh.sort()\n\nfor i in range(N-K+1):\n list2.append(h[i+K-1]-h[i])\n continue\nprint(min(list2))'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s253668518', 's371510518', 's792205201', 's080474561'] | [3060.0, 11212.0, 3060.0, 11288.0] | [19.0, 232.0, 17.0, 237.0] | [177, 183, 173, 179] |
p03208 | u814608389 | 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 math\n\n\n\nn,k = map(int, input().split())\nh = sorted(list(map(int, (input() for i in range(n)))))\n\nl = []\nfor i in range(n - 1):\n l.append(h[i + 1] - h[i])\n\nprint(l)\nans = max(l)\nfor j in range(len(l) - (k - 2)):\n ans = min(ans,sum(l[j:j + k - 1]))\n\nprint(ans)\n', 'import sys\nimport math\n\n\n\nn,k = map(int, input().split())\nh = sorted(list(map(int, (input() for i in range(n)))))\n\nans = max(h)\n\nfor i in range(n - k + 1):\n ans = min(ans,h[i + k - 1] - h[i])\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s203290440', 's070569251'] | [14664.0, 8288.0] | [2104.0, 255.0] | [312, 235] |
p03208 | u815878613 | 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\nN, K = list(map(int, input().split()))\n\nh = np.zeros(N)\n\nfor n in range(N):\n h[n] = int(input())\n\nh = np.sort(h)\n\nm = h[N-1] - h[0]\n\nfor n in range(0,N-K+1):\n d = h[n+K-1] - h[n]\n if d < m:\n m = d\n\nprint(int(d))\n', 'import sys \nimport numpy as np\n\nN, K = list(map(int, input().split()))\n\nh = np.zeros(N)\n\nfor n in range(N):\n h[n] = int(input())\n\nh = np.sort(h)\n\nm = h[N-1] - h[0]\n\nfor n in range(0,N-K+1):\n d = h[n+K-1] - h[n]\n if d < m:\n m = d\n\nprint(int(m))\n'] | ['Wrong Answer', 'Accepted'] | ['s690554404', 's577386375'] | [14016.0, 14016.0] | [432.0, 424.0] | [260, 260] |
p03208 | u825343780 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['n, k = map(int, input().split())\nh = [int(input()) for i in range(n)]\nh.sort()\n\nans = 100000000000000000000000000000000000000\nfor i in range(n-k+1):\n ans = min(ans, h[i+k-1] - h[i])\n print(i)\nprint(ans)\n', 'n, k = map(int, input().split())\nh = [int(input()) for i in range(n)]\nh.sort()\n\nans = 100000000000000000000000000000000000000\nfor i in range(n-k+1):\n ans = min(ans, h[i+k-1] - h[i])\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s207735183', 's621052619'] | [13192.0, 13308.0] | [217.0, 185.0] | [209, 196] |
p03208 | u835283937 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['def main():\n N, K = map(int, input().split())\n H = [int(input()) for i in range(N)]\n H.sort()\n mi = 10**9\n for i in range(N - K + 1):\n h_ = H[i:i+K]\n print(h_)\n if max(h_) - min(h_) < mi:\n mi = max(h_) - min(h_)\n print(mi)\nif __name__ == "__main__":\n main()', 'def main():\n N, K = map(int, input().split())\n H = [int(input()) for i in range(N)]\n H.sort()\n mi = 10**9\n for i in range(N - K + 1):\n diff = H[i+K-1] - H[i]\n if diff < mi:\n mi = diff\n print(mi)\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s573834213', 's208900459'] | [110008.0, 7384.0] | [2104.0, 216.0] | [310, 275] |
p03208 | u840958781 | 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=[]\nsa=[]\nans=[]\nfor i in range(n):\n h=int(input())\n l.append(h)\nfor i in range(1,n):\n sa.append(l[i]-[i-1])\nsa.sort()\nsa.reverse()\nfor i in range(k-1):\n ans.append(sa[i])\nprint(min(ans))', 'n,k=map(int,input().split())\nl=[]\nsa=[]\nans=[]\nfor i in range(n):\n h=int(input())\n l.append(h)\nl.sort()\nfor i in range(1,n):\n sa.append(abs(l[i]-l[i-1]))\nsa.sort()\nfor i in range(k-1):\n ans.append(sa[i])\nprint(min(ans))', 'n,k=map(int,input().split())\nl=[]\nsa=[]\nfor i in range(n):\n h=int(input())\n l.append(h)\nl.sort()\nfor i in range(n-k+1):\n sa.append(l[i+k-1]-l[i])\nprint(min(sa))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s783403027', 's868890854', 's130340902'] | [7072.0, 11984.0, 11288.0] | [188.0, 300.0, 247.0] | [229, 231, 169] |
p03208 | u842964692 | 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(reverse=True)\nans=10**6\n\nfor i in range(N-K):\n ans=min(ans,H[i]-H[i+K-1])\n\nprint(ans) ', 'N,K=map(int,input().split())\nH=list(map(int,input().split()))\nH.sort()\nans=10**6\n\nfor i in range(N-K):\n ans=min(ans,H[i]-H[i+K])\n\nprint(ans) ', 'N,K=map(int,input().split())\nH=[int(input()) for _ in range(N)]\nH.sort()\nans=10**6\n\nfor i in range(N-K):\n ans=min(ans,H[i]-H[i+K])\n\nprint(ans) ', 'N,K=map(int,input().split())\nH=[int(input()) for _ in range(N)]\nH.sort(reverse=True)\nans=10**9\n\nfor i in range(N-K+1):\n ans=min(ans,H[i]-H[i+K-1])\n\nprint(ans) '] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s013102140', 's092607314', 's740929918', 's554860879'] | [7384.0, 3060.0, 7384.0, 7384.0] | [253.0, 17.0, 254.0, 249.0] | [163, 147, 149, 165] |
p03208 | u843981036 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ["N, K = map(int, input().split())\nh = sorted([int(input()) for i in range(N)])\n\nm = float('inf')\n\nprint(h)\nfor i in range(N-K+1):\n m = min(m, h[i+K-1] - h[i])\n print(h[i+K-1], h[i])\n\nprint(m)", "N, K = map(int, input().split())\nh = sorted([int(input()) for i in range(N)])\n\nm = float('inf')\n\nfor i in range(N-K+1):\n m = min(m, h[i+K-1] - h[i])\n\nprint(m)"] | ['Wrong Answer', 'Accepted'] | ['s047087197', 's182595992'] | [11272.0, 8280.0] | [387.0, 245.0] | [196, 161] |
p03208 | u846150137 | 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 _ in range(n):\n a+=[int(input())]\na.sort()\ns=10**9\nfor i in range(n-k):\n s=min(s,a[i]-a[i+k])\nprint(s)', 'n,k=map(int,input().split())\na=[]\nfor _ in range(n):\n a+=[int(input())]\na.sort()\ns=10**9\nm=0\nfor i in range(n):\n if i>=k:\n m+=a[i]-a[i-k]\n s=min(s,m)\n else:\n m+=a[i]\nprint(s)', 'n,k=map(int,input().split())\na=[]\nfor _ in range(n):\n a+=[int(input())]\na.sort()\ns=10**9\nfor i in range(n-k):\n s=min(s,a[i+k]-a[i])\nprint(s)', 'n,k=map(int,input().split())\na=[]\nfor _ in range(n):\n a+=[int(input())]\na.sort()\ns=10**9\nfor i in range(n-k+1):\n s=min(s,a[i+k-1]-a[i])\nprint(s)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s368984811', 's616500659', 's940500575', 's001214854'] | [7384.0, 7384.0, 7384.0, 7384.0] | [283.0, 305.0, 307.0, 288.0] | [142, 186, 142, 147] |
p03208 | u846522771 | 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=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)))', '#coding:utf-8\nn,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'] | ['s849777110', 's124008959'] | [3064.0, 7384.0] | [18.0, 218.0] | [130, 137] |
p03208 | u848654125 | 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 scipy as sp\n\nN, K = list(map(int, input().split()))\n\ntree = sp.array([], dtype = "int")\nfor i in range(N):\n tree = sp.append(tree, int(input()))\n\n#tree.sort()\n\nprint(int(min(tree[K-1:]-tree[:N-K+1])))\n', 'N, K = list(map(int, input().split()))\n\ntree = [int(input()) for i in range(N)]\n\ntree.sort()\n\nprint(min(tree[i+K-1] - tree[i] for i in range(N-K+1)))\n '] | ['Wrong Answer', 'Accepted'] | ['s257509798', 's530908534'] | [15012.0, 7384.0] | [2109.0, 222.0] | [211, 154] |
p03208 | u851704997 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['N,K = map(int,input().split())\nList = []\nfor i in range(N):\n tmp = int(input())\n List.append(tmp)\nList = sorted(List)[::-1]\nprint(str(List[K-1] - List[0]))', 'N,K = map(int,input().split())\nh = []\nans = 10**10\nfor i in range(N):\n tmp = int(input())\n h.append(tmp)\nh = sorted(h)[::-1]\nfor i in range(N-K):\n ans = min(h[i]-h[i+K-1],ans)\nprint(str(ans))', 'N,K = map(int,input().split())\nh = [0]*N\nfor i in range(N):\n h[i] = int(input())\nh = sorted(h)\nans = 10**10\nfor i in range(N-(K-1)):\n tmp = h[i+K-1] - h[i]\n ans = min(tmp,ans)\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s436176370', 's841452804', 's191265034'] | [8656.0, 14408.0, 13940.0] | [230.0, 197.0, 201.0] | [157, 200, 195] |
p03208 | u853952087 | 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,b=input().split()\nc,d=int(a),int(b)\nl=[int(input()) for i in range(c)]\nL=sorted(l)\nx=L[d]-L[0]\nfor i in range(c-d+1):\n if L[d+i]-L[i]<x:\n x=L[d+i]-L[i]\nprint(x)', 'a,b=input().split()\nc,d=int(a),int(b)\nl=[int(input()) for i in range(c)]\nL=sorted(l)\nx=L[d-1]-L[0]\nfor i in range(c-d+1):\n if L[d+i-1]-L[i]<x:\n x=L[d+i-1]-L[i]\nprint(x)'] | ['Runtime Error', 'Accepted'] | ['s952179908', 's532000079'] | [8280.0, 8280.0] | [229.0, 228.0] | [172, 178] |
p03208 | u854093727 | 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,new_tree_list = [],[]\nfor i in range(N):\n tree_list.append(int(input()))\n\ntree_list.sort(reverse=True)\n\nfor i in range(len(tree_list)-K+1):\n print(tree_list[0+i],tree_list[K+i-1])\n new_tree_list.append(tree_list[0+i]-tree_list[K+i-1])\nnew_tree_list.sort()\nprint(new_tree_list[0])\n', 'N,K = map(int,input().split())\ntree_list,new_tree_list = [],[]\nfor i in range(N):\n tree_list.append(int(input()))\n\ntree_list.sort(reverse=True)\n\nfor i in range(len(tree_list)-K+1):\n new_tree_list.append(tree_list[0+i]-tree_list[K+i-1])\nnew_tree_list.sort()\nprint(new_tree_list[0])\n'] | ['Wrong Answer', 'Accepted'] | ['s019781806', 's930867296'] | [13316.0, 11288.0] | [416.0, 281.0] | [330, 287] |
p03208 | u856775981 | 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\nh = []\nfor i in range(N):\n h.append(int(input()))\n\nh.sort()\n\nminDistance = 10 ** 9\nfor i in range(0, N - K):\n if h[i + K] - h[i] < minDistance:\n minDistance = h[i + K] - h[i]\n\nprint(minDistance)', 'N, K = list(map(int, input().split()))\n\nh = []\nfor i in range(N):\n h.append(int(input()))\n\nh.sort()\n\nminDistance = 10 ** 9\nfor i in range(0, N - K + 1):\n if h[i + K - 1] - h[i] < minDistance:\n minDistance = h[i + K - 1] - h[i]\n\nprint(minDistance)'] | ['Wrong Answer', 'Accepted'] | ['s988488225', 's081499506'] | [7508.0, 7384.0] | [239.0, 244.0] | [247, 259] |
p03208 | u857330600 | 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 v=int(input())\n l.append(v)\ntmp=l[n-1]\nfor j in range(n-k+1):\n tmp=min(tmp,l[j+k-1]-l[j])\nprint(tmp)', 'n,k=map(int,input().split())\nl=[]\nfor i in range(n):\n v=int(input())\n l.append(v)\nl.sort()\ntmp=l[n-1]\nfor j in range(n-k+1):\n tmp=min(tmp,l[j+k-1]-l[j])\nprint(tmp)'] | ['Wrong Answer', 'Accepted'] | ['s718825912', 's708434881'] | [7072.0, 7384.0] | [219.0, 261.0] | [157, 166] |
p03208 | u859897687 | 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=1000000000\nfor i in range(k,n):\n ans=min(ans,h[i]-h[i-k])\nprint(ans)', 'n,k=map(int,input().split())\nh=[int(input())for i in range(n)]\nh.sort()\nans=1000000000\nfor i in range(k,n):\n ans=min(ans,h[i]-h[i-k])\nprint(ans)', 'n,k=map(int,input().split())\nh=[int(input())for i in range(n)]\nh.sort()\nans=1000000000\nfor i in range(k-1,n):\n ans=min(ans,h[i]-h[i-k+1])\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s429867234', 's729520661', 's232636795'] | [7072.0, 7384.0, 7384.0] | [202.0, 239.0, 240.0] | [136, 145, 149] |
p03208 | u863841238 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['n,k = map(int,input().split())\nh_list = [int(input()) for _ in range(n)]\nh_list.sort(reverse=True)\ni = 0\nj = k-1\nans = 10**9\n\nwhile j < n:\n diff = h_list[j]-h_list[i]\n ans = min(ans,diff)\n i = j\n j += k-1\nprint(ans)', 'n,k = map(int,input().split())\nh_list = [int(input()) for _ in range(n)]\nh_list.sort(reverse=True)\ni = 0\nj = k-1\nans = 10**9\n\nwhile j < n:\n diff = h_list[i]-h_list[j]\n ans = min(ans,diff)\n i += 1\n j += 1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s742256935', 's754777246'] | [7488.0, 7488.0] | [246.0, 264.0] | [228, 226] |
p03208 | u865741247 | 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(" ")))\nnums = []\nfor i in range(N):\n nums.append(int(input()))\nnums.sort()\nr = 0\nl = 0\nans = []\nfor i,num in enumerate(nums[:-(K-1)]):\n r = nums[i+K-1]\n l = num\n print("l:",l,"//r:",r)\n ans.append(r-l)\nprint(min(ans))', 'N,K= list(map(int,input().split(" ")))\nnums = []\nfor i in range(N):\n nums.append(int(input()))\nnums.sort()\nr = 0\nl = 0\nans = []\nfor i,num in enumerate(nums[:-(K-1)]):\n r = nums[i+K-1]\n l = num\n # print("l:",l,"//r:",r)\n ans.append(r-l)\nprint(min(ans))'] | ['Wrong Answer', 'Accepted'] | ['s899924414', 's337447376'] | [14680.0, 12056.0] | [442.0, 253.0] | [264, 266] |
p03208 | u866769581 | 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 = [int(input()) for x in range(N)]\nlis.sort()\nprint(min(lis[i+K-1] - lis[i] for x in range(N-K+1)))', 'N,K = map(int,input().split())\nlis = [int(input()) for x in range(N)]\nlis.sort()\nprint(min(lis[i+K-1] - lis[i] for i in range(N-K+1)))'] | ['Runtime Error', 'Accepted'] | ['s060853314', 's112046439'] | [7484.0, 7384.0] | [205.0, 220.0] | [134, 134] |
p03208 | u867826040 | 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()\nl = h[-3::]\nprint(max(l)-min(l))', 'n,k = map(int,input().split())\nh = [int(input()) for i in range(n)]\nh.sort()\nl = [h[i+k-1]-h[i] for i in range(n-k+1)]\nprint(min(l))'] | ['Wrong Answer', 'Accepted'] | ['s437662497', 's972100911'] | [7384.0, 11212.0] | [211.0, 237.0] | [109, 132] |
p03208 | u868418093 | 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\ntrees = []\nfor i in range(n):\n trees.append(int(input()))\n\ntrees = sorted(trees,reverse=True)\nprint(trees)\naverage = sum(trees)/len(trees)\nmin_dist = 1e+10\nif abs(max(trees) - average) > abs(min(trees) - average):\n for i in range(n)[k-1:]:\n print(i)\n if min_dist > abs(trees[i] - trees[i-k+1]):\n\n min_dist = abs(trees[i] - trees[i-k+1])\nelse:\n for i in range(n-k+1):\n if min_dist > abs(trees[i+k-1] - trees[i]):\n min_dist = abs(trees[i+k-1] - trees[i])\nprint(min_dist)\n', 'n,k = map(int,input().split(" "))\n\ntrees = []\nfor i in range(n):\n trees.append(int(input()))\n\ntrees = sorted(trees,reverse=True)\naverage = sum(trees)/len(trees)\nmin_dist = 1e+10\nif abs(max(trees) - average) > abs(min(trees) - average):\n for i in range(n)[k-1:]:\n if min_dist > abs(trees[i] - trees[i-k+1]):\n\n min_dist = abs(trees[i] - trees[i-k+1])\nelse:\n for i in range(n-k+1):\n if min_dist > abs(trees[i+k-1] - trees[i]):\n min_dist = abs(trees[i+k-1] - trees[i])\nprint(min_dist)\n'] | ['Wrong Answer', 'Accepted'] | ['s265422652', 's255119110'] | [11276.0, 8288.0] | [325.0, 251.0] | [556, 526] |
p03208 | u874885251 | 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())\ntreelist = []\ndifflist = []\nappend = treelist.append\n#print(treelist)\nappend_diff = difflist.append\nfor i in range(N):\n tree = int(input())\n #print(tree)\n append(tree)\ntreelist.sort()\nprint(treelist)\nfor i in range(K-1,N):\n diff = treelist[i] - treelist[i-K+1]\n #print(diff)\n append_diff(diff)\nprint(min(difflist))', 'N,K = map(int,input().split())\ntreelist = []\ndifflist = []\nappend = treelist.append\n#print(treelist)\nappend_diff = difflist.append\nfor i in range(N):\n tree = int(input())\n #print(tree)\n append(tree)\ntreelist.sort()\n#print(treelist)\nfor i in range(K-1,N):\n diff = treelist[i] - treelist[i-K+1]\n #print(diff)\n append_diff(diff)\nprint(min(difflist))'] | ['Wrong Answer', 'Accepted'] | ['s984244524', 's648077711'] | [11976.0, 11288.0] | [263.0, 246.0] | [363, 364] |
p03208 | u875291233 | 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 = [int(inoput()) for _ in range(n)]\nh.sort()\n\nans = 10**9\nfor i,j in zip(h,h[k-1:]):\n ans = min(ans,j-i)\nprint(ans)', 'n,k = [int(i) for i in input().split()]\nh = [int(input()) for _ in range(n)]\nh.sort()\n\nans = 10**9\nfor i,j in zip(h,h[k-1:]):\n ans = min(ans,j-i)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s348462544', 's090864548'] | [3060.0, 7860.0] | [17.0, 244.0] | [158, 157] |
p03208 | u877415670 | 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 = [int(input()) for i in range(N)]\n \nh.sort()\n \nans=[]\n \nfor i in range(N):\n\tif i+K==N+1:\n\t\tbreak\n\telse:\n\t\tans.append(h[i+K-1] - h[i])\nprint(ans)\nprint(min(ans))', 'N,K = (int(i) for i in input().split()) \nh = [int(input()) for i in range(N)]\n \nh.sort()\n \nans=[]\n \nfor i in range(N):\n\tif i+K==N+1:\n\t\tbreak\n\telse:\n\t\tans.append(h[i+K-1] - h[i])\nprint(min(ans))'] | ['Wrong Answer', 'Accepted'] | ['s189056968', 's451050324'] | [13152.0, 11244.0] | [254.0, 247.0] | [205, 194] |
p03208 | u883792993 | 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 = int(input())\nh = list(map(int,input().split()))\nh.append(0)\n\ncount=0\nwhile 1:\n flag = 0\n for i in range(N):\n if h[i]>0:\n h[i] -= 1\n flag = 1\n if h[i+1] == 0:\n count += 1\n else:\n pass\n if flag == 0:\n break\nprint(count)', 'N = int(input())\nh = list(map(int,input().split()))\nh.append(0)\n\ncount=0\nwhile 1:\n\tflag=0\n for i in range(N):\n \tif h[i]>0:\n \th[i] -= 1\n \t flag = 1\n if h[i+1] == 0:\n \tcount += 1\n else:\n \tpass\n if flag == 0:\n \tbreak\nprint(count)', 'N = int(input())\nh = list(map(int,input().split()))\nh.append(0)\n\ncount=0\nwhile 1:\n flag=0\n for i in range(N):\n if h[i]>0:\n h[i] -= 1\n flag = 1\n if h[i+1] == 0:\n count += 1\n else:\n pass\n if flag == 0:\n break\nprint(count)', 'N,K=list(map(int,input().split()))\nh=[]\nfor i in range(N):\n h.append(int(input()))\nh.sort()\n\nminimum=1000000000\nfor j in range(N-K+1):\n minimum=min(minimum, h[j+K-1]-h[j])\nprint(minimum)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s371618214', 's685894267', 's894601912', 's827653102'] | [3060.0, 2940.0, 3060.0, 7384.0] | [17.0, 17.0, 17.0, 259.0] | [264, 281, 262, 188] |
p03208 | u887207211 | 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))\n\nans = 1e9+7\nfor i in range(N-K+1):\n ans = min(ans, h[i+K]-h[i])\nprint(ans)', 'N, K = map(int,input().split())\nh = sorted(int(input()) for _ in range(N))\n\nans = 1e9+7\nfor i in range(N-K+1):\n ans = min(ans, h[i+K-1]-h[i])\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s011732556', 's746167657'] | [7476.0, 7396.0] | [247.0, 257.0] | [151, 153] |
p03208 | u896741788 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['n,k=map(int,input().split())\nl=sorted(list(map(int,input().split())))\nret=float("inf")\nprint(min([abs(l[i]-l[i+k]) for i in range(n-k)]))', 'n,k=map(int,input().split())\nl=sorted([int(input()) for i in range(n)])\nprint(min([abs(l[i]-l[i+k]) for i in range(n-k)]))', 'n,k=map(int,input().split())\nl=sorted([int(input()) for i in range(n)])\nprint(min([abs(l[i]-l[i+k-1]) for i in range(n-k+1)]))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s362591453', 's940088501', 's590872498'] | [3060.0, 10864.0, 10872.0] | [17.0, 242.0, 257.0] | [137, 122, 126] |
p03208 | u909601929 | 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\nimport numpy as np\nimport sys\n\nN, K = [int(x) for x in stdin.readline().rstrip().split()]\nh = np.array(map(int, [stdin.readline().rstrip() for _ in range(N)]))\n\nhs = h.sort()\nhmin = sys.maxint\n\nfor i in range(0, N-K):\n hdiff = hs[i+K] - hs[i]\n if hdiff < hmin:\n hmin = hdiff\n\nprint(hmin)\n\n', 'from sys import stdin\nimport numpy as np\nimport sys\n\nN, K = [int(x) for x in stdin.readline().rstrip().split()]\nh = np.array(list(map(int, [stdin.readline().rstrip() for _ in range(N)])))\n\nh.sort()\nhmin = 2**30\n\nfor i in range(0, N-K+1):\n hdiff = h[i+K-1] - h[i]\n if hdiff < hmin:\n hmin = hdiff\n\nprint(hmin)\n\n'] | ['Runtime Error', 'Accepted'] | ['s735339878', 's446819349'] | [21284.0, 23408.0] | [317.0, 285.0] | [324, 322] |
p03208 | u911575040 | 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=10**9\nfor i in range(n-k+1):\n ans=min(ans,max(h[i:i+k])-min(h[i:i+k]))\nprint(ans)', 'n,k=map(int,input().split())\nh = [int(input()) for i in range(n)]\nh.sort()\nans=10**9\nfor i in range(n-k+1):\n ans=min(ans,h[i+k-1]-h[i])\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s639900119', 's188630790'] | [3060.0, 7384.0] | [17.0, 247.0] | [163, 149] |
p03208 | u916806287 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['N, K = map(int, input().split())\nh = sorted([int(input()) for i in range(N)])\nprint(min([h[i+K] - h[i] for i in range(N-K+1)]))', 'N, K = map(int, input().split())\nh = sorted([int(input()) for i in range(N)])\nprint(min([h[i+K-1] - h[i] for i in range(N-K+1)]))'] | ['Runtime Error', 'Accepted'] | ['s987545264', 's501511817'] | [10864.0, 10872.0] | [234.0, 233.0] | [127, 129] |
p03208 | u918935103 | 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 hi = int(input())\n h.append(hi)\nh.sort()\nl = []\nfor i in range(n-k+1):\n l.append(h[i+k-1] - h[i])\nprint(max(l))', 'n,k = map(int,input().split())\nh = []\nfor i in range(n):\n hi = int(input())\n h.append(hi)\nh.sort()\nl = []\nfor i in range(n-k+1):\n l.append(h[i+k-1] - h[i])\nprint(min(l))'] | ['Wrong Answer', 'Accepted'] | ['s906926365', 's610061814'] | [11288.0, 11288.0] | [246.0, 246.0] | [172, 172] |
p03208 | u920204936 | 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 = sorted([int(input()) for i in range(N)])\nprint(H)\nans = H[K - 1] - H[0]\nfor i in range(N - K + 1):\n t = H[K + i - 1] - H[i]\n if ans > t:\n ans = t\nprint(ans)', 'N,K = [int(i) for i in input().split()]\nH = sorted([int(input()) for i in range(N)])\nans = H[K - 1] - H[0]\nfor i in range(N - K + 1):\n t = H[K + i - 1] - H[i]\n if ans > t:\n ans = t\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s929350899', 's042197193'] | [11368.0, 8200.0] | [257.0, 238.0] | [213, 204] |
p03208 | u930862022 | 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 = [int(input()) for i in range(n)]\nh.sort()\n\ncand = [0]*(n-k+1)\ncand[0] = h[k-1] - h[0]\n\n\nfor j in range(1,n-k+1):\n cand[i] = cand[i-1] + h[k+i-1] - h[i]\n\nprint(min(cand))', 'n, k = map(int, input().split())\n\nh = [int(input()) for i in range(n)]\nh.sort()\n\ncand = [0]*(n-k+1)\ncand[0] = h[k-1] - h[0]\n\n\nfor j in range(1,n-k+1):\n cand[j] = h[k+j-1] - h[j]\n\nprint(min(cand))'] | ['Runtime Error', 'Accepted'] | ['s920842910', 's276460141'] | [7860.0, 11036.0] | [204.0, 237.0] | [210, 198] |
p03208 | u932716679 | 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()\nh_max = 0\nh_min = 0\nr = 0\nans = []\n#print(h)\nfor i in range(r,n-k+1):\n if n - r < k: \n break\n h_max = h[r+k]\n #print(h[r:k])\n h_min = h[r])\n ans.append(h_max - h_min)\n r += 1\nprint(min(ans))\n', 'Cn,k = map(int,input().split())\nh = []\nfor i in range(n):\n h.append(int(input()))\nh.sort()\nh_max = 0\nh_min = 0\nr = 0\nans = []\n#print(h)\nfor i in range(r,n):\n h_max = max(h[r:k+r])\n #print(h[r:k])\n h_min = min(h[r:k+r])\n if n -r < k: \n break\n ans.append(h_max - h_min)\n r += 1\nprint(min(ans))\n', 'n,k = map(int,input().split())\nh = []\nfor i in range(n):\n h.append(int(input()))\nh.sort()\nh_max = 0\nh_min = 0\nr = 0\nans = []\n#print(h)\nfor i in range(r,n-k+1):\n if n - r < k: \n break\n h_max = h[r+k-1]\n #print(h[r:k])\n h_min = h[r]\n ans.append(h_max - h_min)\n r += 1\nprint(min(ans))\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s302446634', 's996611866', 's679845524'] | [2940.0, 3064.0, 11292.0] | [17.0, 17.0, 279.0] | [309, 320, 310] |
p03208 | u933214067 | 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 statistics import mean, median,variance,stdev\nimport sys\nimport math\n\nx = input().split()\n#y = input().split()\n\n\n#y = int(input())\n#x = int(input())\na = []\nn = int(x[0])\nk = int(x[1])\nfor i in range(k):\n a.append(int(input()))\na = sorted(a)\np = []\nfor i in range(n-k-1):\n p.append(a[i+k-1]-a[i])\nprint(min(p))', 'from statistics import mean, median,variance,stdev\nimport sys\nimport math\n\nx = input().split()\n#y = input().split()\n\n\n#y = int(input())\n#x = int(input())\na = []\nb = int(x[0])\nnum = int(x[1])\nfor i in range(b):\n a.append(int(input()))\na = sorted(a)\nmin = a[num-1]-a[0]\nfor i in range(num,b):\n if min > a[i]-a[i-num+1]:\n min = a[i]-a[i-num+1]\nif min > a[b-1]-a[b-num]:\n min = a[b-1]-a[b-num]\nprint(min)\n'] | ['Runtime Error', 'Accepted'] | ['s259599607', 's154448709'] | [9932.0, 10404.0] | [208.0, 268.0] | [320, 417] |
p03208 | u933341648 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['5 3\n5\n7\n5\n7\n7', 'n, k = map(int, input().split())\nh = sorted([int(input()) for i in range(n)])\n\nres = h[k-1] - h[0]\nfor i in range(k, n):\n tmp = h[i] - h[i-k+1]\n res = min(res, tmp)\n\nprint(res)'] | ['Runtime Error', 'Accepted'] | ['s822911569', 's141912362'] | [2940.0, 8280.0] | [17.0, 246.0] | [13, 182] |
p03208 | u934868410 | 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 = [int(input()) for i in range(n)].sort()\nans = 1000000000\nfor i in range(n-k+1):\n ans = min(ans, h[i+k-1]-h[i])\nprint(ans)', 'n,k = map(int,input())\nh = [int(input()) for i in range(n)].sort()\nans = 1000000000\nfor i in range(n-k):\n ans = min(ans, h[i+k-1]-h[i])\nprint(ans)', 'n,k = map(int,input())\nh = [int(input()) for i in range(n)].sort()\nans = 1000000000\nfor i in range(n-k):\n ans = min(ans, h[i+k]-h[i])\nprint(ans)', 'n,k = map(int,input().split())\nh = sorted([int(input()) for i in range(n)])\nans = 1000000000\nfor i in range(n-k+1):\n ans = min(ans, h[i+k-1]-h[i])\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s368437278', 's370760397', 's623190622', 's386120446'] | [3060.0, 3060.0, 3316.0, 8280.0] | [17.0, 17.0, 19.0, 237.0] | [149, 147, 145, 158] |
p03208 | u937529125 | 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}? | ["#115-C\nn,k = (int(i) for i in input().split())\nt = [int(input()) for i in range(n)] \n#t = [10,15,11,14,12]\nt = sorted(t)\nmin = float('inf')\nfor i in range(n-k):\n s = t[i+k-1]-t[i]\n if s < min:\n\nprint(min)\n#print(t)", "n,k = (int(i) for i in input().split())\nt = [int(input()) for i in range(n)] \nt = [10,15,11,14,12]\nt = sorted(t)\nmin = float('inf')\nfor i in range(n-k):\n s = t[i+k-1]-t[i]\n if s < min:\n\nprint(min)\n#print(t)\n ", '#115-C\nn,k = (int(i) for i in input().split())\nt = [int(input()) for i in range(n)] \n#t = [10,15,11,14,12]\nt = sorted(t)\nmin = t[k-1]-t[0]\nfor i in range(n-k+1):\n s = t[i+k-1]-t[i]\n if s < min:\n min = s\n\nprint(min)\n#print(t)\n '] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s597631967', 's819375712', 's348254057'] | [2940.0, 3060.0, 8280.0] | [18.0, 18.0, 235.0] | [220, 217, 242] |
p03208 | u939702463 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['n, k = map(int, input().split())\nh = [int(input()) for i in range(n)]\n\nh.sort()\nans = max(h)\nfor i in range(n-k+1):\n ans = min(ans, h[i] - h[i+k-1])\nprint(ans)', 'n, k = map(int, input().split())\nh = [int(input()) for i in range(n)]\n\nh.sort()\nans = 10 ** 9\nfor i in range(n-k+1):\n ans = min(ans, h[i+k-1] - h[i])\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s473121457', 's192808728'] | [7384.0, 7384.0] | [237.0, 244.0] | [160, 161] |
p03208 | u942190778 | 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# coding: utf-8\n\n# In[33]:\n\n\n\n\n\n# In[35]:\n\n\nN,K=map(int,input().split(" "))\n\n\n# In[36]:\n\n\np=[]\nfor i in range(N):\n p.append(int(input()))\n\n\n# In[44]:\n\n\nmin_val=abs(p[0]-p[1])\nfor i in range(N):\n for j in range(N):\n if i!=j:\n if abs(p[i]-p[j])<min_val:\n min_val=abs(p[i]-p[j])\nprint(min_val)\n\n', '\n# coding: utf-8\n\n# In[33]:\n\n\n\n\n\n# In[45]:\n\n\nN,K=map(int,input().split(" "))\n\n\n# In[46]:\n\n\np=[]\nfor i in range(N):\n p.append(int(input()))\n\n\n# In[49]:\n\n\np.sort()\n\n\n# In[56]:\n\n\nprint(min(p[i+K-1]-p[i] for i in range(N-K+1)))\n\n'] | ['Wrong Answer', 'Accepted'] | ['s030554781', 's079376514'] | [7072.0, 7388.0] | [2104.0, 245.0] | [1343, 1239] |
p03208 | u943057856 | 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)])\na=10**9\nfor i in range(n-k+1):\n a1=h1[i+k-1]-h[i]\n a=min(a,a1)\nprint(a)', 'n,k=map(int,input().split())\nh=sorted([int(input()) for _ in range(n)])\na=10**9\nfor i in range(n-k+1):\n a1=h[i+k-1]-h[i]\n a=min(a,a1)\nprint(a)'] | ['Runtime Error', 'Accepted'] | ['s295701982', 's745325013'] | [8280.0, 8280.0] | [235.0, 248.0] | [149, 148] |
p03208 | u944643608 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['N, K = map(int, input().split())\nh = list(int(input()) for _ in range(N))\nfin = h[K-1] - h[0]\nfor i in range(1, N-K+1):\n t = h[i+K-1] - h[i]\n if fin > t :\n fin = t\nprint(fin)\n', 'N, K = map(int, input().split())\nh = [(int(input()) for _ in range(N)]\nfin = h[K-1] - h[0]\nfor i in range(1, N-K+1):\n t = h[i+K-1] - h[i]\n if fin > t :\n fin = t\nprint(fin)\n', 'N, K = map(int, input().split())\nh = [(int(input()) for _ in range(N))]\nfin = h[K-1] - h[0]\nfor i in range(1, N-K+1):\n t = h[i+K-1] - h[i]\n if fin > t :\n fin = t\nprint(fin)\n', 'N, K = map(int, input().split())\nh = [list(int(input()) for _ in range(N))]\nfin = h[K-1] - h[0]\nfor i in range(1, N-K+1):\n t = h[i+K-1] - h[i]\n if fin > t :\n fin = t\nprint(fin)', 'N, K = map(int, input().split())\nh = [(int(input()) for _ in range(N)]\nfin = h[K-1] - h[0]\nfor i in range(1, N-K+1):\n t = h[i+K-1] - h[i]\n if fin > t :\n fin = t\nprint(fin)\n', 'N, K = map(int, input().split())\nh = sorted(list(int(input()) for _ in range(N)))\nfin = h[K-1] - h[0]\nfor i in range(1, N-K+1):\n t = h[i+K-1] - h[i]\n if fin > t :\n fin = t\nprint(fin)\n'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s162980509', 's559588031', 's877879729', 's962756970', 's997102224', 's378444405'] | [7084.0, 2940.0, 3060.0, 7084.0, 2940.0, 8292.0] | [201.0, 17.0, 17.0, 186.0, 18.0, 245.0] | [180, 177, 178, 181, 177, 188] |
p03208 | u961916328 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['n,k = map(int,input().split())\nlist = []\nfor i in range(n):\n list.append(int(input()))\nlist.sort()\nmin = 10^9\nfor j in range(n-k+1):\n if list[j+k-1]-list[j] < min:\n min = list[j+k]-list[j]\nprint(min)\n', 'n,k = map(int,input().split())\nlist = []\nfor i in range(n):\n list.append(int(input()))\nlist.sort()\nmin = 10^9\nfor j in range(n-k+1):\n if list[j+k-1]-list[j] < min:\n min = list[j+k]-list[j]\nprint(min)\n', 'n,k = map(int,input().split())\nlist = []\nfor i in range(n):\n list.append(int(input()))\nlist.sort()\nmin = list[n-1]\nfor j in range(n-k+1):\n if list[j+k-1]-list[j] < min:\n min = list[j+k-1]-list[j]\nprint(min)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s605663497', 's893816940', 's097007512'] | [7444.0, 7384.0, 7384.0] | [236.0, 239.0, 238.0] | [205, 205, 211] |
p03208 | u963903527 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['N, K = map(int, input().split())\nH = sorted([int(input()) for _ in range(N)])\nprint(min(H[i+K-1]-H[i]) for i in range(N-K+1))\n', 'N, K = map(int, input().split())\nH = sorted([int(input()) for _ in range(N)])\nprint(min(H[i+K-1]-H[i] for i in range(N-K+1)))\n'] | ['Wrong Answer', 'Accepted'] | ['s371585794', 's575886214'] | [8280.0, 8280.0] | [210.0, 235.0] | [126, 126] |
p03208 | u965436898 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['n,k = map(int,input().split())\nH = sorted([int(input()) for _ in range(n)])\nans = float("INF")\nfor i in range(0,n - k + 1):\n print(i)\n selected = H[i:k + i]\n ans = min(ans,max(selected) - min(selected))\nprint(ans)', 'n,k = map(int,input().split())\nH = sorted([int(input()) for _ in range(n)])\nans = float("INF")\nfor i in range(n - k + 1):\n diff = H[k + i -1] - H[i]\n ans = min(ans,diff)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s814707945', 's531343874'] | [8868.0, 8280.0] | [2104.0, 245.0] | [216, 182] |
p03208 | u969850098 | 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())\nheights = sorted([int(input() for _ in range(N)])\nans = float('inf')\nfor i in range(N - K + 1):\n if abs(heights[i] - heights[i + K - 1]) < ans:\n ans = abs(heights[i] - heights[i + K - 1])\nprint(ans)", "import sys\nreadline = sys.stdin.readline\n\ndef main():\n N, K = map(int, readline().rstrip().split())\n H = [int(readline()) for _ in range(N)]\n H.sort()\n ans = 10 ** 10\n for i in range(N-K+1):\n ans = min(ans, H[i+K-1]-H[i])\n\n print(ans)\n\nif __name__ == '__main__':\n main()"] | ['Runtime Error', 'Accepted'] | ['s514143232', 's042304777'] | [2940.0, 7384.0] | [17.0, 111.0] | [279, 298] |
p03208 | u970937288 | 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}? | ['m = input()\nn = int(m.split()[0])\nk = int(m.split()[1])\nt = []\nfor i in range(n):\n t.append(int(input()))\nt.sort()\na = None\nfor i in range(len(t)-k+1):\n w = abs(-1*t[i] + t[i+k])\n if i == 0:\n a = w\n elif a > w:\n a = w\nprint(a)', 'm = input()\nn = int(m.split()[0])\nk = int(m.split()[1])\nt = []\nfor i in range(n):\n t.append(int(input()))\nt.sort()\na = None\nfor i in range(len(t)-k+1):\n w = abs(-1*t[i] + t[i+k-1])\n if i == 0:\n a = w\n elif a > w:\n a = w\nprint(a)'] | ['Runtime Error', 'Accepted'] | ['s237925437', 's156553134'] | [7444.0, 7440.0] | [252.0, 254.0] | [252, 254] |
p03208 | u972398652 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['import numpy as np\nN, K = map(int, input().split())\nh = []\n\nfor _ in range(N):\n h.append(int(input()))\n\nh_sorted = sorted(h, reverse=False)\ndiff_h_sorted = np.diff(h_sorted, n=1, axis=-1)\n\ndef min_sum(N, a):\n dp = [0]*(N+1)\n for i in range(N):\n dp[i+i] = min(dp[i], dp[i]+a[i])\n return dp[N]\n\nprint(min_sum(K-1,diff_h_sorted))', 'N, K = map(int, input().split())\n\nh = []\nfor _ in range(N):\n h.append(int(input()))\nh.sort()\nprint(min(h[i+K-1] - h[i] for i in range(N-K+1)))'] | ['Runtime Error', 'Accepted'] | ['s484885509', 's481883235'] | [21288.0, 7384.0] | [444.0, 234.0] | [345, 182] |
p03208 | u974935538 | 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\ntree = []\nfor _ in range(n):\n tree.append(int(input()))\n\ntree.sort()\nans = 10**9\nfor i in range(N-K+1):\n ans = min(ans, tree[i+K-1]-tree[i])\nprint(ans)\n', 'N, K = map(int, input().split())\n\ntree = []\nfor _ in range(N):\n tree.append(int(input()))\n\ntree.sort()\nans = 10**9\nfor i in range(N-K+1):\n ans = min(ans, tree[i+K-1]-tree[i])\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s534411062', 's179921305'] | [3060.0, 7440.0] | [17.0, 254.0] | [192, 192] |
p03208 | u977642052 | 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: int, k: int, h: list):\n h.sort()\n\n print(min([h[i + k - 1] - h[i] for i in range(n - k + 1)]))\n\n\nif __name__ == "__main__":\n n, k = map(int, input().split())\n h = [input() for _ in range(n)]\n\n main(n, k, h)\n', 'def main(n: int, k: int, h: list):\n h.sort()\n\n print(min([h[i + k - 1] - h[i] for i in range(n - k + 1)]))\n\n\nif __name__ == "__main__":\n n, k = map(int, input().split())\n h = [int(input()) for _ in range(n)]\n\n main(n, k, h)\n'] | ['Runtime Error', 'Accepted'] | ['s200032587', 's730501396'] | [10584.0, 11292.0] | [203.0, 218.0] | [234, 239] |
p03208 | u977646790 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['N, K = (int(x) for x in input().split())\nh = [int(input()) for i in range(K)]\nh.sort()\nprint(min(h[i+K-1] - h[i]) for i in range(N-K+1))', 'N, K = (int(x) for x in input().split())\nh = [int(input()) for i in range(K)]\nh.sort()\nprint(min(h[i+K-1] - h[i] for i in range(N-K+1)))', 'N, K = (int(x) for x in input().split())\nh = [int(input()) for i in range(N)]\nh.sort()\nprint(min(h[i+K-1] - h[i] for i in range(N-K+1)))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s099989475', 's570141689', 's317509221'] | [7072.0, 7072.0, 7388.0] | [177.0, 169.0, 221.0] | [136, 136, 136] |
p03208 | u979823197 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['N,K=map(int,input().split())\nH=[]\nfor i in range(N):\n H.append(int(input()))\nH.sort()\nans=H[K-1]-H[0]\nfor i in range(N-K+1):\n if H[K+i]-H[i]>0:\n ans=ans+H[K+i]-H[i]\nprint(ans)', 'N,K=map(int,input().split())\nH=[]\nfor i in range(N):\n H.append(int(input()))\nH.sort()\nprint(min(H[i+K-1]-H[i] for i in range(N-K+1)))'] | ['Runtime Error', 'Accepted'] | ['s552174122', 's271071341'] | [7384.0, 7488.0] | [259.0, 234.0] | [180, 134] |
p03208 | u983181637 | 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 [0]*N]\n\nh = sorted(h)\nans = []\n\nfor i in range(len(h)-K+1):\n ans.append(h[i] - h[i+K-1])\n if ans[-1] == 0:\n print(0)\n exit()\n\nprint(min(ans))', 'N, K = map(int, input().split())\nh = [int(input()) for _ in [0]*N]\n\nh = sorted(h)\nans = []\n\nfor i in range(len(h)-K+1):\n ans.append(h[i+K-1]-h[i])\n if ans[-1] == 0:\n print(0)\n exit()\n\nprint(min(ans))'] | ['Wrong Answer', 'Accepted'] | ['s710780349', 's384853889'] | [10948.0, 10828.0] | [238.0, 231.0] | [209, 207] |
p03208 | u984276646 | 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()]\nS = []\nA.sort()\nfor i in range(N - K + 1):\n S.append(A[i+K-1] - A[i])\nprint(min(S))', 'N, K = map(int, input().split())\nA = [int(input()) for i in range(N)]\nS = []\nA.sort()\nfor i in range(N - K + 1):\n S.append(A[i+K-1] - A[i])\nprint(min(S))'] | ['Runtime Error', 'Accepted'] | ['s240635204', 's580431901'] | [3060.0, 11288.0] | [18.0, 232.0] | [153, 154] |
p03208 | u985170143 | 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 christmasEve():\n N, K = map(int, input().split())\n h = [int(input()) for i in range(N)]\n strees = sorted(h)\n d = sorted([ y -x for x ,y in zip(strees, strees[1:])])\n print(sum([i for i in d[1:N]]))\n\nif __name__ == "__main__":\n christmasEve()', 'def christmasEve():\n N, K = map(int, input().split())\n h = [int(input()) for i in range(N)]\n strees = sorted(h)\n result=10**9\n for i in range(len(strees)):\n result = min(result, strees[i+K-1] - strees[i])\n print(result)\n\nif __name__ == "__main__":\n christmasEve()', 'def christmasEve():\n N, K = map(int, input().split())\n h = [int(input()) for i in range(N)]\n strees = sorted(h)\n d = sorted([y-x for x,y in zip(strees, strees[1:])])\n print(sum([i for i in d[:K]]))\n \nif __name__ == "__main__":\n christmasEve()', 'def christmasEve2():\n N, K = map(int, input().split())\n strees = sorted([int(input()) for _ in range(N)])\n print(min(sorted([y - x for x, y in zip(strees, strees[K-1:])])))\n\n\nif __name__ == "__main__":\n christmasEve2()'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s070651935', 's210907348', 's644154625', 's872214793'] | [13228.0, 8280.0, 12864.0, 12476.0] | [263.0, 236.0, 258.0, 248.0] | [263, 291, 260, 230] |
p03208 | u992541367 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['N,K = map(int,input().split(" "))\n\n\nH = sorted([int(input()) for i in range(N)],reverse=True)\n\n\n#print(H)\n\nL = []\n\nfor k in range(N-K+1):\n #print(k,k+1,k+2)\n \n L.append(H[k]-H[k+K])\n\nprint(min(L))\n', 'N,K = map(int,input().split(" "))\n\n\nH = sorted([int(input()) for i in range(N)],reverse=True)\n\n\n#print(H)\n\nL = []\n\nfor k in range(N-K+1):\n \n \n L.append(H[k]-H[k+K-1])\n\nprint(min(L))\n'] | ['Runtime Error', 'Accepted'] | ['s111969385', 's527039123'] | [10940.0, 10892.0] | [232.0, 233.0] | [206, 212] |
p03208 | u993642190 | 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)\n\ntrees = []\nfor i in range(N) :\n\ttrees.append(int(input()))\n\ntrees.sort()\nmin_diff = 999999\nfor i in range(N-K+1) :\n\tarr = trees[i:i+K]\n\tmax_v = max(arr)\n\tmin_v = min(arr)\n\tdiff = max_v - min_v\n\tif (min_diff > diff) :\n\t\tmin_diff = diff\n\tif (min_diff = 0) :\n\t\tbreak\n\n\nprint(min_diff)', 'N,K = input().split()\nN = int(N)\nK = int(K)\n\ntrees = []\nfor i in range(N) :\n\ttrees.append(int(input()))\n\ntrees.sort()\nmin_diff = 99999999999\na,b,c = trees[0:K]\nfor i in range(N-K+1) :\n\tmax_v = c\n\tmin_v = a\n\tdiff = max_v - min_v\n\tif (min_diff > diff) :\n\t\tmin_diff = diff\n\tif (min_diff == 0) :\n\t\tbreak\n\n\ta,b,c = b,c,trees[i+K]\n\n\nprint(min_diff)', 'N,K = input().split()\nN = int(N)\nK = int(K)\n\ntrees = []\nfor i in range(N) :\n\ttrees.append(int(input()))\n\ntrees.sort()\nmin_diff = 99999999999\nfor i in range(N-K+1) :\n\tmax_v = trees[i+K-1]\n\tmin_v = trees[i]\n\tdiff = max_v - min_v\n\tif (min_diff > diff) :\n\t\tmin_diff = diff\n\tif (min_diff == 0) :\n\t\tbreak\n\n\n\nprint(min_diff)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s416864417', 's620240394', 's410143805'] | [2940.0, 7836.0, 7388.0] | [17.0, 225.0, 255.0] | [326, 342, 317] |
p03208 | u995062424 | 2,000 | 1,048,576 | In some other world, today is Christmas Eve. There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters. He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible. More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}? | ['def main():\n N, K = map(int, input().split())\n h = [0]*N\n for i in range(N):\n h[i] = int(input())\n hh = sorted(h)\n\n ans = 10**10\n for i in range(1, N-K+1):\n ans = min(ans, max(hh[i:i+K])-min(hh[i:i+K]))\n print(ans)\n \nmain()', 'def main():\n N, K = map(int, input().split())\n h = [0]*N\n for i in range(N):\n h[i] = int(input())\n hh = sorted(h)\n\n for i in range(1, N-K+1):\n ans = min(ans, max(hh[i:i+K])-min(hh[i:i+K]))\n print(ans)\n \nmain()', 'def main():\n N, K = map(int, input().split())\n h = [0]*N\n for i in range(N):\n h[i] = int(input())\n h.sort()\n \n ans = 10**10\n for i in range(N-K+1):\n ans = min(ans, h[i+K-1]-h[i])\n print(ans)\nmain()'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s361500136', 's805663972', 's065649313'] | [8564.0, 8240.0, 7472.0] | [2104.0, 218.0, 231.0] | [261, 244, 235] |
p03208 | u996276765 | 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())\nprint(N, K)\nt = [int(input()) for i in range(N)]\nt.sort()\n\nprint(min(t[j+K-1] - t[j] for j in range(N-K+1)))\n', 'N, K = map(int, input().split())\nprint(N, K)\nt = [int(input()) for i in range(N)]\nt.sort(reverse = True)\n\nl = []\n\nfor j in range(N-K+1):\n l.append(t[j] - t[j+K-1])\nprint(min(l))\n', 'N, K = map(int, input().split())\n\nt = [int(input()) for i in range(N)]\nt.sort(reverse = True)\ndifference = t[0] - t[K-1]\nprint(difference)', 'N, K = map(int, input().split())\nt = [int(input()) for i in range(N)]\nt.sort()\nl = []\n\nfor j in range(N-K+1):\n l.append(t[j+K-1] - t[j])\n\nprint(min(l))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s210463657', 's380021725', 's701130119', 's903173123'] | [7440.0, 11292.0, 7384.0, 11288.0] | [222.0, 245.0, 214.0, 246.0] | [142, 181, 138, 154] |
p03209 | u007808656 | 2,000 | 1,048,576 | In some other world, today is Christmas. Mr. Takaha decides to make a multi-dimensional burger in his party. A _level- L burger_ (L is an integer greater than or equal to 0) is the following thing: * A level-0 burger is a patty. * A level-L burger (L \geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom. For example, a level-1 burger and a level-2 burger look like `BPPPB` and `BBPPPBPBPPPBB` (rotated 90 degrees), where `B` and `P` stands for a bun and a patty. The burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat? | ['lens=[1 for _ in range(51)]\nnump=[1 for _ in range(51)]\nfor i in range(50):\n lens[i+1]=2*lens[i]+3\n nump[i+1]=2*nump[i]+1\ndef level(n):\n return max(lvl for lvl,ln in enumerate(lens) if ln<=n)\n\ndef calc():\n table={}\n def _calc(l,x):\n print(l,x)\n if x==0:\n return 0\n if (l,x) in table:\n return table[(l,x)]\n if x==lens[l]:\n res=nump[l]\n elif x<=lens[l-1]:\n res=_calc(l-1,x-1)\n elif x==lens[l-1]+1:\n res=nump[l-1]\n elif x==lens[l-1]+2:\n res=nump[l-1]+1\n else:\n res=nump[l-1]+1+_calc(l-1,x-lens[l-1]-2)\n table[(l,x)]=res\n return res\n return _calc\nwhole=calc()\nprint(whole(*map(int,input().split())))', 'lens=[1 for _ in range(51)]\nnump=[1 for _ in range(51)]\nfor i in range(50):\n lens[i+1]=2*lens[i]+3\n nump[i+1]=2*nump[i]+1\ndef level(n):\n return max(lvl for lvl,ln in enumerate(lens) if ln<=n)\n\ndef calc():\n table={}\n def _calc(l,x):\n if x==0:\n return 0\n if (l,x) in table:\n return table[(l,x)]\n if x==lens[l]:\n res=nump[l]\n elif x<=lens[l-1]:\n res=_calc(l-1,x-1)\n elif x==lens[l-1]+1:\n res=nump[l-1]\n elif x==lens[l-1]+2:\n res=nump[l-1]+1\n else:\n res=nump[l-1]+1+_calc(l-1,x-lens[l-1]-2)\n table[(l,x)]=res\n return res\n return _calc\nwhole=calc()\nprint(whole(*map(int,input().split())))'] | ['Wrong Answer', 'Accepted'] | ['s615942002', 's479186240'] | [3064.0, 3064.0] | [17.0, 17.0] | [760, 741] |
p03209 | u013756322 | 2,000 | 1,048,576 | In some other world, today is Christmas. Mr. Takaha decides to make a multi-dimensional burger in his party. A _level- L burger_ (L is an integer greater than or equal to 0) is the following thing: * A level-0 burger is a patty. * A level-L burger (L \geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom. For example, a level-1 burger and a level-2 burger look like `BPPPB` and `BBPPPBPBPPPBB` (rotated 90 degrees), where `B` and `P` stands for a bun and a patty. The burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat? | ['n, x = map(int, input().split())\n\n\ndef pi(n):\n return 2**(n+1)-1\n\n\ndef ai(n):\n return 2**(n+2) - 3\n\n\ndef f(n, x):\n if N == 0:\n return 0 if X <= 0 else 1\n elif (1 < x) and (x <= 1 + ai(n-1)):\n return f(n - 1, x - 1)\n elif x == 2 + ai(n - 1):\n return pi(n - 1) + 1\n elif (2 + ai(n - 1) < x) and (x <= 2 + 2 * ai(n - 1)):\n return pi(n-1) + 1 + f(n-1, x-2-ai(n-1))\n elif x >= ai(n):\n return pi(n)\n\n\nprint(f(n, x))\n', 'n, x = map(int, input().split())\n\n\ndef pi(n):\n return 2**(n+1)-1\n\n\ndef ai(n):\n return 2**(n+2) - 3\n\n\ndef f(n, x):\n if n == 0:\n return 0 if x <= 0 else 1\n else:\n if x <= 1:\n return 0\n elif (x <= 1 + ai(n-1)):\n return f(n - 1, x - 1)\n elif x == 2 + ai(n - 1):\n return pi(n - 1) + 1\n elif (2 + ai(n - 1) < x) and (x <= 2 + 2 * ai(n - 1)):\n return pi(n-1) + 1 + f(n-1, x-2-ai(n-1))\n elif x >= ai(n):\n return pi(n)\n\n\nprint(f(n, x))\n'] | ['Runtime Error', 'Accepted'] | ['s810533254', 's832941468'] | [3064.0, 3064.0] | [18.0, 18.0] | [466, 536] |
p03209 | u017810624 | 2,000 | 1,048,576 | In some other world, today is Christmas. Mr. Takaha decides to make a multi-dimensional burger in his party. A _level- L burger_ (L is an integer greater than or equal to 0) is the following thing: * A level-0 burger is a patty. * A level-L burger (L \geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom. For example, a level-1 burger and a level-2 burger look like `BPPPB` and `BBPPPBPBPPPBB` (rotated 90 degrees), where `B` and `P` stands for a bun and a patty. The burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat? | ['n,x=map(int,input().split())\nl=[0]\nfor i in range(n+1):\n l.append(2**(i+1)-1)\nm=[0]\nfor i in range(n+1):\n m.append(2**(i+2)-3)\nc=0\nfor i in range(n,-1,-1):\n if x<2**(i+1)-1:\n x-=1\n elif x==2**(i+1)-1:\n c+=l[i]+1\n x=0\n elif x>2**(i+1)-1:\n c+=l[i]+1\n elif x==m[i+1]:\n x-=1\n x=x-(2**(i+1)-1)\nprint(c)', 'n,x=map(int,input().split())\nl=[0]\nfor i in range(n+1):\n l.append(2**(i+1)-1)\nm=[0]\nfor i in range(n+1):\n m.append(2**(i+2)-3)\nc=0\nfor i in range(n,-1,-1):\n if x<2**(i+1)-1:\n x-=1\n elif x==2**(i+1)-1:\n c+=l[i]+1\n x=0\n elif x>2**(i+1)-1:\n c+=l[i]+1\n elif x==m[i+1]:\n x-=1\n x=x-(2**(i+1)-1)\nprint(c)', 'n,x=map(int,input().split())\nl=[0]\nfor i in range(n):\n l.append(2**(i+1)-1)\nm=[0]\nfor i in range(n+1):\n m.append(2**(i+2)-3)\nc=0\nfor i in range(n,-1,-1):\n t=2**(i+1)-1\n if x<t:\n x-=1\n elif x==t:\n c+=l[i]+1\n x=0\n else:\n c+=l[i]+1\n if x==m[i+1]:\n x-=1\n x=x-t\nprint(c)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s399803839', 's623832328', 's933043972'] | [3064.0, 3064.0, 3064.0] | [18.0, 18.0, 17.0] | [325, 325, 294] |
p03209 | u021548497 | 2,000 | 1,048,576 | In some other world, today is Christmas. Mr. Takaha decides to make a multi-dimensional burger in his party. A _level- L burger_ (L is an integer greater than or equal to 0) is the following thing: * A level-0 burger is a patty. * A level-L burger (L \geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom. For example, a level-1 burger and a level-2 burger look like `BPPPB` and `BBPPPBPBPPPBB` (rotated 90 degrees), where `B` and `P` stands for a bun and a patty. The burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat? | ['def dp(a, b):\n if a == 1:\n if 1 <= b <= 4:\n return b-1\n else:\n return 3\n elif b == 1:\n return 0\n elif 1 < b < 2**(a+1)-1:\n return dp(a-1, b-1)\n elif b == 2**(a+1)-1:\n return dp(a-1, 2**(a+1)-3) + 1\n elif 2**(a+1)-1 < b < a:\n return dp(a-1, 2**(a+1)-3) + 1 + dp(a-1, b+1-2**(a+1))\n elif b == 2**(a+2)-3:\n return dp(a-1, 2**(a+1)-3) * 2 + 1\n \nprint(dp(n, x))', 'n, x = map(int, input().split())\n\ndef dp(a, b):\n if a == 1:\n if 1 <= b <= 4:\n return b-1\n else:\n return 3\n elif b == 1:\n return 0\n elif 1 < b < 2**(a+1)-1:\n return dp(a-1, b-1)\n elif b == 2**(a+1)-1:\n return dp(a-1, 2**(a+1)-3) + 1\n elif 2**(a+1)-1 < b < 2**(a+2)-3:\n return dp(a-1, 2**(a+1)-3) + 1 + dp(a-1, b+1-2**(a+1))\n elif b == 2**(a+2)-3:\n return dp(a-1, 2**(a+1)-3) * 2 + 1\n \nprint(dp(n, x))'] | ['Runtime Error', 'Accepted'] | ['s169199883', 's838962541'] | [3064.0, 3188.0] | [17.0, 20.0] | [448, 491] |
p03209 | u030992242 | 2,000 | 1,048,576 | In some other world, today is Christmas. Mr. Takaha decides to make a multi-dimensional burger in his party. A _level- L burger_ (L is an integer greater than or equal to 0) is the following thing: * A level-0 burger is a patty. * A level-L burger (L \geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom. For example, a level-1 burger and a level-2 burger look like `BPPPB` and `BBPPPBPBPPPBB` (rotated 90 degrees), where `B` and `P` stands for a bun and a patty. The burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat? | ['\n#include <iomanip>\n\n#include <algorithm>\n#include <numeric>\n#include <functional>\n#include <cmath>\n\n#include <stack>\n#include <bitset>\n#include <map>\n#include <string>\n#include <utility>\n\n#define repd(i,a,b) for(ll i=(a);i<(b);i++)\n#define rep(i,n) repd(i,0,n)\ntypedef long long ll;\n\nusing namespace std;\n\nint inputValue(){\n\tint a;\n\tcin >> a;\n\treturn a;\n}\n\nvoid inputArray(int *p,int a){\n\trep(i,a){\n\t\tcin >> p[i];\n\t}\n}\n\nvoid inputVector(vector<int> *p,int a){\n\trep(i,a){\n\t\tint input;\n\t\tcin >> input;\n\t\tp -> push_back(input);\n\t}\n}\n\ntemplate <typename T>\nvoid output(T a,int precision){\n\tif(precision > 0){\n\t\tcout << setprecision(precision) << a << "\\n";\n\t}else{\n\t\tcout << a << "\\n";\n\t}\n}\n\nvector<ll> a,p;\nll f(ll n,ll x){\n\tif(n==0){\n\t\tif(x<=0){\n\t\t\treturn 0;\n\t\t}else{\n\t\t\treturn 1;\n\t\t}\n\t}else if(x<=1+a[n-1]){\n\t\treturn f(n-1,x-1);\n\t}else{\n\t\treturn p[n-1]+1+f(n-1,x-2-a[n-1]);\n\t}\n}\n\nint main(){\n\t//source\n\tll n,x;\n\tcin >> n >> x;\n\ta.push_back(1);\n\tp.push_back(1);\n\trep(i,n){\n\t\ta.push_back(a[i]*2+3);\n\t\tp.push_back(p[i]*2+1);\n\t}\n\n\tcout << f(n,x) << endl;\n\treturn 0;\n}\n', 'import numpy as np\n\nn,x=map(int,input().split())\na,p=[1],[1]\nfor i in range(n):\n\ta.append(a[i]*2+3)\n\tp.append(p[i]*2+1)\n\ndef f(N,X):\n\tif N==0:\n\t\treturn 0 if X<=0 else 1\n\telif X <=1+a[N-1]:\n\t\treturn f(N-1,X-1)\n\telse:\n\t\treturn p[N-1]+1+f(N-1,X-2-a[N-1])\n\t\nprint (f(n,x))\n\n\ndef inputList():\n\ta=list(map(int,input().split()))\n\treturn a\n\ndef multisort(li,index):\n\treturn sorted(li,key=lambda x: x[index])\n'] | ['Runtime Error', 'Accepted'] | ['s766458267', 's962041428'] | [2940.0, 12436.0] | [17.0, 150.0] | [1116, 400] |
p03209 | u033606236 | 2,000 | 1,048,576 | In some other world, today is Christmas. Mr. Takaha decides to make a multi-dimensional burger in his party. A _level- L burger_ (L is an integer greater than or equal to 0) is the following thing: * A level-0 burger is a patty. * A level-L burger (L \geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom. For example, a level-1 burger and a level-2 burger look like `BPPPB` and `BBPPPBPBPPPBB` (rotated 90 degrees), where `B` and `P` stands for a bun and a patty. The burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat? | ['def f(n,x):\n if n == 0:return 0 if x <= 0 else 1\n elif x <= 1+b[n-1]: return f(n-1, x-1)\n else:\n return 1+p[n-1]+f(n-1,x-2-b[n-1])\n\nN,X=map(int,input().split())\nb,p = [1 for _ in range(N+1)],[1 for _ in range(N+1)]\n\nfor i in range(1,N+1):\n b[i] = b[i-1]*2+3\n p[i] = p[i-1]*2+1\nprint(b)\nprint(f(N,X))', 'def f(n,x):\n if n == 0:return 0 if x <= 0 else 1\n elif x <= 1+b[n-1]: return f(n-1, x-1)\n else:\n return 1+p[n-1]+f(n-1,x-2-b[n-1])\n\nN,X=map(int,input().split())\nb,p = [1 for _ in range(N+1)],[1 for _ in range(N+1)]\n\nfor i in range(1,N+1):\n b[i] = b[i-1]*2+3\n p[i] = p[i-1]*2+1\nprint(f(N,X))'] | ['Wrong Answer', 'Accepted'] | ['s015010589', 's241672850'] | [3064.0, 3064.0] | [17.0, 17.0] | [321, 312] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.