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
p03109
u831328139
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['import sys\n \nv = []\nfor line in sys.stdin:\n v.append([i for i in line.split()])\n \nm = 0\nfor a, b in v[1:]:\n a = float(a)\n if b == "JPY":\n m += a\n else:\n m += 380000.0 * a\nprint(m)', 'import sys\n\nv = ""\nfor line in sys.stdin:\n v = [int(i) for i in line.split("/")]\n\nif v[0] < 2019:\n print("Heisei")\nelif v[0] == 2019 and v[1] <= 2 and v[2] <= 30:\n print("Heisei")\nelse:\n print("TBD")\n\n ', 'import sys\n \nv = ""\nfor line in sys.stdin:\n v = [int(i) for i in line.split("/")]\n \nif v[0] < 2019:\n print("Heisei")\nelif v[0] == 2019 and v[1] <= 4 and v[2] <= 30:\n print("Heisei")\nelse:\n print("TBD")\n ']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s008031038', 's665888089', 's305931663']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[191, 209, 209]
p03109
u835353642
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["s = input()\nprint('Heisei' if S <= '2019/04/30' else 'TBD')", "s = input()\nprint('Heisei' if s <= '2019/04/30' else 'TBD')"]
['Runtime Error', 'Accepted']
['s456687490', 's248828500']
[2940.0, 2940.0]
[17.0, 17.0]
[59, 59]
p03109
u838187806
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["def solver():\n\ta = input().rstrip('\\n').split('/')\n\tprint(a)\n\tif int(a[0]) >= 2019:\n\t\tif int(a[1]) >= 4:\n\t\t\tif int(a[2]) >= 30:\n\t\t\t\tprint('TBD')\n\t\t\telse: print('Heisei')\n\t\telse: print('Heisei')\n\telse: print('Heisei')\n\nsolver()", "def solver():\n\ta = input().rstrip('\\n').split('/')\n\tif int(a[0]) >= 2019:\n\t\tif int(a[1]) >= 4:\n\t\t\tif int(a[2]) >= 30:\n\t\t\t\tprint('TBD')\n\t\t\telse: print('Heisei')\n\t\telse: print('Heisei')\n\telse: print('Heisei')\n\nsolver()", "def solver():\n a = input().rstrip('\\n').split('/')\n if int(a[0]) >= 2019:\n \tif int(a[1]) >= 4:\n \t\tif int(a[2]) >= 30:\n print('TBD')\n else:\n print('Heisei')\n \nsolver()", "def solver():\n\ta = input().rstrip('\\n').split('/')\n\tif int(a[0]) >= 2019:\n\t\tif int(a[1]) >= 4:\n\t\t\tif int(a[2]) >= 30:\n\t\t\t\tprint('TBD')\n\telse:\n\t\tprint('Heisei')\nsolver()", "def solver():\n\ta = input().rstrip('\\n').split('/')\n\tif int(a[0]) > 2019:\n\t\tprint('TBD')\n\telif int(a[0]) < 2019:\n\t\tprint('Heisei')\n\telse:\n\t\tif int(a[1]) > 4:\n\t\t\tprint('TBD')\n\t\telif int(a[1]) < 4:\n\t\t\tprint('Heisei')\n\t\telse:\n\t\t\tif int(a[2]) > 30:\n\t\t\t\tprint('TBD')\n\t\t\telif int(a[2]) < 30:\n\t\t\t\tprint('Heisei')\n\t\t\telse:\n\t\t\t\tprint('Heisei')\n\nsolver()"]
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s103397721', 's154609384', 's155281784', 's824167138', 's726951159']
[2940.0, 2940.0, 2940.0, 2940.0, 3064.0]
[18.0, 17.0, 17.0, 17.0, 17.0]
[226, 216, 186, 168, 343]
p03109
u838869282
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['y,m,d=map(int, input().split(\'/\'))\nif y>2019:\n\tprint("TBD")\nelif m>4:\n\tprint("TBD")\nelif y>30:\n\tprint("TBD")\nelse:\n\tprint("Heisei")', 'y,m,d=map(int, input().split(\'/\'))\nif y>2019:\n\tprint("TBD")\nelif m>4:\n\tprint("TBD")\nelif d>30:\n\tprint("TBD")\nelse:\n\tprint("Heisei")']
['Wrong Answer', 'Accepted']
['s263658297', 's558102859']
[2940.0, 2940.0]
[17.0, 17.0]
[131, 131]
p03109
u841994910
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['a = input().split()\nif int(a[6]) < 4:\n print("Heise")\nelif int(a[6]) == 4 and int(a[8]) < 3:\n print("Heisei")\nelse:\n print("TBD")', 'a = input().split()\nif a[6] < 4:\n print("Heisei")\nelif a[6] == 4 and a[8] < 3:\n print("Heisei")\nelse:\n print("TBD")', 'a = input().split("/")\nif int(a[1]) < 4:\n print("Heisei")\nelif int(a[1]) == 4 and int(a[2]) < 30:\n print("Heisei")\nelse:\n print("TBD")\n', 'a = input().split("/")\nif int(a[1]) < 4:\n print("Heisei")\nelif int(a[1]) == 3 and int(a[2]) < 30:\n print("Heisei")\nelse:\n print("TBD")', 'a = input().split("/")\nif int(a[1]) < 4:\n print("Heisei")\nelif int(a[1]) == 4 and int(a[2]) <= 30:\n print("Heisei")\nelse:\n print("TBD")\n']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s093328471', 's430819022', 's640656520', 's896869797', 's528596539']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0, 17.0, 17.0]
[132, 118, 138, 137, 139]
p03109
u843318346
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["s = input()\nif s <= '2019/04/30':\n print('Heisei')\nprint('TBD')", "s = input()\nif s <= '2019/04/30':\n print('Heisei')\nelse:\n print('TBD')\n"]
['Wrong Answer', 'Accepted']
['s731249345', 's497658225']
[2940.0, 2940.0]
[17.0, 17.0]
[64, 73]
p03109
u845620905
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['s = input().split(\'/\')\nif(int(s[0]) >= 2020):\n print("TBD")\nelif(int(s[0]) == 2019):\n s[1] = s[1].replace("0", "")\n s[1] = int(s[1])\n if(s[2][0] == "0"):\n s[2] = s[2].replace("0", "")\n s[2] = int(s[2])\n else:\n s[2] = int(s[2])\n if(s[1] > 4):\n print("TBD")\n elif(s[1] == 4):\n if(s[2] >= 30):\n print("TBD")\n else:\n print("Heisei")\n else:\n print("Heisei")\nelse:\n print("Heisei")', 's = input().split(\'/\')\nif(int(s[0]) >= 2020):\n print("TBD")\nelif(int(s[0]) == 2019):\n if(s[1][0] == "0"):\n \ts[1] = s[1].replace("0", "")\n \ts[1] = int(s[1])\n else:\n s[1] = int(s[1])\n if(s[2][0] == "0"):\n s[2] = s[2].replace("0", "")\n s[2] = int(s[2])\n else:\n s[2] = int(s[2])\n if(s[1] > 4):\n print("TBD")\n elif(s[1] == 4):\n if(s[2] >= 30):\n print("TBD")\n else:\n print("Heisei")\n else:\n print("Heisei")\nelse:\n print("Heisei")', 'a = input()\nif(a > "2019/04/30"):\n print("TBD")\nelse:\n print("Heisei")']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s668360905', 's958881920', 's880992383']
[3064.0, 3064.0, 2940.0]
[18.0, 17.0, 17.0]
[416, 469, 72]
p03109
u847033024
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["a = input()\nif a[6] > 4:\n print('TBD')\nelif a[6] < 3:\n print('heisei')\nelse:\n if a[8] < 2:\n print('heisei')\n else:\n if a[9] > 0:\n print('heisei')\n else:\n print('TBD')\n ", "a = input()\nif int(a[5]) == 1:\n print('TBD')\nelse:\n if int(a[6]) > 4:\n print('TBD')\n else:\n print('heisei')", "a = input()\nif int(a[5]) != 1:\n if int(a[6]) > 4:\n print('TBD')\n elif int(a[6]) < 3:\n print('heisei')\n else:\n if int(a[8]) < 2:\n print('heisei')\n else:\n if int(a[9]) > 0:\n print('heisei')\n else:\n print('TBD')\nelse:\n print('TBD')", "a = input()\nif a < '2019/05/01':\n print('Heisei')\nelse:\n print('TBD')"]
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s321868109', 's889971362', 's980056147', 's103656254']
[9040.0, 9160.0, 9040.0, 8904.0]
[23.0, 25.0, 25.0, 25.0]
[191, 116, 273, 71]
p03109
u848647227
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['a = input()\nif a[5] == "1":\n print("TBD")\nelif int(a[6]) >= 5:\n print("TBD")\nelse:\n print("heisei")', 'a = input()\nif a[5] == "1":\n print("TBD")\nelif int(a[6]) >= 5:\n print("TBD")\nelse:\n print("Heisei")']
['Wrong Answer', 'Accepted']
['s816896456', 's277656317']
[2940.0, 2940.0]
[17.0, 18.0]
[102, 102]
p03109
u850028278
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['import datetime\ny,m,d = map(int,input().split("/"))\nif datetime.date(2019,4,30) < datetime.date(y,m,d):\n print("TBD")\nelse:\n print("Heisei")\nprint(datetime.date(y,m,d))', 'import datetime\ny,m,d = map(int,input().split("/"))\nif datetime.date(2019,4,30) < datetime.date(y,m,d):\n print("TBD")\nelse:\n print("Heisei")\n']
['Wrong Answer', 'Accepted']
['s565263558', 's985753271']
[3312.0, 3316.0]
[19.0, 21.0]
[174, 147]
p03109
u852113235
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['s = input()\nt = \'2019/04/30\'\nif s <= t:\n print("YES")\nelse:\n print("NO")', 's = input()\nt = \'2019/04/30\'\nif s <= t:\n print("Heisei")\nelse:\n print("TBD")']
['Wrong Answer', 'Accepted']
['s678569957', 's113598337']
[2940.0, 2940.0]
[16.0, 17.0]
[78, 82]
p03109
u860726004
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['a', "S = list(map(int, input().split('/')))\nX = [2019, 4, 30]\n\nprint('Heisei') if all([S[i] <= X[i] for i in range(3)]) else print('TBD')\n\n"]
['Runtime Error', 'Accepted']
['s110611122', 's816525565']
[2940.0, 2940.0]
[18.0, 17.0]
[1, 134]
p03109
u865413330
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['def main():\n n = int(input())\n total = 0\n\n for line in range(0, n):\n total += calc(total)\n\n print(total)\n\ndef calc(total):\n x, u = map(str, input().split())\n\n if u == "JPY":\n total += int(x)\n return total\n\n if u == "BTC":\n total += float(x) * 380000\n return total\n\n\nif __name__ == \'__main__\':\n main()\n', 'def main():\n n = int(input())\n total = 0\n\n for line in range(0, n):\n total += calc()\n\n print(total)\n\n\ndef calc():\n x, u = map(str, input().split())\n\n if u == "JPY":\n return int(x)\n\n if u == "BTC":\n return float(x) * 380000\n\n\nif __name__ == \'__main__\':\n main()\n', '# -*- coding: utf-8 -*-\n\nimport datetime\n\ndate = input()\ndate1 = datetime.datetime.strptime(date, \'%Y/%m/%d\')\n\ndate2 = datetime.datetime(2019, 4, 30)\n\nif date2 >= date1:\n print("Heisei")\nelse:\n print("TBD")']
['Runtime Error', 'Runtime Error', 'Accepted']
['s193527604', 's815793470', 's746451923']
[3060.0, 2940.0, 4568.0]
[18.0, 17.0, 35.0]
[360, 305, 212]
p03109
u865801295
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["S = input().split('/')\n\nprint(S)\n\nif int(S[0]) > 2019:\n print('TBD')\nelif S[0] == '2019' and S[1] > '05':\n print('TBD')\nelse:\n print('Heisei')", "S = input().split('/')\n\nprint(S)\n\nif int(S[0]) > 2019:\n print('TBD')\nelif S[0] == '2019' and S[1] > '05':\n print('TBD')\nelse:\n print('Heisei')", "S = input().split('/')\n\nif S[1] >= '05':\n print('TBD')\nelse:\n print('Heisei')"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s168751443', 's373420608', 's831569615']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[151, 151, 83]
p03109
u866769581
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['a,b,c = map(int,input().split("/"))\nif a >=2019 && b >= 5:\n print(\'TBD\')\nelse:\n print(\'Heisei\')', 'a,b,c = map(int,input().split("/"))\nif a >=2019 and b >= 5:\n print(\'TBD\')\nelse:\n print(\'Heisei\')\n']
['Runtime Error', 'Accepted']
['s572533573', 's906420236']
[2940.0, 2940.0]
[17.0, 18.0]
[101, 103]
p03109
u868040597
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['#!/usr/bin/python\nimport datetime\n\ndef main():\n S = str(input())\n tdatetime = datetime.datetime.strptime(S, \'%Y/%m/%d\')\n\n if tdatetime.month <= 4:\n print(\'HEISEI\')\n else:\n print(\'TBD\')\n\nif __name__ == "__main__":\n main()', '#!/usr/bin/python\nimport datetime\n\ndef main():\n S = str(input())\n tdatetime = datetime.datetime.strptime(S, \'%Y%m%d\')\n\n if tdatetime.month <= 4:\n print(\'HEISEI\')\n else:\n print(\'TBD\')\n\nif __name__ == "__main__":\n main()', '#!/usr/bin/python\nimport datetime\n\ndef main():\n S = str(input())\n tdatetime = datetime.datetime.strptime(S, \'%Y/%m/%d\')\n\n if tdatetime.month <= 4:\n print(\'Heisei\')\n else:\n print(\'TBD\')\n\nif __name__ == "__main__":\n main()']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s326846160', 's673229963', 's726258628']
[4328.0, 4336.0, 4456.0]
[33.0, 32.0, 36.0]
[249, 247, 249]
p03109
u874276081
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['date = input().split("/")\n sum = int(date[0]) * 365 + int(date[1]) * 30 + int(date[2])\n\n if 737085 < sum:\n print("TBD")\n else:\n print("Heisei")', 'date = input().split("/")\nsum = int(date[0]) * 365 + int(date[1]) * 30 + int(date[2])\n\nif 737085 < sum:\n print("TBD")\nelse:\n print("Heisei")']
['Runtime Error', 'Accepted']
['s571996884', 's129291083']
[2940.0, 2940.0]
[17.0, 17.0]
[166, 146]
p03109
u877543650
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['s = input()\nif int(s[:4]) > 2019:\n print("Heisei")\nelif int(s[5:7]) >= 5:\n print("Heisei")\nelse:\n print("TBD")', 's = input()\nif int(s[:4]) > 2019:\n print("TBD")\nelif int(s[5:7]) >= 5:\n print("TBD")\nelse:\n print("Heisei")']
['Wrong Answer', 'Accepted']
['s803787080', 's754260641']
[2940.0, 3060.0]
[17.0, 17.0]
[113, 110]
p03109
u879870653
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['print("2019/04/30" if input() <= "2019/04/30" else "TBD")', 'print("Heisei" if input() <= "2019/04/30" else "TBD")']
['Wrong Answer', 'Accepted']
['s554206720', 's064061460']
[2940.0, 2940.0]
[18.0, 18.0]
[57, 53]
p03109
u880891635
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["import datetime\n\nx = input()\n\ny = datetime.date(2019, 4, 30)\nx_date = datetime.date(x.replace('/', ','))\n\nif x_date <= y\n print('Heisei')\nelse\n print('TBD')\n", "import datetime\n\nx = input()\nx_date = datetime.datetime.strptime(x, '%Y/%m/%d')\n\ny = datetime.datetime(2019, 4, 30, 0, 0, 0)\n\nif x_date <= y :\n print('Heisei')\nelse:\n print('TBD')\n"]
['Runtime Error', 'Accepted']
['s853520687', 's957112008']
[2940.0, 4312.0]
[16.0, 29.0]
[163, 186]
p03109
u882370611
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["s=input()\nif s[5] == '1':\n print('TBD')\nelse:\n if s[6] > 4:\n print('TBD')\n else:\n print('Heisei')", 'S = list(input())\na = int(S[5]+S[6])\n\nif a <= 4:\n ans = "Heisei"\nelse:\n ans = "TBD"\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s013970525', 's508639644']
[3060.0, 2940.0]
[18.0, 17.0]
[106, 101]
p03109
u883203948
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['import datetime\nd1 = input().split("/")\n\ny = int(d1[0])\nm = int(d1[1])\nd = int(d1[2])\n\ndd = datetime.date(y,m,d)\nd2 = datetime.date(2019,4,30)\n\nif dd =< d2:\n print("Heisei")\nelse:\n print("TBD")', 'import datetime\nd1 = input().split("/")\n\ny = int(d1[0])\nm = int(d1[1])\nd = int(d1[2])\n\ndd = datetime.date(y,m,d)\nd2 = datetime.date(2019,4,30)\n\nif dd < d2:\n print("Heisei")\nelse:\n print("TBD")', 'import datetime\nd1 = input().split("/")\n\ny = int(d1[0])\nm = int(d1[1])\nd = int(d1[2])\n\ndd = datetime.date(y,m,d)\nd2 = datetime.date(2019,4,30)\n\nif dd <= d2:\n print("Heisei")\nelse:\n print("TBD")']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s459897818', 's594881225', 's773693280']
[2940.0, 3316.0, 3312.0]
[17.0, 20.0, 19.0]
[195, 194, 195]
p03109
u889914341
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['print("Heisei" if input() <= 2019/04/30 else "TBD")', 'print("Heisei" if input() <= "2019/04/30" else "TBD")']
['Runtime Error', 'Accepted']
['s594929855', 's839003618']
[2940.0, 2940.0]
[17.0, 17.0]
[51, 53]
p03109
u894694822
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['a, b, c=map(int, input().split(/))\nif a>=2020:\n print("TBD")\nelif a==2019 and b>=5:\n print("TBD")\nelse:\n print("Heisei")', 'a, b, c=map(int, input().split("/"))\nif a>=2020:\n print("TBD")\nelif a==2019 and b>=5:\n print("TBD")\nelse:\n print("Heisei")\n']
['Runtime Error', 'Accepted']
['s219554679', 's445253045']
[2940.0, 2940.0]
[17.0, 17.0]
[123, 126]
p03109
u897329068
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['from datetime import datetime\n\nS = input()\n\nnowDate = datetime.strptime(S, \'%Y/%m/%d\')\nlastDate =datetime.strptime(\'2019/04/30\', \'%Y/%m/%d\')\n\nif lastDate < nowTime:\n\tprint("TBD")\nelse:\n\tprint("Heisei")', 'from datetime import datetime\n\nS = input()\n\nnowDate = datetime.strptime(S, \'%Y/%m/%d\')\nlastDate =datetime.strptime(\'2019/04/30\', \'%Y/%m/%d\')\n\nif lastDate < nowDate:\n\tprint("TBD")\nelse:\n\tprint("Heisei")']
['Runtime Error', 'Accepted']
['s699984920', 's170570614']
[4592.0, 4720.0]
[34.0, 39.0]
[201, 201]
p03109
u901122076
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["S = input()\n\ny, m, d = map(int, S.split('/'))\n\nprint(y)\nprint(m)\n\nif y == 2019 and m <= 4:\n print('Heisei')\nelse:\n print('TBD')\n", "S = input()\n\ny, m, d = map(int, S.split('/'))\n\nif y == 2019 and m <= 4:\n print('Heisei')\nelse:\n print('TBD')\n"]
['Wrong Answer', 'Accepted']
['s736895691', 's350630143']
[2940.0, 2940.0]
[17.0, 17.0]
[134, 115]
p03109
u905510147
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['a, b, c = input().split("/")\n\nx = b+c\nx = int(x)\nprint(x)\nif x > 430:\n print("TBD")\nelse:\n print("Heisei")\n', 'a, b, c = input().split("/")\n\nx = b+c\nx = int(x)\nif x > 430:\n print("TBD")\nelse:\n print("Heisei")\n']
['Wrong Answer', 'Accepted']
['s960200421', 's590596070']
[3060.0, 2940.0]
[19.0, 17.0]
[113, 104]
p03109
u910158862
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['import datetime\ntarget = datetime.datetime(2019,4,30)\ny,m,d = map(int,input().split("/"))\nindata = datetime.datetime(y,m,d)\nif indata <= target:\n print("Heisai")\nelse:\n print("TBD")\n', 'import datetime\ntarget = datetime.datetime(2019,4,30)\ny,m,d = map(int,input().split("/"))\nindata = datetime.datetime(y,m,d)\nif indata <= target:\n print("Heisei")\nelse:\n print("TBD")\n']
['Wrong Answer', 'Accepted']
['s062213652', 's274111471']
[3316.0, 3312.0]
[19.0, 18.0]
[184, 184]
p03109
u912318491
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["import datetime;\ndef main():\n s=input()\n y,m,d=s.split('/')\n y=int(y)\n m=int(m)\n d=int(d)\n\n d1= datetime.date(y,m,d)\n Heisei=datetime.date(2019,4,30)\n\n if(Heisei>=d1):\n print('Heisei')\n else:\n print('TBD')", "import datetime;\n\ns=input()\ny,m,d=s.split('/')\ny=int(y)\nm=int(m)\nd=int(d)\n\nd1= datetime.date(y,m,d)\nHeisei=datetime.date(2019,4,30)\n\nif(Heisei>=d1):\n print('Heisei')\nelse:\n print('TBD')"]
['Wrong Answer', 'Accepted']
['s535094046', 's939569010']
[3440.0, 3312.0]
[24.0, 19.0]
[246, 191]
p03109
u918935103
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['s = input()\nday = (s.split("/"))\nif day[1] == "4":\n print("Heisei")\nelse:\n print("TBD")', 's = input()\nd = s.split("/")\nif day[1] > 4:\n print("TBD")\nelse:\n print("Heisei")', 's = input()\nday = (s.split("/"))\nif day[1] == "4":\n print("Heisei")\nelse:\n print("Reiwa")', 's = input()\nday = (s.split("/"))\nif int(day[1]) <= "4":\n print("Heisei")\nelse:\n print("TBD")\n', 's = input()\nday = (s.split("/"))\nif int(day[1]) <= 4:\n print("Heisei")\nelse:\n print("TBD")']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s071599525', 's078572447', 's235503968', 's910731450', 's699045093']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0, 18.0, 17.0]
[87, 80, 89, 93, 90]
p03109
u919633157
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["y,m,d=input().split('/')\nprint('TBD' if int(m+d)>=430 else 'Heisei')", "y,m,d=input().split('/')\nprint('TBD' if int(m+d)>430 else 'Heisei')"]
['Wrong Answer', 'Accepted']
['s887727010', 's409671971']
[3060.0, 2940.0]
[20.0, 17.0]
[68, 67]
p03109
u923341003
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['S = input()\nS = S.split("/")\nS = [int(s) for s in S]\nif S[0] < 2019 and S[1] < 4 and S[2] < 30:\n print("Heisei")\nelse:\n print("TBD")', 'S = input()\nS = S.split("/")\nS = [int(s) for s in S]\nif S[0] < 2019 and S[1] < 4 and S[1] < 30:\n print("Heisei")\nelse:\n print("TBD")', 'S = input()\nS = S.split("/")\nS = [int(s) for s in S]\nif S[0] < 2019:\n print("Heisei")\nif S[0] < 2019 and S[1] < 4:\n print("Heisei")\nif S[0] < 2019 and S[1] < 4 and S[2] < 30:\n print("Heisei")\nelse:\n print("TBD")', 'S = input()\nS = S.split("/")\nS = [int(s) for s in S]\nif S[0] < 2019:\n print("Heisei")\nelif S[1] < 4:\n print("Heisei")\nelif S[2] < 30:\n print("Heisei")\nelse:\n print("TBD")', 'S = input()\nS = S.split("/")\nS = [int(s) for s in S]\nif S[0] <= 2019 and S[1] <= 4 and S[2] <=30:\n print("Heisei")\nelse:\n print("TBD")']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s095516134', 's737701164', 's763482799', 's888108396', 's329295233']
[2940.0, 2940.0, 3060.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[138, 138, 223, 182, 140]
p03109
u924308178
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['# coding: utf-8\ns = input()\ns if s <=\'2019/04/30\' else print("TBD")', '# coding: utf-8\ns = input()\nif s <=\'2019/04/30\':\n print("Heisei")\nelse:\n print("TBD")']
['Wrong Answer', 'Accepted']
['s835260590', 's302797477']
[2940.0, 2940.0]
[18.0, 17.0]
[67, 91]
p03109
u924828749
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['s = [int(x) for x in input().split("/")]\n\nif s[1] < 4:\n print("Heisei")\nelif s[1] == 4 and s[2] < 30:\n print("Heisei")\nelse:\n print("TBD")', 's = [int(x) for x in input().split("/")]\n \nif s[1] < 4:\n print("Heisei")\nelif s[1] == 4 and s[2] <= 30:\n print("Heisei")\nelse:\n print("TBD")']
['Wrong Answer', 'Accepted']
['s433150716', 's660917078']
[9120.0, 9100.0]
[25.0, 23.0]
[141, 143]
p03109
u927282564
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["yy,mm,dd =map(int,input().split('/'))\n\nif yy>2019:\n print('TBD')\nelse:\n if mm>4:\n print('TBD')\n else:\n if mm==1 or mm==3:\n if dd>31:\n print('TBD')\n else:\n print('Heisei')\n if mm==2:\n if d>29:\n print('TBD')\n else:\n print('Heisei')\n if mm==4:\n if d>30:\n print('TBD')\n else:\n print('Heisei')\n\n\n", "yy,mm,dd =map(int,input().split('/'))\n\nif yy>2019:\n print('TBD')\nelse:\n if mm>4:\n print('TBD')\n else:\n if mm==1 or m==3:\n if dd>31:\n print('TBD')\n else:\n print('Heisei')\n if mm==2:\n if d>29:\n print('TBD')\n else:\n print('Heisei')\n if mm==4:\n if d>30:\n print('TBD')\n else:\n print('Heisei')\n\n\n\n if mm<=4:\n if dd<=30:\n print('Heisei')\nelse:\n print('TBD')\n\n", "yy,mm,dd =map(int,input().split('/'))\n\nif yy>2019:\n print('TBD')\nelse:\n if mm>4:\n print('TBD')\n else:\n if mm==1 or mm==3:\n if dd>31:\n print('TBD')\n else:\n print('Heisei')\n if mm==2:\n if d>29:\n print('TBD')\n else:\n print('Heisei')\n if mm==4:\n if d>30:\n print('TBD')\n else:\n print('Heisei')\n\n\n\n if mm<=4:\n if dd<=30:\n print('Heisei')\nelse:\n print('TBD')\n\n", "yy,mm,dd =map(int,input().split('/'))\n\nif yy>2019:\n print('TBD')\nelse:\n if mm>4:\n print('TBD')\n else:\n if mm==1 or mm==3:\n if dd>31:\n print('TBD')\n else:\n print('Heisei')\n if mm==2:\n if dd>29:\n print('TBD')\n else:\n print('Heisei')\n if mm==4:\n if dd>30:\n print('TBD')\n else:\n print('Heisei')\n\n\n"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s653512491', 's789035812', 's834226571', 's726923404']
[3060.0, 2940.0, 2940.0, 2940.0]
[19.0, 18.0, 17.0, 18.0]
[378, 449, 450, 380]
p03109
u927764913
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['dt = [for int(i) in input().split("/")]\nif dt[0] >= 2019 and dt[1] >= 5:\n print("TBD")\nelse :\n print("Heisei")', 'dt = [int(i) for i in input().split("/")]\n\nif dt[0] >= 2019 and dt[1] >= 5:\n print("TBD")\nelse :\n print("Heisei")']
['Runtime Error', 'Accepted']
['s565405899', 's248145862']
[2940.0, 2940.0]
[17.0, 17.0]
[116, 119]
p03109
u931118906
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['s=input()\nprint(s)\nif "2019/04/30">=s:\n print(\'Heisei\')\nelse:\n print(\'TBD\')\n', 's=input()\nif "2019/04/30">=s:\n print(\'Heisei\')\nelse:\n print(\'TBD\')\n']
['Wrong Answer', 'Accepted']
['s716186815', 's973039707']
[2940.0, 2940.0]
[17.0, 19.0]
[82, 73]
p03109
u933129390
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['s = input()\nif int(s[:4])<2019 and int(s[5:7])<4:\n print("Heisei")\nelse:\n print("TBD")\n', 's = input()\nif int(s[:4])<=2019 and int(s[5:7])<=4:\n print("Heisei")\nelse:\n print("TBD")\n']
['Wrong Answer', 'Accepted']
['s930427022', 's348236320']
[2940.0, 2940.0]
[18.0, 17.0]
[93, 95]
p03109
u936985471
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['s=input()\nprint("Heisei" if int(s[5:7])<5) else "TBD")', 's=input()\nprint("Heisei" if int(s[5:7])<5 else "TBD")']
['Runtime Error', 'Accepted']
['s296397278', 's460850744']
[2940.0, 2940.0]
[17.0, 17.0]
[54, 53]
p03109
u940061594
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['\nS = input()\nif S[6:8] == "01" or S[6:8] == "02" or S[6:8] == "03" or S[6:8] == "04":\n print("Heisei")\nelse:\n print("TBD")', '\nS = input()\nif S[5:7] == "01" or S[5:7] == "02" or S[5:7] == "03" or S[5:7] == "04":\n print("Heisei")\nelse:\n print("TBD")']
['Wrong Answer', 'Accepted']
['s794492985', 's863074341']
[2940.0, 2940.0]
[19.0, 17.0]
[138, 138]
p03109
u940279019
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['_,m,_ = map(int,input().split("/"))\nprint("TBD" if m > 4 else "HEISEI")', 'S = input()\nprint("HEISEI" if S <= 2019/4/30 else "TBD")', 'S = input()\nprint("HEISEI" if(S <= 2019/4/30) else "TBD")', '_,m,_ = map(int,input().split("/"))\nprint("TBD" if m > 4 else "Heisei")']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s292948827', 's390067643', 's523763127', 's943005931']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 20.0]
[71, 56, 57, 71]
p03109
u941284420
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['y,m,d=int(input().split("/"))\nif y<=2018:\n ans="Heisei"\nelse:\n if m<=4:\n ans="Heisei"\n else:\n ans="TBD"\nprint(ans)', 'y,m,d=str(input().split("/"))\nif y<=2018:\n ans="Heisei"\nelse:\n if m<=4:\n ans="Heisei"\n else:\n ans="TBD"\nprint(ans)', 'y,m,d=str(input().split("/")\nif y<=2018:\n ans="Heisei"\nelse:\n if m<=4:\n ans="Heisei"\n else:\n ans="TBD"\nprint(ans)\n', 'y,m,d=map(int,input().split("/"))\nif y<=2018:\n ans="Heisei"\nelse:\n if m<=4:\n ans="Heisei"\n else:\n ans="TBD"\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s112045317', 's186408900', 's599154871', 's582141888']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[123, 123, 123, 127]
p03109
u945761460
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['y, m, d=map(int, input().split("/"))\nif 2020<y:\n print("Heisei")\nelse:\n if y<2019:\n print("TBD")\n \n else: #y==2019\n if 5<m:\n print("Heisei")\n else:\n if m<=4:\n print("TBD")', 'y, m, d=map(int, input().split("/"))\nif 2020<y:\n print("TBD")\nelse:\n if y<2019:\n print("Heisei")\n \n else: #y==2019\n if 5<=m:\n print("TBD")\n else:\n if m<=4:\n print("Heisei")']
['Wrong Answer', 'Accepted']
['s392402913', 's527051714']
[9172.0, 9056.0]
[28.0, 26.0]
[221, 222]
p03109
u951492009
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
[' = input()\n\n\n# a_y = int(A[0]) * 1000\n# b_y = int(A[1]) *100\n# c_y = int(A[2])*10\n# d_y = int(A[3])\n\n\n\nif int(A[5])!=0:\n mm = (int(A[5])*10) + (int(A[6]))\nelse:\n mm = int(A[6])\n\nif int(A[8])!=0:\n dd = (int(A[8])*10) + (int(A[9]))\nelse:\n dd = int(A[9])\n \n\n\n# print("TBD")\n# elif yyyy==2019 and mm>=5:\n# print("TBD")\n# else:\n\n\nif mm>4:\n print("TBD")\nelse:\n print("Heisei")\n', 'A = input()\n\n\n# a_y = int(A[0]) * 1000\n# b_y = int(A[1]) *100\n# c_y = int(A[2])*10\n# d_y = int(A[3])\n\n\n\nif int(A[5])!=0:\n mm = (int(A[5])*10) + (int(A[6]))\nelse:\n mm = int(A[6])\n\nif int(A[8])!=0:\n dd = (int(A[8])*10) + (int(A[9]))\nelse:\n dd = int(A[9])\n \n\n\n# print("TBD")\n# elif yyyy==2019 and mm>=5:\n# print("TBD")\n# else:\n\n\nif mm>4:\n print("TBD")\nelse:\n print("Heisei")\n']
['Runtime Error', 'Accepted']
['s589604404', 's286461928']
[2940.0, 3060.0]
[17.0, 17.0]
[504, 505]
p03109
u952656646
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['import dateutil\nS = dateutil.parser.parse(input())\nbase = dateutil.parser.parse(\'2019/04/30\')\nif S<=base:\n print("Heisei")\nelse:\n print("TBD")', 'import datetime\nS = input()\ndt = datetime.date(*list(map(int, S.split(\'/\'))))\nbase = datetime.date(2019, 4, 30)\nif dt<=base:\n print("Heisei")\nelse:\n print("TBD")']
['Runtime Error', 'Accepted']
['s887190396', 's238796682']
[2940.0, 3312.0]
[17.0, 19.0]
[148, 167]
p03109
u953379577
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['s = input()\nif s[5] == 1:\n print("TBD")\nelse:\n if s[6]>4:\n print("Heisei")\n else:\n print("TBD")', 's = input()\nif int(s[5]) == 1:\n print("TBD")\nelse:\n if int(s[6])>4:\n print("Heisei")\n else:\n print("TBD")', 's = input()\nif int(s[5]) == 1:\n print("TBD")\nelse:\n if int(s[6])<5:\n print("Heisei")\n else:\n print("TBD")']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s028287196', 's031465964', 's252348841']
[9096.0, 9168.0, 9012.0]
[20.0, 24.0, 25.0]
[118, 128, 128]
p03109
u956547804
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["import re\ns=input()\nh=re.fullmatch(r'2019/(\\d+)/(\\d+)',s)\nif h.groups(1)=='04'or h.groups(1)=='03'or h.groups(1)=='02'or h.groups(1)=='01':\n print('Heosei')\nelse:\n print('TBD')", "import re\ns=input()\na=re.search('([0-9]{4})/([0-9]{2})/([0-9]{2})',s)\nif int(str(a.group(2)))<=4:\n print('Heosei')\nelse:\n print('TBD')", "import re\ns=input()\na=re.search('([0-9]{4})/([0-9]{2})/([0-9]{2})',s)\nprint(a.group(2))\nif int(str(a.group(2)))<=4:\n print('Heosei')\nelse:\n print('TBD')", "import re\ns=input()\na=re.search('([0-9]{4})/([0-9]{2})/([0-9]{2})',s)\nif int(str(a.group(2)))<=4:\n print('Heisei')\nelse:\n print('TBD')"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s110974862', 's515166489', 's535454528', 's225307572']
[3188.0, 3188.0, 3188.0, 3188.0]
[22.0, 22.0, 21.0, 19.0]
[182, 140, 158, 140]
p03109
u957872856
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['a, b, c = input.split("/")\nprint("Heisei" if b in ["01","02","03","04"] else "TBD")\n', 'a, b, c = input.split("/")\nprint("Heisei" if "Heisei" in ["01","02","03","04"] else "TBD")\n', 'a = input().split("/")\nprint(a)', 'a, b, c = input().split("/")\nprint("Heisei" if b in ["01","02","03","04"] else "TBD")\n']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s164443787', 's184117508', 's778454018', 's304902910']
[2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 17.0, 18.0, 18.0]
[84, 91, 31, 86]
p03109
u959651981
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['s = input\nprint("TBD") if int(s[5:7]) =>5 else print("Heisei")', "s=input()\n\nif int(s[5:7]) <= 4:\n print('Heisei')\nelse:\n print('TBD')\n"]
['Runtime Error', 'Accepted']
['s364803167', 's295695408']
[2940.0, 2940.0]
[17.0, 17.0]
[62, 75]
p03109
u960171798
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['N = int(input())\nans = 0\n\nfor i in range(N):\n a,b = map(str, input().split())\n if b =="JPY":\n ans += int(a)\n else:\n ans += int(a)*380000\nprint(ans)\n', 'y,m,d = map(int, input().split("/"))\nif m >= 5 :\n print("TBD")\nelse:\n print("Heisei")']
['Runtime Error', 'Accepted']
['s222643038', 's172436578']
[2940.0, 2940.0]
[17.0, 17.0]
[157, 88]
p03109
u962942039
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['date = list(map(int, input().split("/")))\nif date[0] >= 2019:\n\tif date[1] >= 5:\n\t\tprint("Heisei")\nelse:\n\tprint("TBD")\n', 'date = list(map(int, input().split("/")))\nif date[0] >= 2019:\n\tif date[1] >= 5:\n\t\tprint("TBD")\nelse:\n\tprint("Heisei")\n', 'date = list(map(int, input().split("/")))\nif date[0] >= 2019:\n\tif date[1] >= 5:\n\t\tprint("TBD")\n else:\n \tprint("Heisei")\nelse:\n\tprint("Heisei")\n', 'date = list(map(int, input().split("/")))\nif date[0] > 2019:\n\tif date[1] > 5:\n\t\tprint("Heisei")\nelse:\n\tprint("TBD")\n', 'date = map(int, input().split("/"))\nif date[0] > 2019:\n\tif date[1] > 5:\n\t\tprint("Heisei")\nelse:\n\tprint("TBD")\n', 'date = list(map(int, input().split("/")))\nif date[0] >= 2019 and date[1] >= 5:\n\tprint("TBD")\nelse:\n print("Heisei")\n']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s172143662', 's237653985', 's450481687', 's465524200', 's898314739', 's657430642']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[118, 118, 151, 116, 110, 117]
p03109
u965602776
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['import bisect\nI = lambda n: [int(input()) for _ in range(n)]\ndef f(S, x):\n p = bisect.bisect_left(S, x)\n return min([S[p-1], S[p]], key = lambda s: abs(x-s))\ng = lambda x, s, t: abs(x-s)+abs(s-t)\nINF = 10**18\na, b, q = map(int, input().split())\nS, T, X = [-INF]+I(a)+[INF], [-INF]+I(b)+[INF], I(q)\nfor x in X:\n s, t = f(S, x), f(T, x)\n print(min(g(x, s, f(T, s)), g(x, t, f(S, t))))', "s = int(input().replace('/', ''))\nprint(['Heisei', 'TBD'][s > 20190430])"]
['Runtime Error', 'Accepted']
['s265390890', 's584311163']
[3064.0, 2940.0]
[19.0, 19.0]
[394, 72]
p03109
u966000628
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['lis = list(input().split("/"))\nif lis[1] <= 4:\n print("Heisei")\nelse:\n print("TBD")', 'lis = list(map(int,input().split("/")))\nif lis[1] <= 4:\n print("Heisei")\nelse:\n print("TBD")']
['Runtime Error', 'Accepted']
['s411328824', 's833026037']
[2940.0, 2940.0]
[20.0, 20.0]
[85, 94]
p03109
u969190727
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['S=input()\nY=S[0:4]\nM=S[5:7]\nD=S[7:9]\nYMD=int(Y+M+D)\nif YMD<=20190430:\n print("Heisei")\nelse:\n print("TBD")', 'S=input()\nY=S[0:4]\nM=S[5:7]\nD=S[8:10]\nYMD=int(Y+M+D)\nif YMD<=20190430:\n print("Heisei")\nelse:\n print("TBD")']
['Runtime Error', 'Accepted']
['s647441539', 's311976126']
[3060.0, 2940.0]
[19.0, 17.0]
[108, 109]
p03109
u969848070
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["a = input()\nd = 'Heisei'\nif int(a[0:4]) ==2019:\n if int(a[5:7]) == 4:\n if int(a[8:10]) == 30:\n break\n elif int(a[8:10]) <30:\n d = 'TBD'\n else:\n break\n elif int(a[5:7]) <=3:\n d = 'TBD'\n else:\n break\nelif int(a[0:4]) <= 2018:\n d = 'TBD'\nelse:\n break\nprint(d)", "a = input()\nd = 'TBD'\nif int(a[0:4]) ==2019:\n if int(a[5:7]) == 4:\n if int(a[8:10]) <=30:\n d = 'Heisei'\n elif int(a[5:7]) <=3:\n d = 'Heisei'\nelif int(a[0:4]) <= 2018:\n d = 'Heisei'\nprint(d)"]
['Runtime Error', 'Accepted']
['s782417842', 's437724353']
[2940.0, 3060.0]
[17.0, 17.0]
[291, 203]
p03109
u971091945
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['s = input()\n\nif int(s[6])<4:\n ans = "TBD"\nelif int(s[6]) == 4:\n if int(s[8])<3:\n ans = "Heisei"\n else:\n ans = "TBD"\nelse:\n ans = "Heisei"\n\nprint(ans)', 's = input()\n\nif int(s[6])<4:\n ans = "Heisei"\nelif int(s[6]) == 4:\n if int(s[8])<3:\n ans = "Heisei"\n else:\n ans = "TBD"\nelse:\n ans = "TBD"\n\nprint(ans)', 's = input()\n\nif int(s[5]) == 0 and int(s[6])<=4:\n ans = "Heisei"\nelse:\n ans = "TBD"\n\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s901976210', 's985165727', 's971561551']
[3060.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0]
[175, 175, 101]
p03109
u972658925
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['Y, M, D = list(map(int, input().split("/")))\ns = \'\'.join([Y,M,D])\n\nif s>20190430:\n print("TBD")\nelse:\n print("Heisei")', 's = input()\nss = s.split(\'/\')\nsss = \'\'.join(ss)\n\nif sss>20190430:\n print("TBD")\nelse:\n print("Heisei")', 'Y, M, D = list(map(int, input().split("/")))\ns = \'\'.join([Y,M,D])\n\nif int(s)>20190430:\n print("TBD")\nelse:\n print("Heisei")\n', 's = \'\'.join(input().split(\'/\'))\nif s>20190430:\n print("TBD")\nelse:\n print("Heisei")', 's = input()\nss = s.replase(\'/\',\'\')\n\nif ss>20190430:\n print("TBD")\nelse:\n print("Heisei")', 'Y, M, D = map(int, input().split("/"))\ns = \'\'.join([Y,M,D])\n\nif int(s)>20190430:\n print("TBD")\nelse:\n print("Heisei")\n', 's = input()\nss = s.aplit(\'/\')\nsss = \'\'.join(ss)\n\nif sss>20190430:\n print("TBD")\nelse:\n print("Heisei")', 'Y, M, D = map(str, input().split("/"))\ns = \'\'.join([Y,M,D])\n\nif int(s)>20190430:\n print("TBD")\nelse:\n print("Heisei")']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s347873745', 's627971045', 's676809194', 's720425415', 's751124167', 's756000976', 's758445351', 's185829164']
[2940.0, 3060.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0, 18.0, 17.0, 18.0, 17.0, 17.0]
[124, 108, 130, 89, 94, 124, 108, 123]
p03109
u972892985
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['s = input()\nif s[5::6] <= 04 and s[8::9] <= 30:\n print("Heisei")\nelse:\n print("TBD")', 's = input()\nif s[0::3] <= "2019" and s[5::6] <= "04" and s[8::9] <= "30":\n print("Heisei")\nelse:\n print("TBD")', 's = input()\nif s[5::6] >= "04" and s[8::9] >= "30":\n print("Heisei")\nelse:\n print("TBD")', 's = int(input())\nif a[5]+a[6] > 4:\n print("Heisei")\nelse:\n print("TBD")\n', 's = input()\nif a[5]+a[6] > 4:\n print("Heisei")\nelse:\n print("TBD")', 's = input()\nif s <= "2019/04/30":\n print("Heisei")\nelse:\n print("TBD")']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s190039259', 's197337348', 's255667428', 's280607712', 's416284180', 's708174455']
[2940.0, 3060.0, 2940.0, 3060.0, 2940.0, 2940.0]
[17.0, 19.0, 17.0, 19.0, 19.0, 17.0]
[86, 112, 90, 74, 68, 72]
p03109
u975884051
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["S = str(input())\n\nlistS = S.split('/')\n\nif int(listS[0]) < 2019:\n print('Heisei')\nelif int(listS[0]) == 2019:\n print('a')\n if int(listS[1]) < 5:\n print('Heisei')\n else:\n print('TBD')\nelse:\n print('TBD')", "S = str(input())\n\nlistS = S.split('/')\n\nif int(listS[0]) < 2019:\n print('Heisei')\nelif int(listS[0]) == 2019:\n if int(listS[1]) < 5:\n print('Heisei')\n else:\n print('TBD')\nelse:\n print('TBD')"]
['Wrong Answer', 'Accepted']
['s360665332', 's079891648']
[3060.0, 3060.0]
[17.0, 17.0]
[231, 216]
p03109
u979060189
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["N = int(input())\nM = [[i for i in input().split()] for i in range(N)]\nC = 0\n\nfor i in range(N):\n if M[i][1] == 'JPY':\n C += int(M[i][0])\n elif M[i][1] == 'BTC':\n C += float(M[i][0])*380000\n\nprint(C)", "y, m ,d = map(int, input().split('/'))\n\nA = None\n\nif y > 2019 :\n A = 'TBD'\nelif m > 4 :\n A = 'TBD'\nelif d > 30 :\n A = 'TBD'\nelse:\n A = 'Heisei'\n \nprint(A)"]
['Runtime Error', 'Accepted']
['s830990321', 's728406822']
[3060.0, 2940.0]
[17.0, 18.0]
[218, 169]
p03109
u980492406
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
["S = input()\nif int(s[5]) == 0 and int(s[6]) <= 4 :\n print('Heisei')\nelse :\n print('TBD')", "s = input()\nif int(s[5]) == 0 and int(s[6]) <= 4 :\n print('Heisei')\nelse :\n print('TBD')"]
['Runtime Error', 'Accepted']
['s383034151', 's530194378']
[2940.0, 2940.0]
[17.0, 17.0]
[94, 94]
p03109
u989348352
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['a, b, c = [int(i) for i in input().split("/")]\nif a >= 2019:\n if b >= 4:\n if c >=30:\n print("TBD")\n else:\n print("Heisei")\n else:\n print("Heisei")\nelse:\n print("Heisei")\n', 'a, b, c = [int(i) for i in input().split("/")]\nif a == 2019 and b > 4:\n print("TBD")\nelse:\n print("Heisei")']
['Wrong Answer', 'Accepted']
['s861201827', 's175987962']
[2940.0, 2940.0]
[17.0, 17.0]
[222, 113]
p03109
u991974907
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['S = input()\n\nA = S.split(\'/\')\n\nif int(A[0]) <= 2019 and int(A[1]) <= 4:\n print("heisei")\nelse:\n print("TBD")\n ', 'S = input()\n\nA = S.split(\'/\')\n\nif int(A[0]) == 2019 and int(A[1]) <= 4:\n print("heisei")\nelif int(A[0]) < 2019:\n print("heisei")\nelse:\n print("TBD")\n \n', 'S = input()\n\nA = S.split(\'/\')\n\nif int(A[0]) == 2019 and int(A[1]) <= 4:\n print("Heisei")\nelif int(A[0]) < 2019:\n print("Heisei")\nelse:\n print("TBD")\n \n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s451368957', 's839044565', 's149550438']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[115, 157, 157]
p03109
u993412772
2,000
1,048,576
You are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.) Write a program that prints `Heisei` if the date represented by S is not later than April 30, 2019, and prints `TBD` otherwise.
['a = list(map(int,input().split("/"))\n\nif a[0]>= 2019:\n print("Heisei")\nelse:\n print("TBD")\n\n', 'a = list(map(int,input().split("/"))\n\nif a[0]>= 2019\n print("Heisei")\nelse:\n print("TBD")\n', 'a = list(map(int,input().split())\n\ndel a[4]\ndel a[7]\n\nb =sum(a)\nq = 19\nif q <=a:\n print("Heisei")\nelse :\n print("TBD")', 'a = list(map(int,input().split("/"))\n\nif a[0]== 2019 and a[1]<=430 or a[0]<2019 :\n print(\'Heisei\')\nelse:\n print(\'TBD\')', 'a = list(map(int,input().split("/")))\n\n\n\nif a[0]== 2019 and a[1]<5:\n print("Heisei")\nelif a[0]<2019 and a[1]< 12:\n print("Heisei")\nelse:\n print("TBD")']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s406059643', 's704822814', 's901952782', 's907652324', 's102645182']
[2940.0, 2940.0, 2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[98, 97, 124, 123, 159]
p03111
u011634450
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF = 10 ** 9\ndef dfs(cur, a, b, c):\n\tif cur == N:\n\treturn abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF\n\tret0 = dfs(cur + 1, a, b, c)\n\tret1 = dfs(cur + 1, a + l[cur], b, c) + 10\n\tret2 = dfs(cur + 1, a, b + l[cur], c) + 10\n\tret3 = dfs(cur + 1, a, b, c + l[cur]) + 10\n\treturn min(ret0, ret1, ret2, ret3)\nprint(dfs(0, 0, 0, 0))', 'N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF = 10 ** 9\ndef dfs(cur, a, b, c):\n\tif cur == N:\n\t\treturn abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF\n\tret0 = dfs(cur + 1, a, b, c)\n\tret1 = dfs(cur + 1, a + l[cur], b, c) + 10\n\tret2 = dfs(cur + 1, a, b + l[cur], c) + 10\n\tret3 = dfs(cur + 1, a, b, c + l[cur]) + 10\n\treturn min(ret0, ret1, ret2, ret3)\nprint(dfs(0, 0, 0, 0))']
['Runtime Error', 'Accepted']
['s937889014', 's170200342']
[2940.0, 3064.0]
[17.0, 73.0]
[426, 427]
p03111
u013408661
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['n,a,b,c=map(int,input().split())\nlength=[]\nfor i in range(n):\n k=int(input())\n length.append(k)\nlength=sorted(length)\nx=[0,1,2,3]\nans=[]\nif len(length)==3:\n for p in x:\n for q in x:\n for r in x:\n value=0\n a_length=0\n b_length=0\n c_length=0\n line=[p,q,r]\n if line.count(1)==0:\n break\n if line.count(2)==0:\n break\n if line.count(3)==0:\n break\n if line.count(1)>1:\n value+=10*(line.count(1)-1)\n if line.count(2)>1:\n value+=10*(line.count(2)-1)\n if line.count(3)>1:\n value+=10*(line.count(3)-1)\n A=[i for i, y in enumerate(line) if y ==1]\n B=[i for i, y in enumerate(line) if y ==2]\n C=[i for i, y in enumerate(line) if y ==3]\n for i in A:\n a_length+=length[i]\n for i in B:\n b_length+=length[i]\n for i in C:\n c_length+=length[i]\n value+=abs(a-a_length)\n value+=abs(b-b_length)\n value+=abs(c-c_length)\n ans.append(value)\nif len(length)==4:\n for p in x:\n for q in x:\n for r in x:\n for s in x:\n value=0\n a_length=0\n b_length=0\n c_length=0\n line=[p,q,r,s]\n if line.count(1)==0:\n break\n if line.count(2)==0:\n break\n if line.count(3)==0:\n break\n if line.count(1)>1:\n value+=10*(line.count(1)-1)\n if line.count(2)>1:\n value+=10*(line.count(2)-1)\n if line.count(3)>1:\n value+=10*(line.count(3)-1)\n A=[i for i, y in enumerate(line) if y ==1]\n B=[i for i, y in enumerate(line) if y ==2]\n C=[i for i, y in enumerate(line) if y ==3]\n for i in A:\n a_length+=length[i]\n for i in B:\n b_length+=length[i]\n for i in C:\n c_length+=length[i]\n value+=abs(a-a_length)\n value+=abs(b-b_length)\n value+=abs(c-c_length)\n ans.append(value)\nif len(length)==5:\n for p in x:\n for q in x:\n for r in x:\n for s in x:\n for t in x:\n value=0\n a_length=0\n b_length=0\n c_length=0\n line=[p,q,r,s,t]\n if line.count(1)==0:\n break\n if line.count(2)==0:\n break\n if line.count(3)==0:\n break\n if line.count(1)>1:\n value+=10*(line.count(1)-1)\n if line.count(2)>1:\n value+=10*(line.count(2)-1)\n if line.count(3)>1:\n value+=10*(line.count(3)-1)\n A=[i for i, y in enumerate(line) if y ==1]\n B=[i for i, y in enumerate(line) if y ==2]\n C=[i for i, y in enumerate(line) if y ==3]\n for i in A:\n a_length+=length[i]\n for i in B:\n b_length+=length[i]\n for i in C:\n c_length+=length[i]\n value+=abs(a-a_length)\n value+=abs(b-b_length)\n value+=abs(c-c_length)\n ans.append(value)\nif len(length)==6:\n for p in x:\n for q in x:\n for r in x:\n for s in x:\n for t in x:\n for u in x:\n value=0\n a_length=0\n b_length=0\n c_length=0\n line=[p,q,r,s,t,u]\n if line.count(1)==0:\n break\n if line.count(2)==0:\n break\n if line.count(3)==0:\n break\n if line.count(1)>1:\n value+=10*(line.count(1)-1)\n if line.count(2)>1:\n value+=10*(line.count(2)-1)\n if line.count(3)>1:\n value+=10*(line.count(3)-1)\n A=[i for i, y in enumerate(line) if y ==1]\n B=[i for i, y in enumerate(line) if y ==2]\n C=[i for i, y in enumerate(line) if y ==3]\n for i in A:\n a_length+=length[i]\n for i in B:\n b_length+=length[i]\n for i in C:\n c_length+=length[i]\n value+=abs(a-a_length)\n value+=abs(b-b_length)\n value+=abs(c-c_length)\n ans.append(value)\nif len(length)==7:\n for p in x:\n for q in x:\n for r in x:\n for s in x:\n for t in x:\n for u in x:\n for v in x:\n value=0\n a_length=0\n b_length=0\n c_length=0\n line=[p,q,r,s,t,u,v]\n if line.count(1)==0:\n break\n if line.count(2)==0:\n break\n if line.count(3)==0:\n break\n if line.count(1)>1:\n value+=10*(line.count(1)-1)\n if line.count(2)>1:\n value+=10*(line.count(2)-1)\n if line.count(3)>1:\n value+=10*(line.count(3)-1)\n A=[i for i, y in enumerate(line) if y ==1]\n B=[i for i, y in enumerate(line) if y ==2]\n C=[i for i, y in enumerate(line) if y ==3]\n for i in A:\n a_length+=length[i]\n for i in B:\n b_length+=length[i]\n for i in C:\n c_length+=length[i]\n value+=abs(a-a_length)\n value+=abs(b-b_length)\n value+=abs(c-c_length)\n ans.append(value)\nif len(length)==8:\n for p in x:\n for q in x:\n for r in x:\n for s in x:\n for t in x:\n for u in x:\n for v in x:\n for w in x:\n value=0\n a_length=0\n b_length=0\n c_length=0\n line=[p,q,r,s,t,u,v,w]\n if line.count(1)==0:\n break\n if line.count(2)==0:\n break\n if line.count(3)==0:\n break\n if line.count(1)>1:\n value+=10*(line.count(1)-1)\n if line.count(2)>1:\n value+=10*(line.count(2)-1)\n if line.count(3)>1:\n value+=10*(line.count(3)-1)\n A=[i for i, y in enumerate(line) if y ==1]\n B=[i for i, y in enumerate(line) if y ==2]\n C=[i for i, y in enumerate(line) if y ==3]\n for i in A:\n a_length+=length[i]\n for i in B:\n b_length+=length[i]\n for i in C:\n c_length+=length[i]\n value+=abs(a-a_length)\n value+=abs(b-b_length)\n value+=abs(c-c_length)\n ans.append(value)\nprint(min(ans))', 'n,a,b,c=map(int,input().split())\nlength=[]\nfor i in range(n):\n k=int(input())\n length.append(k)\nlength=sorted(length)\nx=[0,1,2,3]\nans=[]\nfor p in x:\n for q in x:\n for r in x:\n for s in x:\n for t in x:\n for u in x:\n for v in x:\n for w in x:\n value=0\n a_length=0\n b_length=0\n c_length=0\n line=[p,q,r,s,t,u,v,w]\n line.count(1)>1:\n value+=10*line.count(1)\n line.count(2)>1:\n value+=10*line.count(1)\n line.count(3)>1:\n value+=10*line.count(1)\n A=[i for i, y in enumerate(length) if y ==1]\n B=[i for i, y in enumerate(length) if y ==2]\n C=[i for i, y in enumerate(length) if y ==3]\n for i in A:\n a_length+=length[i]\n for i in B:\n b_length+=length[i]\n for i in C:\n c_length+=length[i]\n value+=abs(a-a_length)\n value+=abs(b-b_length)\n value+=abs(c-c_length)\n ans.append(value)\nprint(min(ans))\n ', 'n,a,b,c=map(int,input().split())\nlength=[]\npoint=0\nfor i in range(n):\n k=int(input())\n length.append(k)\nlength=sorted(length)\ndef mp_1(k):\n length_1=0\n ans=11\n for i in length:\n if k-10<=i<=k+10:\n if abs(k-i)<ans:\n length=i\n if length_1 in length:\n length.remove(length_1)\n return ans\ndef mp_2(k):\n count=0\n for i in length:\n if k>length:\n count=1\n break\n else:\n pass\n if count!=0:\n return 0\n else:\n return 1\ndef mp_3(k):\n map=[]\n for i in length:\n if k>length:\n map.append(length)\n else:\n pass\n return map\nfor i in [c,b,a]:\n if mp_1(i)!=11:\n point+=mp_1\n elif mp_2(i)==1:\n point+=abs(k-length.pop(0))\n else:\n for i in mp_3(i):\n for m in mp_3(i).pop(index(i)):\n if i+m==k:\n point+=10\nprint(point)', 'n,a,b,c=map(int,input().split())\nlength=[]\nfor i in range(n):\n k=int(input())\n length.append(k)\nlength=sorted(length)\nx=[0,1,2,3]\nans=[]\nif len(length)==3:\n for p in x:\n for q in x:\n for r in x:\n value=0\n a_length=0\n b_length=0\n c_length=0\n line=[p,q,r]\n if line.count(1)==0:\n value+=10*18\n if line.count(2)==0:\n value+=10*18\n if line.count(3)==0:\n value+=10*18\n if line.count(1)>1:\n value+=10*(line.count(1)-1)\n if line.count(2)>1:\n value+=10*(line.count(2)-1)\n if line.count(3)>1:\n value+=10*(line.count(3)-1)\n A=[i for i, y in enumerate(line) if y ==1]\n B=[i for i, y in enumerate(line) if y ==2]\n C=[i for i, y in enumerate(line) if y ==3]\n for i in A:\n a_length+=length[i]\n for i in B:\n b_length+=length[i]\n for i in C:\n c_length+=length[i]\n value+=abs(a-a_length)\n value+=abs(b-b_length)\n value+=abs(c-c_length)\n ans.append(value)\nif len(length)==4:\n for p in x:\n for q in x:\n for r in x:\n for s in x:\n value=0\n a_length=0\n b_length=0\n c_length=0\n line=[p,q,r,s]\n if line.count(1)==0:\n value+=10*18\n if line.count(2)==0:\n value+=10*18\n if line.count(3)==0:\n value+=10*18\n if line.count(1)>1:\n value+=10*(line.count(1)-1)\n if line.count(2)>1:\n value+=10*(line.count(2)-1)\n if line.count(3)>1:\n value+=10*(line.count(3)-1)\n A=[i for i, y in enumerate(line) if y ==1]\n B=[i for i, y in enumerate(line) if y ==2]\n C=[i for i, y in enumerate(line) if y ==3]\n for i in A:\n a_length+=length[i]\n for i in B:\n b_length+=length[i]\n for i in C:\n c_length+=length[i]\n value+=abs(a-a_length)\n value+=abs(b-b_length)\n value+=abs(c-c_length)\n ans.append(value)\nif len(length)==5:\n for p in x:\n for q in x:\n for r in x:\n for s in x:\n for t in x:\n value=0\n a_length=0\n b_length=0\n c_length=0\n line=[p,q,r,s,t]\n if line.count(1)==0:\n value+=10*18\n if line.count(2)==0:\n value+=10*18\n if line.count(3)==0:\n value+=10*18\n if line.count(1)>1:\n value+=10*(line.count(1)-1)\n if line.count(2)>1:\n value+=10*(line.count(2)-1)\n if line.count(3)>1:\n value+=10*(line.count(3)-1)\n A=[i for i, y in enumerate(line) if y ==1]\n B=[i for i, y in enumerate(line) if y ==2]\n C=[i for i, y in enumerate(line) if y ==3]\n for i in A:\n a_length+=length[i]\n for i in B:\n b_length+=length[i]\n for i in C:\n c_length+=length[i]\n value+=abs(a-a_length)\n value+=abs(b-b_length)\n value+=abs(c-c_length)\n ans.append(value)\nif len(length)==6:\n for p in x:\n for q in x:\n for r in x:\n for s in x:\n for t in x:\n for u in x:\n value=0\n a_length=0\n b_length=0\n c_length=0\n line=[p,q,r,s,t,u]\n if line.count(1)==0:\n value+=10*18\n if line.count(2)==0:\n value+=10*18\n if line.count(3)==0:\n value+=10*18\n if line.count(1)>1:\n value+=10*(line.count(1)-1)\n if line.count(2)>1:\n value+=10*(line.count(2)-1)\n if line.count(3)>1:\n value+=10*(line.count(3)-1)\n A=[i for i, y in enumerate(line) if y ==1]\n B=[i for i, y in enumerate(line) if y ==2]\n C=[i for i, y in enumerate(line) if y ==3]\n for i in A:\n a_length+=length[i]\n for i in B:\n b_length+=length[i]\n for i in C:\n c_length+=length[i]\n value+=abs(a-a_length)\n value+=abs(b-b_length)\n value+=abs(c-c_length)\n ans.append(value)\nif len(length)==7:\n for p in x:\n for q in x:\n for r in x:\n for s in x:\n for t in x:\n for u in x:\n for v in x:\n value=0\n a_length=0\n b_length=0\n c_length=0\n line=[p,q,r,s,t,u,v]\n if line.count(1)==0:\n value+=10*18\n if line.count(2)==0:\n value+=10*18\n if line.count(3)==0:\n value+=10*18\n if line.count(1)>1:\n value+=10*(line.count(1)-1)\n if line.count(2)>1:\n value+=10*(line.count(2)-1)\n if line.count(3)>1:\n value+=10*(line.count(3)-1)\n A=[i for i, y in enumerate(line) if y ==1]\n B=[i for i, y in enumerate(line) if y ==2]\n C=[i for i, y in enumerate(line) if y ==3]\n for i in A:\n a_length+=length[i]\n for i in B:\n b_length+=length[i]\n for i in C:\n c_length+=length[i]\n value+=abs(a-a_length)\n value+=abs(b-b_length)\n value+=abs(c-c_length)\n ans.append(value)\nif len(length)==8:\n for p in x:\n for q in x:\n for r in x:\n for s in x:\n for t in x:\n for u in x:\n for v in x:\n for w in x:\n value=0\n a_length=0\n b_length=0\n c_length=0\n line=[p,q,r,s,t,u,v,w]\n if line.count(1)==0:\n value+=10*18\n if line.count(2)==0:\n value+=10*18\n if line.count(3)==0:\n value+=10*18\n if line.count(1)>1:\n value+=10*(line.count(1)-1)\n if line.count(2)>1:\n value+=10*(line.count(2)-1)\n if line.count(3)>1:\n value+=10*(line.count(3)-1)\n A=[i for i, y in enumerate(line) if y ==1]\n B=[i for i, y in enumerate(line) if y ==2]\n C=[i for i, y in enumerate(line) if y ==3]\n for i in A:\n a_length+=length[i]\n for i in B:\n b_length+=length[i]\n for i in C:\n c_length+=length[i]\n value+=abs(a-a_length)\n value+=abs(b-b_length)\n value+=abs(c-c_length)\n ans.append(value)\nprint(min(ans))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s288091805', 's634115781', 's941760523', 's797040617']
[4888.0, 3064.0, 3064.0, 5928.0]
[300.0, 17.0, 17.0, 449.0]
[7682, 1224, 812, 7808]
p03111
u013629972
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['# g = [1000, 800, 100]\n#takes = [300, 333, 400, 444, 500, 555, 600, 666]\n#g = [100, 90, 80]\n#takes = [100, 100, 90,90,90,80,80,80]\n\n\nN,A,B,C = [int(input()) for i in range(0,4)]\ng=[A, B, C]\ntakes =[]\nfor i in range(N):\n takes.append(int(input())\ncombis = []\nfor i in range(4):\n\xa0 \xa0 for j in range(4):\n\xa0 \xa0 \xa0 \xa0 for k in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for l in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for m in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for n in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for o in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for p in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 combis.append([i,j,k,l,m,n,o,p])\n\nmin_diff = 10**10\nfor combi in combis:\n\xa0 \xa0 A,B,C = 0,0,0\n\xa0 \xa0 for idx, el in enumerate(combi):\n\xa0 \xa0 \xa0 \xa0 if el == 0:\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 A += takes[idx]\n\xa0 \xa0 \xa0 \xa0 elif el == 1:\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 B += takes[idx]\n\xa0 \xa0 \xa0 \xa0 elif el == 2:\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 C += takes[idx]\n\n\xa0 \xa0 \xa0 \xa0 if A == 0 or B == 0 or C == 0:\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 continue\n\n\xa0 \xa0 \xa0 \xa0 A_diff = abs(g[0] - A) + (len([_ for _ in combi if _ == 0]) - 1)*10\n\xa0 \xa0 \xa0 \xa0 B_diff = abs(g[1] - B) + (len([_ for _ in combi if _ == 1]) - 1)*10\n\xa0 \xa0 \xa0 \xa0 C_diff = abs(g[2] - C) + (len([_ for _ in combi if _ == 2]) - 1)*10\n\xa0 \xa0 \xa0 \xa0 diff = A_diff + B_diff + C_diff\n\xa0 \xa0 \xa0 \xa0 min_diff = min(diff, min_diff)\n\nprint(minq_diff)\n', 'N, A, B, C = map(int, input().split())\ntakes = []\nfor i in range(N):\n\xa0 \xa0 takes.append(int(input()))\n\ntakes = takes+[0,0,0,0,0,0,0]\ntakes = takes[:8]\ng = [A, B, C]\ncombis = []\nfor i in range(4):\n\xa0 \xa0 for j in range(4):\n\xa0 \xa0 \xa0 \xa0 for k in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for l in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for m in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for n in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for o in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for p in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 combis.append([i,j,k,l,m,n,o,p])\nmin_diff = 10**10\nfor combi in combis:\n\xa0 \xa0 A,B,C = 0,0,0\n\xa0 \xa0 for idx, el in enumerate(combi):\n\xa0 \xa0 \xa0 \xa0 if el == 0:\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 A += takes[idx]\n\xa0 \xa0 \xa0 \xa0 elif el == 1:\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 B += takes[idx]\n\xa0 \xa0 \xa0 \xa0 elif el == 2:\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 C += takes[idx]\n\n\xa0 \xa0 \xa0 \xa0 if A == 0 or B == 0 or C == 0:\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 continue\n\n\xa0 \xa0 \xa0 \xa0 A_diff = abs(g[0] - A) + (len([_ for _ in combi if _ == 0]) - 1)*10\n\xa0 \xa0 \xa0 \xa0 B_diff = abs(g[1] - B) + (len([_ for _ in combi if _ == 1]) - 1)*10\n\xa0 \xa0 \xa0 \xa0 C_diff = abs(g[2] - C) + (len([_ for _ in combi if _ == 2]) - 1)*10\n\xa0 \xa0 \xa0 \xa0 diff = A_diff + B_diff + C_diff\n\xa0 \xa0 \xa0 \xa0 min_diff = min(diff, min_diff)\n\nprint(min_diff)\n', '# g = [1000, 800, 100]\n#takes = [300, 333, 400, 444, 500, 555, 600, 666]\n#g = [100, 90, 80]\n#takes = [100, 100, 90,90,90,80,80,80]\n\n\nN,A,B,C = map(int, input().split())\ng=[A, B, C]\ntakes =[]\nfor i in range(N):\n takes.append(int(input())\ncombis = []\nfor i in range(4):\n\xa0 \xa0 for j in rang e(4):\n\xa0 \xa0 \xa0 \xa0 for k in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for l in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for m in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for n in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for o in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 for p in range(4):\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 combis.append([i,j,k,l,m,n,o,p])\n\nmin_diff = 10**10\nfor combi in combis:\n\xa0 \xa0 A,B,C = 0,0,0\n\xa0 \xa0 for idx, el in enumerate(combi):\n\xa0 \xa0 \xa0 \xa0 if el == 0:\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 A += takes[idx]\n\xa0 \xa0 \xa0 \xa0 elif el == 1:\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 B += takes[idx]\n\xa0 \xa0 \xa0 \xa0 elif el == 2:\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 C += takes[idx]\n\n\xa0 \xa0 \xa0 \xa0 if A == 0 or B == 0 or C == 0:\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 continue\n\n\xa0 \xa0 \xa0 \xa0 A_diff = abs(g[0] - A) + (len([_ for _ in combi if _ == 0]) - 1)*10\n\xa0 \xa0 \xa0 \xa0 B_diff = abs(g[1] - B) + (len([_ for _ in combi if _ == 1]) - 1)*10\n\xa0 \xa0 \xa0 \xa0 C_diff = abs(g[2] - C) + (len([_ for _ in combi if _ == 2]) - 1)*10\n\xa0 \xa0 \xa0 \xa0 diff = A_diff + B_diff + C_diff\n\xa0 \xa0 \xa0 \xa0 min_diff = min(diff, min_diff)\n\nprint(minq_diff)\n', 'N, A, B, C = map(int, input().split())\ntakes = []\nfor i in range(N):\n takes.append(int(input()))\n\ntakes = takes+[0,0,0,0,0,0,0]\ntakes = takes[:8]\ng = [A, B, C]\ncombis = []\nfor i in range(4):\n for j in range(4):\n for k in range(4):\n for l in range(4):\n for m in range(4):\n for n in range(4):\n for o in range(4):\n for p in range(4):\n combis.append([i,j,k,l,m,n,o,p])\n\nmin_diff = 10**10\nfor combi in combis:\n A,B,C = 0,0,0\n for idx, el in enumerate(combi):\n if el == 0:\n A += takes[idx]\n elif el == 1:\n B += takes[idx]\n elif el == 2:\n C += takes[idx]\n\n if A == 0 or B == 0 or C == 0:\n continue\n\n A_diff = abs(g[0] - A) + (len([_ for _ in combi if _ == 0]) - 1)*10\n B_diff = abs(g[1] - B) + (len([_ for _ in combi if _ == 1]) - 1)*10\n C_diff = abs(g[2] - C) + (len([_ for _ in combi if _ == 2]) - 1)*10\n diff = A_diff + B_diff + C_diff\n min_diff = min(diff, min_diff)\n\nprint(min_diff)\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s041312162', 's316445646', 's333995826', 's692434194']
[2940.0, 2940.0, 2940.0, 12788.0]
[18.0, 17.0, 18.0, 746.0]
[1506, 1270, 1498, 1133]
p03111
u028217518
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['read = input\nread = Read(False, """\n\n\n8 1000 800 100\n300\n333\n400\n444\n500\n555\n600\n666\n\n""").read\ntmp = read()\ntmp = list(map(int, tmp.split(\' \')))\nN,A,B,C = tmp\nopt = list(map(int, map(lambda x: read(), range(N))))\ndef dfs(n,a,b,c):\n ret = 10**7\n if(n == N):\n if(min(a,b,c) == 0):\n return ret\n return abs(A - a) + abs(B - b) + abs(C - c) - 30\n cur = opt[n]\n ret = min(ret, dfs(n+1, a + cur, b, c) + 10)\n ret = min(ret, dfs(n+1, a, b + cur, c) + 10)\n ret = min(ret, dfs(n+1, a, b ,c + cur) + 10)\n ret = min(ret, dfs(n+1, a, b ,c ) + 0)\n return ret\nprint(dfs(0, 0, 0, 0))', 'read = input\n# read = Read(False, """\n\n\n# 8 1000 800 100\n# 300\n# 333\n# 400\n# 444\n# 500\n# 555\n# 600\n# 666\n\n# """).read\ntmp = read()\ntmp = list(map(int, tmp.split(\' \')))\nN,A,B,C = tmp\nopt = list(map(int, map(lambda x: read(), range(N))))\ndef dfs(n,a,b,c):\n ret = 10**7\n if(n == N):\n if(min(a,b,c) == 0):\n return ret\n return abs(A - a) + abs(B - b) + abs(C - c) - 30\n cur = opt[n]\n ret = min(ret, dfs(n+1, a + cur, b, c) + 10)\n ret = min(ret, dfs(n+1, a, b + cur, c) + 10)\n ret = min(ret, dfs(n+1, a, b ,c + cur) + 10)\n ret = min(ret, dfs(n+1, a, b ,c ) + 0)\n return ret\nprint(dfs(0, 0, 0, 0))']
['Runtime Error', 'Accepted']
['s530063194', 's906945384']
[3064.0, 3064.0]
[17.0, 82.0]
[617, 639]
p03111
u030626972
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['def main():\n minmp = 10000000\n def dfs(depth, pt):\n\n if depth==n:\n mp_tmp = 0\n all_used = True\n for k in range(3):\n if pt.count(k) == 0:\n all_used = False\n break\n\n sum_tmp = 0\n mp_tmp += (pt.count(k) - 1)*10\n for l in range(n):\n if pt[l] == k:\n sum_tmp += moto[l]\n \n mp_tmp += abs(sum_tmp-take[k])\n\n if all_used == True:\n global minmp\n minmp = min(minmp,mp_tmp)\n return\n else:\n return\n\n for i in range(4):\n pt[depth] = i\n dfs(depth+1, pt)\n\n return\n\n \n n,a,b,c = map(int,input().split())\n moto = [int(input()) for i in range(n)]\n\n\n take = []\n take.append(a)\n take.append(b)\n take.append(c)\n\n pt = [3]*n\n for i in range(n):\n dfs(i,pt)\n\n print(minmp)\n\nmain()', 'minmp = 10000000\ndef main():\n def dfs(depth, pt):\n\n \n if depth==n:\n mp_tmp = 0\n all_used = True\n for k in range(3):\n if pt.count(k) == 0:\n all_used = False\n break\n\n sum_tmp = 0\n mp_tmp += (pt.count(k) - 1)*10\n for l in range(n):\n if pt[l] == k:\n sum_tmp += moto[l]\n \n mp_tmp += abs(sum_tmp-take[k])\n\n if all_used == True:\n global minmp\n minmp = min(minmp,mp_tmp)\n \n return\n\n \n for i in range(4):\n pt[depth] = i\n dfs(depth+1, pt)\n\n return\n\n \n take = [0]*3\n n,take[0],take[1],take[2] = map(int,input().split())\n moto = [int(input()) for i in range(n)]\n\n pt = [3]*n\n for i in range(n):\n dfs(i,pt)\n\n print(minmp)\n\nmain()']
['Runtime Error', 'Accepted']
['s141272320', 's336195633']
[3064.0, 3064.0]
[18.0, 382.0]
[1043, 1060]
p03111
u037221289
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
["N, A, B, C = map(int, input().split(' '))\nL = [int(input()) for i in range(N)]\n\nMAX = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else MAX\n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur + 1, a + L[cur], b, c) + 10\n ret2 = dfs(cur + 1, a, b + L[cur], c) + 10\n ret3 = dfs(cur + 1, a, b, c + L[cur]) + 10\n print(ret0,ret1,ret2,ret3)\n return min(ret0,ret1,ret2,ret3)\nprint(dfs(0, 0, 0, 0))", "N, A, B, C = map(int, input().split(' '))\nL = [int(input()) for i in range(N)]\n\nMAX = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else MAX\n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur + 1, a + l[cur], b, c) + 10\n ret2 = dfs(cur + 1, a, b + l[cur], c) + 10\n ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10\n print(ret0,ret1,ret2,ret3)\n return min(ret0,ret1,ret2,ret3)\nprint(dfs(0, 0, 0, 0))", "N, A, B, C = map(int, input().split(' '))\nL = [int(input()) for i in range(N)]\n\nMAX = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else MAX\n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur + 1, a + L[cur], b, c) + 10\n ret2 = dfs(cur + 1, a, b + L[cur], c) + 10\n ret3 = dfs(cur + 1, a, b, c + L[cur]) + 10\n return min(ret0,ret1,ret2,ret3)\nprint(dfs(0, 0, 0, 0))"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s192511202', 's990717544', 's499264298']
[3924.0, 3064.0, 3064.0]
[120.0, 18.0, 72.0]
[487, 487, 458]
p03111
u047023156
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['import sys\nfrom collections import deque\ninput = sys.stdin.readline\n\nN, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF = 10**9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n if min(a, b, c) > 0:\n return abs(a-A) + abs(b-B) + abs(c-C) - 30\u3000\n else:\n return INF \n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur + 1, a + l[cur], b, c) + 10\n ret2 = dfs(cur + 1, a, b + l[cur], c) + 10\n ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10\n return min(ret0, ret1, ret2, ret3)\n\nprint(dfs(0, 0, 0, 0))', 'import sys\nfrom collections import deque\ninput = sys.stdin.readline\n\nN, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF = 10**9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n if min(a, b, c) > 0:\n return abs(a-A) + abs(b-B) + abs(c-C) - 30 \n else:\n return INF \n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur + 1, a + l[cur], b, c) + 10\n ret2 = dfs(cur + 1, a, b + l[cur], c) + 10\n ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10\n return min(ret0, ret1, ret2, ret3)\n\nprint(dfs(0, 0, 0, 0))']
['Runtime Error', 'Accepted']
['s347355519', 's011275806']
[2940.0, 3316.0]
[17.0, 79.0]
[601, 599]
p03111
u052499405
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['N, A, B, C = [int(item) for item in input().split()]\n\ntake = [int(input()) for i in range(N)]\n\ndef dfs(n, a, b, c):\n if n == N:\n return abs(a - A) + abs(b - B) + abs(c - C) if min(a, b, c) > 0 else 10**9\n ret0 = dfs(n+1, a+take[n], b, c)\n ret1 = dfs(n+1, a, b+take[n], c)\n ret2 = dfs(n+1, a, b, c+take[n])\n ret3 = dfs(n+1, a, b, c)\n return min(ret0, ret1, ret2, ret3)\n\nans = dfs(0, 0, 0, 0)\nprint(ans)', 'N, A, B, C = [int(item) for item in input().split()]\n\ntake = [int(input()) for i in range(N)]\n\ndef dfs(n, a, b, c):\n if n == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else 10**9\n ret0 = dfs(n+1, a+take[n], b, c) + 10\n ret1 = dfs(n+1, a, b+take[n], c) + 10\n ret2 = dfs(n+1, a, b, c+take[n]) + 10\n ret3 = dfs(n+1, a, b, c)\n return min(ret0, ret1, ret2, ret3)\n\nans = dfs(0, 0, 0, 0)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s567969021', 's712843746']
[3064.0, 3064.0]
[66.0, 72.0]
[410, 430]
p03111
u055941944
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['n,a,b,c=map(int,input().split())\nl=[]\nfor i in range(n):\n l.append(int(input()))\n\ndef solve(w,x,y,z):\n if w==n:\n if min(x,y,z)>0:\n return abs(x-a)+abs(y-b)+abs(z-c)-30\n else:\n return 10e4\n can0=solve(w+1,x,y,z)\n can1=solve(w+1,x+l[w],y,z)+10\n can2=solve(w+1,x,y+l[w],z)+10\n can3=solve(w+1,x,y,z+l[w])+10\n return min(can0,can1,can2,can3)\n\nprint(solve(0,0,0,0))\n', 'n,a,b,c=map(int,input().split())\nl=[]\nfor i in range(n):\n l.append(int(input()))\n\ndef solve(w,x,y,z):\n if w==n:\n if min(x,y,z)>0:\n return abs(x-a)+abs(y-b)+abs(z-c)-30\n else:\n return 10e4\n can0=solve(w+1,x,y,z)\n can1=solve(w+1,x+l[w],y,z)+10\n can2=solve(w+1,x,y+l[w],z)+10\n can3=solve(w+1,x,y,z+l[w])+10\n return min(can0,can1,can2,can3)\n\nprint(solve(0,0,0,0))\n']
['Wrong Answer', 'Accepted']
['s890639037', 's860767568']
[3064.0, 3188.0]
[18.0, 79.0]
[437, 417]
p03111
u065079240
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['\nN, len_A, len_B, len_C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nprint(l)\nans = 10 ** 9\npattern = 4 ** N\nA = [0] * pattern\nB = [0] * pattern\nC = [0] * pattern\ncost = [0] * pattern\nfor ite in range(pattern):\n ite_2 = 0\n ite_2 += ite\n A[ite], B[ite], C[ite] = [], [], []\n for j in range(N):\n if ite_2 % 4 == 0:\n A[ite].append(l[j])\n elif ite_2 % 4 == 1:\n B[ite].append(l[j])\n elif ite_2 % 4 == 2:\n C[ite].append(l[j])\n ite_2 = ite_2 // 4\n if len(A[ite]) == 0 or len(B[ite]) == 0 or len(C[ite]) == 0:\n continue\n len_A_magic, len_B_magic, len_C_magic = 0, 0, 0\n for p in A[ite]:\n len_A_magic += p\n for q in B[ite]:\n len_B_magic += q\n for r in C[ite]:\n len_C_magic += r\n cost[ite] += (len(A[ite]) - 1) * 10+abs(len_A-len_A_magic)\n cost[ite] += (len(B[ite]) - 1) * 10+abs(len_B-len_B_magic)\n cost[ite] += (len(C[ite]) - 1) * 10+abs(len_C-len_C_magic)\n if ans > cost[ite]:\n ans = cost[ite]\n\nprint(ans)\n', '\nN, len_A, len_B, len_C = map(int, input().split())\nl = [int(input()) for i in range(N)]\n\nans = 10 ** 9\npattern = 4 ** N\nA = [0] * pattern\nB = [0] * pattern\nC = [0] * pattern\ncost = [0] * pattern\nfor ite in range(pattern):\n ite_2 = 0\n ite_2 += ite\n A[ite], B[ite], C[ite] = [], [], []\n for j in range(N):\n if ite_2 % 4 == 0:\n A[ite].append(l[j])\n elif ite_2 % 4 == 1:\n B[ite].append(l[j])\n elif ite_2 % 4 == 2:\n C[ite].append(l[j])\n ite_2 = ite_2 // 4\n if len(A[ite]) == 0 or len(B[ite]) == 0 or len(C[ite]) == 0:\n continue\n len_A_magic, len_B_magic, len_C_magic = 0, 0, 0\n for p in A[ite]:\n len_A_magic += p\n for q in B[ite]:\n len_B_magic += q\n for r in C[ite]:\n len_C_magic += r\n cost[ite] += (len(A[ite]) - 1) * 10+abs(len_A-len_A_magic)\n cost[ite] += (len(B[ite]) - 1) * 10+abs(len_B-len_B_magic)\n cost[ite] += (len(C[ite]) - 1) * 10+abs(len_C-len_C_magic)\n if ans > cost[ite]:\n ans = cost[ite]\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s911011951', 's461034514']
[27508.0, 27492.0]
[484.0, 476.0]
[1126, 1096]
p03111
u070449185
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['N,A,B,C = map(int,input().split())\nl = [int(input()) for i in range(N)]\nINF = 10**9\n\ndef dfs(cur,a,b,c):\n if(cur == N):\n return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c)>0 else INF\n ret0 = dfs(cur+1, a, b, c)\n re1 = dfs(cur + 1, a + l[cur], b, c) + 10\n ret2 = dfs(cur + 1, a, b+l[cur],c)+10\n ret3 = dfs(cur + 1,a,b,c+l[cur])+10\n return min(ret0,ret1,ret2,ret3)\nprint(dfs(0,0,0,0))', 'N,A,B,C = map(int,input().split())\nl = [int(input()) for i in range(N)]\nINF = 100000000\ndef rec(i,a,b,c):\n if(i==N):\n return(abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else INF)\n ret0 = rec(i+1,a,b,c)\n ret1 = rec(i+1,a+l[i],b,c)+10\n ret2 = rec(i+1,a,b+l[i],c)+10\n ret3 = rec(i+1,a,b,c+l[i])+10\n return min(ret0,ret1,ret2,ret3)\nprint(rec(0,0,0,0))']
['Runtime Error', 'Accepted']
['s194398423', 's448574944']
[3188.0, 3064.0]
[19.0, 72.0]
[413, 374]
p03111
u077291787
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['# @hitstales \nn, *goals = list(map(int, input().split()))\nbamboos = list(map(int, [input().rstrip() for _ in range(n)]))\n\n\ndef get_best(li, goal):\n bam_mp_lis = {0: (-10, tuple())}\n li = sorted(li)\n for i, v in enumerate(li):\n tmp = bam_mp_lis.copy()\n for bam, (mp, lis) in tmp.items():\n b0 = bam + v\n m0 = mp + 10\n l0 = lis + (i,)\n if b0 not in bam_mp_lis or m0 < bam_mp_lis[b0][0]:\n bam_mp_lis[b0] = (m0, l0)\n del bam_mp_lis[0]\n best = 10 ** 9\n for bam, (mp, lis) in bam_mp_lis.items():\n cost = mp + abs(goal - bam)\n if cost < best:\n best = cost\n beslis = lis\n return best, beslis\n\n\nans = 10 ** 9\nfrom itertools import permutations\n\nfor junjo in permutations(goals):\n tmp = 0\n bambooo = bamboos.copy()\n for ju in junjo:\n if len(bambooo) == 0:\n tmp = 10 ** 9\n break\n be, beli = get_best(bambooo, ju)\n beli = sorted(beli, reverse=True)\n for beli0 in beli:\n del bambooo[beli0]\n tmp += be\n if tmp < ans:\n ans = tmp\n\nprint(ans)', '# ABC119C - Synthetic Kadomatsu\nimport sys\n\nsys.setrecursionlimit(10 ** 9)\n\n\ndef dfs(cur: int, x: int, y: int, z: int) -> int:\n if cur == N:\n if min(x, y, z):\n return abs(x - A) + abs(y - B) + abs(z - C) - 30\n else:\n return 1 << 60\n patterns = []\n patterns.append(dfs(cur + 1, x, y, z))\n patterns.append(dfs(cur + 1, x + L[cur], y, z) + 10)\n patterns.append(dfs(cur + 1, x, y + L[cur], z) + 10)\n patterns.append(dfs(cur + 1, x, y, z + L[cur]) + 10)\n return min(patterns)\n\n\ndef main():\n global N, A, B, C, L\n N, A, B, C, *L = map(int, open(0).read().split())\n ans = dfs(0, 0, 0, 0)\n print(ans)\n\n\nif __name__ == "__main__":\n main()']
['Wrong Answer', 'Accepted']
['s965714139', 's150958078']
[3064.0, 3064.0]
[31.0, 75.0]
[1141, 701]
p03111
u081823802
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['#coding:utf-8\nimport sys\n\nBAMB_NUM = 0\nBAMB_A = 0\nBAMB_B = 0\nBAMB_C = 0\nBAMB_LIST = []\n\ndef calcMP(idx, lenA, lenB, lenC):\n """\n calculate MP.\n """\n # when classified all bamboos\n if (idx == BAMB_NUM):\n # exists a zero length bamboo\n if (lenA <= 0 or lenB <= 0 or lenC <= 0):\n return sys.maxsize\n else:\n return abs(lenA - BAMB_A) + abs(lenB - BAMB_B) + abs(lenC - BAMB_C)\n \n # don\'t use idx-th bamboo\n mp = calcMP(idx + 1, lenA, lenB, lenC)\n\n # use idx-th bamboo\n mp = min(mp, calcMP(idx + 1, lenA + BAMB_LIST[idx], lenB, lenC) + (10 if BAMB_A > 0 else 0))\n mp = min(mp, calcMP(idx + 1, lenA, lenB + BAMB_LIST[idx], lenC) + (10 if BAMB_B > 0 else 0))\n mp = min(mp, calcMP(idx + 1, lenA, lenB, lenC + BAMB_LIST[idx]) + (10 if BAMB_C > 0 else 0))\n\n return mp\n\nif __name__ == "__main__":\n \n # requested bamboo lengths\n BAMB_NUM, BAMB_A, BAMB_B, BAMB_C = map(lambda x: int(x), input().split())\n # available bamboo lengths\n for bamb in range(BAMB_NUM):\n BAMB_LIST.append(int(input()))\n\n mp = calcMP(0, 0, 0, 0)\n print(mp)', '#coding:utf-8\nimport sys\n\nBAMB_NUM = 0\nBAMB_A = 0\nBAMB_B = 0\nBAMB_C = 0\nBAMB_LIST = []\n\ndef calcMP(int idx, int lenA, int lenB, int lenC):\n # classified all bamboos\n if (idx == BAMB_NUM):\n # exists a zero length bamboo\n if (lenA <= 0 or lenB <= 0 or lenC <= 0):\n return sys.maxsize\n return abs(lenA - BAMB_A) + abs(lenB - BAMB_B) + abs(lenc - BAMB_C)\n \n # don\'t use idx-th bamboo\n mp = calcMP(idx+1, lenA, lenB, lenC)\n\n # use idx-th bamboo\n mp = min(mp, calcMP(lenA + BAMB_LIST[idx], lenB, lenC) + (BAMB_A > 0 ? 10 : 0))\n mp = min(mp, calcMP(lenA, lenB + BAMB_LIST[idx], lenC) + (BAMB_B > 0 ? 10 : 0))\n mp = min(mp, calcMP(lenA, lenB, lenC + BAMB_LIST[idx]) + (BAMB_C > 0 ? 10 : 0))\n\n return mp\n\nif __name__ == "__main__":\n \n # requested bamboo lengths\n bamb_num, bambA, bambB, bambC = map(lambda x: int(x), input().split())\n # available bamboo lengths\n bamb_list = []\n for bamb in range(bamb_num):\n bamb_list.append(int(input()))\n\n mp = calcMP(0, 0, 0, 0)\n print(mp)', '#coding:utf-8\nimport sys\n\nBAMB_NUM = 0\nBAMB_A = 0\nBAMB_B = 0\nBAMB_C = 0\nBAMB_LIST = []\n\ndef calcMP(idx, lenA, lenB, lenC):\n """\n calculate MP.\n """\n # when classified all bamboos\n if (idx == BAMB_NUM):\n return abs(lenA - BAMB_A) + abs(lenB - BAMB_B) + abs(lenC - BAMB_C) - 30 if min(lenA, lenB, lenC) > 0 else sys.maxsize\n \n # don\'t use idx-th bamboo\n mp1 = calcMP(idx + 1, lenA, lenB, lenC)\n # use idx-th bamboo\n mp2 = calcMP(idx + 1, lenA + BAMB_LIST[idx], lenB, lenC) + 10\n mp3 = calcMP(idx + 1, lenA, lenB + BAMB_LIST[idx], lenC) + 10\n mp4 = calcMP(idx + 1, lenA, lenB, lenC + BAMB_LIST[idx]) + 10\n\n return min(mp1, mp2, mp3, mp4)\n\nif __name__ == "__main__":\n \n # requested bamboo lengths\n BAMB_NUM, BAMB_A, BAMB_B, BAMB_C = map(lambda x: int(x), input().split())\n # available bamboo lengths\n for bamb in range(BAMB_NUM):\n BAMB_LIST.append(int(input()))\n\n mp = calcMP(0, 0, 0, 0)\n print(mp)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s473277814', 's556045125', 's392746648']
[3064.0, 2940.0, 3064.0]
[73.0, 17.0, 70.0]
[1197, 1131, 1039]
p03111
u087917227
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['N,A,B,C = map(int, input().split())\nl = [int(i) for i in input()]\nINF = 10**9\ndef dfs(cur,a,b,c):\n if cur == N:\n return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c) > 0 else INF\n ret0 = dfs(cur+1,a,b,c)\n ret1 = dfs(cur+1,a+l[cur],b,c) + 10\n ret2 = dfs(cur + 1, a, b + l[cur], c) + 10\n ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10\n return min(ret0, ret1, ret2, ret3)\nprint(dfs(0,0,0,0))', 'N,A,B,C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF = 10**9\ndef dfs(cur,a,b,c):\n if cur == N:\n return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c) > 0 else INF\n ret0 = dfs(cur+1,a,b,c)\n ret1 = dfs(cur+1,a+l[cur],b,c) + 10\n ret2 = dfs(cur + 1, a, b + l[cur], c) + 10\n ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10\n return min(ret0, ret1, ret2, ret3)\nprint(dfs(0,0,0,0))']
['Runtime Error', 'Accepted']
['s259086382', 's212550608']
[3064.0, 3064.0]
[19.0, 74.0]
[413, 420]
p03111
u095426154
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['def nsin(X,y):\n if(int(X/y)):\n return nsin(int(X/y),y)+str(X%y)\n return str(X%y)\n\ncost=10000\nfor i in range(3**n):\n g=list(nsin(i,3).zfill(5))\n if len(set(g))!=3:\n continue\n la=[]\n lb=[]\n lc=[]\n for j in range(n): \n if g[j]=="0":\n la.append(l[j])\n elif g[j]=="1":\n lb.append(l[j])\n elif g[j]=="2":\n lc.append(l[j])\n costa=10000\n costb=10000\n costc=10000\n for j in range(1,2**len(la)):\n ga=list(nsin(j,2).zfill(len(la)))\n A=0\n cont=-1\n for k in range(len(la)):\n if ga[k]=="1":\n A+=la[k]\n cont+=1\n tmp=cont*10+abs(A-a)\n if tmp<costa:\n costa=tmp\n for j in range(1,2**len(lb)):\n gb=list(nsin(j,2).zfill(len(lb)))\n B=0\n cont=-1\n for k in range(len(lb)):\n if gb[k]=="1":\n B+=lb[k]\n cont+=1\n tmp=cont*10+abs(B-b)\n if tmp<costb:\n costb=tmp\n for j in range(1,2**len(lc)):\n gc=list(nsin(j,2).zfill(len(lc)))\n C=0\n cont=-1\n for k in range(len(lc)):\n if gc[k]=="1":\n C+=lc[k]\n cont+=1\n tmp=cont*10+abs(C-c)\n if tmp<costc:\n costc=tmp\n if cost>(costa+costb+costc):\n cost=costa+costb+costc\nprint(cost)', "# coding: utf-8\nN,A,B,C=map(int,input().split())\nL=[]\nfor i in range(N):\n L.append(int(input()))\n\ndef Base_10_to_n(X, base_n, len_N):\n X_dumy = X\n out = ''\n while X_dumy>0:\n out = str(X_dumy%base_n)+out\n X_dumy = int(X_dumy/base_n)\n return out.zfill(len_N)\n\nans=10**6\n\nfor i in range(4**N):\n bit=Base_10_to_n(i,4,N)\n group=[[] for j in range(4)]\n \n for j in range(N):\n group[int(bit[j])].append(L[j])\n \n if not(group[1]) or not(group[2]) or not(group[3]):\n continue\n \n costA = abs(A-sum(group[1])) + (len(group[1])-1)*10\n costB = abs(B-sum(group[2])) + (len(group[2])-1)*10\n costC = abs(C-sum(group[3])) + (len(group[3])-1)*10\n \n cost = costA + costB + costC\n \n ans=min(ans,cost)\n\nprint(ans)"]
['Runtime Error', 'Accepted']
['s497992368', 's008195747']
[3192.0, 3064.0]
[18.0, 693.0]
[1395, 776]
p03111
u116038906
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['\n# TLE ac \n\n\nimport heapq\nfrom itertools import combinations\nimport sys\ninput = sys.stdin.readline \nN,A,B,C = (int(i) for i in input().split())\nl =[0]*N\nfor i in range(N):\n l[i] = int(input())\n\n\nmp=[]\nfor na in range(1,N-1):\n for ja in combinations(l,na):\n\n l_b =list(set(l) -set(ja))\n for nb in range(1,N):\n for jb in combinations(l_b ,nb):\n\n l_c =list(set(l_b) -set(jb) )\n for nc in range(1,N+1):\n for jc in combinations(l_c ,nc):\n \n \n AA =abs(A-sum(ja)) +10*(na-1)\n BB =abs(B-sum(jb)) +10*(nb-1)\n CC =abs(C-sum(jc)) +10*(nc-1)\n mp.append(AA +BB +CC)\n\nprint(mp)', '\n# RE 1 ac 19\n\n\nimport copy\nfrom itertools import combinations\nimport sys\ninput = sys.stdin.readline \nN,A,B,C = (int(i) for i in input().split())\nl =[0]*N\nfor i in range(N):\n l[i] = int(input())\n\n\nmp=[]\nfor na in range(1,N-1):\n for ja in combinations(l,na):\n\n l_b =copy.copy(l)\n for i2 in ja:\n if i2 in l_b:\n l_b.remove(i2)\n for nb in range(1,N):\n for jb in combinations(l_b ,nb):\n\n l_c =copy.copy(l_b)\n for i3 in jb:\n if i3 in l_c:\n l_c.remove(i3)\n for nc in range(1,N+1):\n for jc in combinations(l_c ,nc):\n \n \n AA =abs(A-sum(ja)) +10*(na-1)\n BB =abs(B-sum(jb)) +10*(nb-1)\n CC =abs(C-sum(jc)) +10*(nc-1)\n mp.append(AA +BB +CC)\n\n\nprint(min(mp))']
['Wrong Answer', 'Accepted']
['s094851477', 's076698804']
[11552.0, 11124.0]
[98.0, 96.0]
[1006, 1177]
p03111
u123756661
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['def ns(X, n):\n if (int(X/n)):\n return ns(int(X/n), n)+str(X%n)\n return str(X%n)\n\nn,a,b,c=map(int,input().split())\nt=[a,b,c]\nl=[]\nans=-1\nfor i in range(n):\n l.append(int(input()))\n\nfor i in range(4**n):\n tmp=ns(i,4)\n tmp="0"*(n-len(tmp))+tmp\n h=[0]*3\n p=0\n for j in range(n):\n if tmp[j]=="1":\n if h[0]!=0: p+=10\n h[0]+=l[j]\n\n elif tmp[j]=="2":\n if h[1]!=0: p+=10\n h[1]+=l[j]\n\n elif tmp[j]=="3":\n if h[2]!=0: p+=10\n h[2]+=l[j]\n\n if 0 in h:continue\n print(tmp,)\n for k in range(3):\n p+=abs(h[k]-t[k])\n if ans==-1: ans=p\n else: ans=min(ans,p)\nprint(ans)\n', '#!/usr/bin/env python3\n# -*- coding: UTF-8 -*-\n\ndef ns(X, n):\n if (int(X/n)):\n return ns(int(X/n), n)+str(X%n)\n return str(X%n)\n\nn,a,b,c=map(int,input().split())\nt=[a,b,c]\nl=[]\nans=-1\nfor i in range(n):\n l.append(int(input()))\n\nfor i in range(4**n):\n tmp=ns(i,4)\n tmp="0"*(n-len(tmp))+tmp\n h=[0]*3\n p=0\n for j in range(n):\n if tmp[j]=="1":\n if h[0]!=0: p+=10\n h[0]+=l[j]\n\n elif tmp[j]=="2":\n if h[1]!=0: p+=10\n h[1]+=l[j]\n\n elif tmp[j]=="3":\n if h[2]!=0: p+=10\n h[2]+=l[j]\n\n if 0 in h:continue\n for k in range(3):\n p+=abs(h[k]-t[k])\n if ans==-1: ans=p\n else: ans=min(ans,p)\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s855328394', 's922641810']
[3684.0, 3064.0]
[725.0, 666.0]
[690, 722]
p03111
u129836004
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(n)]\ninf = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a-A)+abs(b-B)+abs(c-C) - 30 if min(a, b, c) >0 else inf\n ret0 = dfs(cur+1, a,b,c)\n ret1 = dfs(cur+1, a+l[cur], b, c) + 10\n ret2 = dfs(cur+1, a, b+l[cur], c) +10\n ret3 = dfs(cur+1, a,b,c+l[cur]) +10\n return min(ret0, ret1, ret2, ret3)\n\nprint(dfs(0, 0, 0, 0))', 'import sys\nsys.setrecursionlimit(100000)\nN, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(n)]\ninf = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a-A)+abs(b-B)+abs(c-C) - 30 if min(a, b, c) >0 else inf\n ret0 = dfs(cur+1, a,b,c)\n ret1 = dfs(cur+1, a+l[cur], b, c) + 10\n ret2 = dfs(cur+1, a, b+l[cur], c) +10\n ret3 = dfs(cur+1, a,b,c+l[cur]) +10\n return min(ret0, ret1, ret2, ret3)\n\nprint(dfs(0, 0, 0, 0))', 'N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\ninf = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a-A)+abs(b-B)+abs(c-C) - 30 if min(a, b, c) >0 else inf\n ret0 = dfs(cur+1, a,b,c)\n ret1 = dfs(cur+1, a+l[cur], b, c) + 10\n ret2 = dfs(cur+1, a, b+l[cur], c) +10\n ret3 = dfs(cur+1, a,b,c+l[cur]) +10\n return min(ret0, ret1, ret2, ret3)\n\nprint(dfs(0, 0, 0, 0))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s130183592', 's220185579', 's358994322']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 70.0]
[422, 463, 422]
p03111
u163320134
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['import collections\nfrom copy import deepcopy\n\nn,a,b,c=map(int,input().split())\narr=[int(input()) for _ in range(n)]\nl=collections.deque()\nl.append([[],[],[]])\ncnt=0\n\nwhile 1:\n if cnt==8:\n break\n base=l.popleft()\n if len(base[0])==0 and len(base[1])==0 and len(base[2])==0:\n l.append([[arr[cnt]],[],[]])\n l.append([[],[arr[cnt]],[]])\n l.append([[],[],[arr[cnt]]])\n l.append([[],[],[]])\n cnt+=1\n else:\n tmp1=deepcopy(base)\n tmp1[0].append(arr[cnt])\n l.append(tmp1)\n tmp2=deepcopy(base)\n tmp2[1].append(arr[cnt])\n l.append(tmp2)\n tmp3=deepcopy(base)\n tmp3[2].append(arr[cnt])\n l.append(tmp3)\n tmp4=deepcopy(base)\n l.append(tmp4)\n\nmincost=10**9\nfor bl in l:\n if len(bl[0])==0 or len(bl[1])==0 or len(bl[2])==0:\n continue\n else:\n tmpcost=abs(sum(bl[0])-a)+abs(sum(bl[1])-b)+abs(sum(bl[2])-c)+10*(len(bl[0])-1+len(bl[1])-1+len(bl[2])-1)\n if mincost>tmpcost:\n mincost=tmpcost\nprint(mincost)', 'import collections\nfrom copy import deepcopy\n\nn,a,b,c=map(int,input().split())\narr=[int(input()) for _ in range(n)]\nl=collections.deque()\nl.append([[],[],[]])\ncnt=0\n\nwhile 1:\n if cnt==n:\n break\n base=l.popleft()\n if len(base[0])==0 and len(base[1])==0 and len(base[2])==0:\n l.append([[arr[cnt]],[],[]])\n l.append([[],[arr[cnt]],[]])\n l.append([[],[],[arr[cnt]]])\n l.append([[],[],[]])\n cnt+=1\n else:\n tmp1=deepcopy(base)\n tmp1[0].append(arr[cnt])\n l.append(tmp1)\n tmp2=deepcopy(base)\n tmp2[1].append(arr[cnt])\n l.append(tmp2)\n tmp3=deepcopy(base)\n tmp3[2].append(arr[cnt])\n l.append(tmp3)\n tmp4=deepcopy(base)\n l.append(tmp4)\n\nmincost=10**9\nfor bl in l:\n if len(bl[0])==0 or len(bl[1])==0 or len(bl[2])==0:\n continue\n else:\n tmpcost=abs(sum(bl[0])-a)+abs(sum(bl[1])-b)+abs(sum(bl[2])-c)+10*(len(bl[0])-1+len(bl[1])-1+len(bl[2])-1)\n if mincost>tmpcost:\n mincost=tmpcost\nprint(mincost)\n']
['Runtime Error', 'Accepted']
['s980386134', 's734980436']
[32244.0, 32244.0]
[1132.0, 1113.0]
[954, 955]
p03111
u177756077
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['N,A,B,C=map(int,input().split())\nl=[]\nfor _ in range(N):\n l.append(int(input()))\n\ndef dfs(counter,a,b,c):\n if a==A and b==B and c==C:\n return counter\n ret1=dfs(counter+1,a+l[counter],b,c)+10\n ret2=dfs(counter+1,a,b+l[counter],c)+10\n ret3=dfs(counter+1,a,b,c+l[counter])+10\n ret4=dfs(counter+1,a+1,b,c)+1\n ret5=dfs(counter+1,a,b+1,c)+1\n ret6=dfs(counter+1,a,b,c+1)+1\n return min(ret1,ret2,ret3,ret4,ret5,ret6)\n\nprint(dfs(0,0,0,0))', 'N,A,B,C=map(int,input().split())\nl=[]\nfor _ in range(N):\n l.append(int(input()))\n\ndef dfs(counter,a,b,c):\n if counter==N:\n \n if a>0 and b>0 and c>0:\n offset=10*3\n return abs(A-a)+abs(B-b)+abs(C-c)-offset\n else:\n \n return 10**9\n \n \n \n ret0=dfs(counter+1,a,b,c)\n ret1=dfs(counter+1,a+l[counter],b,c)+10\n ret2=dfs(counter+1,a,b+l[counter],c)+10\n ret3=dfs(counter+1,a,b,c+l[counter])+10\n return min(ret0,ret1,ret2,ret3)\n\nprint(dfs(0,0,0,0))']
['Runtime Error', 'Accepted']
['s195742856', 's116465170']
[3064.0, 3064.0]
[18.0, 60.0]
[467, 764]
p03111
u181115044
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['N, A, B, C = map(int, input().split())\nL = [int(input()) for i in range(N)]\n\nINF = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF\n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur + 1, a + l[cur], b, c) + 10\n ret2 = dfs(cur + 1, a, b + l[cur], c) + 10\n ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10\n return min(ret0, ret1, ret2, ret3)\n\nprint(dfs(0, 0, 0, 0))', 'N, A, B, C = map(int, input().split())\nL = [int(input()) for i in range(N)]\n\nINF = 10 ** 9\n\n\ndef dfs(cursor, a, b, c): \n if cursor == N: \n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) &gt; 0 else INF\n \n # dfs(0,0,0)\n \n \n \n \n\n \n \n no_compound_pattern = dfs(cursor+1, a, b, c)\n compound_a_pattern = dfs(cursor+1, a + L[cursor], b, c)+10\n compound_b_pattern = dfs(cursor+1, a, b + L[cursor], c)+10\n compound_c_pattern = dfs(cursor+1, a, b, c + L[cursor])+10\n\n \n \n return min(no_compound_pattern, compound_a_pattern, compound_b_pattern, compound_c_pattern)\n\n\nprint(dfs(0, 0, 0, 0))\n', 'N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\n\nINF = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF\n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur + 1, a + l[cur], b, c) + 10\n ret2 = dfs(cur + 1, a, b + l[cur], c) + 10\n ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10\n return min(ret0, ret1, ret2, ret3)\n\nprint(dfs(0, 0, 0, 0))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s280993828', 's767128076', 's561951838']
[3064.0, 2940.0, 3064.0]
[18.0, 17.0, 71.0]
[438, 1671, 438]
p03111
u183509493
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['n,a,b,c=map(int,input().split())\nl = [int(input()) for _ in range(n)]\nans = 100000000\nfor i in range(4**n):\n x,y,z=0,0,0\n s,t,u=0,0,0\n for j in range(n):\n t = i % 4\n if t == 0:\n x += l[j]\n s += 1\n elif t == 1:\n y += l[j]\n t += 1\n elif t == 2:\n z += l[j]\n u += 1\n if s == 0 or t == 0 or u == 0:\n continue\n k = (s + t + u - 3) * 10\n k += abs(a - x)\n k += abs(b - y)\n k += abs(c - z)\n ans = min(ans, k)\nprint(ans)', 'n,a,b,c=map(int,input().split())\nl = [int(input()) for _ in range(n)]\nans = 100000000\nfor i in range(4**n):\n x,y,z=0,0,0\n s,t,u=0,0,0\n for j in range(n):\n if i % 4 == 0:\n x += l[j]\n s += 1\n elif i % 4 == 1:\n y += l[j]\n t += 1\n elif i % 4 == 2:\n z += l[j]\n u += 1\n i //= 4\n if s == 0 or t == 0 or u == 0:\n continue\n k = (s + t + u - 3) * 10\n k += abs(a - x)\n k += abs(b - y)\n k += abs(c - z)\n ans = min(ans, k)\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s139646751', 's867007030']
[3064.0, 3064.0]
[226.0, 324.0]
[464, 476]
p03111
u185354171
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['N,A,B,C = map(int,input().split())\nl = [int(input()) for i in range(N)]\ninf = 10**9\ndef dfs(cur,a,b,c):\n if cur == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else inf\n ret0 = dfs(cur+1,a,b,c)\n ret1 = dfs(cur+1,a+l(cur),b,c)\n ret2 = dfs(cur+1,a,b+l(cur),c)\n ret3 = dfs(cur+1,a,b,c+l(cur))\n \n return min(ret0,ret1,ret2,ret3)\n\nprint(dfs(0,0,0,0))', 'N,A,B,C = map(int,input().split())\nl = [int(input()) for i in range(N)]\ninf = 10**9\ndef dfs(cur,a,b,c):\n if cur == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else inf\n ret0 = dfs(cur+1,a,b,c)\n ret1 = dfs(cur+1,a+l[cur],b,c) + 10\n ret2 = dfs(cur+1,a,b+l[cur],c) + 10\n ret3 = dfs(cur+1,a,b,c+l[cur]) + 10\n \n return min(ret0,ret1,ret2,ret3)\n\nprint(dfs(0,0,0,0))']
['Runtime Error', 'Accepted']
['s921393146', 's760043379']
[3064.0, 3064.0]
[18.0, 75.0]
[401, 416]
p03111
u187205913
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['N,A,B,C = map(int,input().split())\nl = [int(input()) for i in range(n)]\nINF = 10**9\ndef dfs(cur,a,b,c):\n if cur==N:\n return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else INF\n ret0 = dfs(cur+1,a,b,c)\n ret2 = dfs(cur+1,a+l[cur],b,c)+10\n ret3 = dfs(cur+1,a,b+l[cur],c)+10\n ret4 = dfs(cur+1,a,b,c+l[cur])+10\n return min(ret0,ret1,ret2,ret3)\nprint(dfs(0,0,0,0))', 'N,A,B,C = map(int,input().split())\nl = [int(input()) for i in range(N)]\nINF = 10**9\ndef dfs(cur,a,b,c):\n if cur==N:\n return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c) > 0 else INF\n ret0 = dfs(cur+1,a,b,c)\n ret1 = dfs(cur+1,a+l[cur],b,c)+10\n ret2 = dfs(cur+1,a,b+l[cur],c)+10\n ret3 = dfs(cur+1,a,b,c+l[cur])+10\n return min(ret0,ret1,ret2,ret3)\n\nprint(dfs(0,0,0,0))']
['Runtime Error', 'Accepted']
['s612593612', 's872816528']
[3064.0, 3064.0]
[18.0, 70.0]
[386, 389]
p03111
u190406011
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['from itertools import combinations\nN, A, B, C = [int(i) for i in input().split()]\nl_ls = list()\nfor i in range(N):\n l_ls.append(int(input()))\ndis_ls = [(i,[i]) for i in l_ls]\nfor i in range(2,7):\n dis_ls += [(sum(i),i) for i in combinations(l_ls, i)]\n_sum = 0\nfor target in [C, B, A]:\n min = 1e9\n for dis in dis_ls:\n sa = abs(dis[0] - target) + 10 * (len(dis[1]) - 1)\n if sa < min:\n min = sa\n min_combi = dis[1]\n _sum += min\n dis_ls = [i for i in dis_ls if len(set(min_combi).intersection(set(i[1]))) == 0]\nprint(_sum)', 'from itertools import combinations\nN, A, B, C = [int(i) for i in input().split()]\nl_ls = list()\nfor i in range(N):\n l_ls.append(int(input()))\ndis_ls = [(i,[i]) for i in l_ls]\nfor i in range(2,7):\n dis_ls += [(sum(i),i) for i in combinations(l_ls, i)]\nbest = 1e9\nfor hoge in [[A, B, C], [A, C, B],[B, A, C],[B, C, A], [C,B,A],[C,A,B]]:\n _sum = 0\n for target in hoge:\n min = 1e9\n for dis in dis_ls:\n c_sa = abs(dis[0] - target) + 10 * (len(dis[1]) - 1)\n if sa < min:\n min = sa\n min_combi = dis[1]\n _sum += min\n dis_ls = [i for i in dis_ls if len(set(min_combi).intersection(set(i[1]))) == 0]\n if _sum < best:\n best = _sum\nprint(best)', 'from itertools import product\nN, A, B, C = [int(i) for i in input().split()]\nl_ls = list()\nfor i in range(N):\n l_ls.append(int(input()))\nbest = 1e9\nfor combi in product(range(4),repeat=N):\n a = [l for l, label in zip(l_ls, combi) if label == 1]\n b = [l for l, label in zip(l_ls, combi) if label == 2]\n c = [l for l, label in zip(l_ls, combi) if label == 3]\n dis = abs(A - sum(a)) + abs(B - sum(b)) + abs(C - sum(c)) \\\n + (len(a) + len(b) + len(c) - 3) * 10\n if len(a) * len(b) * len(c) == 0:\n continue\n if best > dis:\n best = dis\nprint(best)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s356036658', 's735755994', 's252990495']
[3064.0, 3064.0, 3192.0]
[18.0, 18.0, 303.0]
[572, 733, 585]
p03111
u191829404
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0\n# abcde\ts=input()\ts=\'abcde\'\n# abcde\ts=list(input())\ts=[\'a\', \'b\', \'c\', \'d\', \'e\']\n\n# 1 2\t| x,y = map(int,input().split()) |\tx=1,y=2\n\n\n\n\n# INPUT\n# 3\n# hoge\n# foo\n# bar\n# ANSWER\n# n=int(input())\n\n\n\nfrom collections import defaultdict, Counter\nimport math\nfrom bisect import bisect_left, bisect_right\nimport numpy as np\n\nli = list(map(int,input().split()))\nN, A, B, C = li[0], li[1], li[2], li[3]\nl = sorted([ int(input()) for i in range(N) ])\nan_l = sorted([A, B, C])\n\nans = 0\nfor l_n_ind, l_n in enumerate(an_l):\n score = 10\n l_i_ind = None\n for ind, l_i in enumerate(l):\n tmp_score = abs(l_n-l_i)\n if tmp_score < score:\n score = tmp_score\n l_i_ind = ind\n if l_i_ind is not None:\n ans += score\n l.pop(l_i_ind)\n an_l.pop(l_n_ind)\n\n# an_sum = sum(an_l)\n\n\nfor l_n_ind, l_n in enumerate(an_l):\n score = 99999\n l_i_inds = []\n for i in range(1 << len(l)):\n output = []\n output_ind = []\n l_i_ind = None\n for j in range(len(l)):\n if ((i >> j) & 1) == 1:\n output.append(l[j])\n output_ind.append(j)\n if len(output) == 0:\n continue\n tmp_score = abs(sum(output)-l_n)\n if tmp_score < score:\n score = tmp_score\n l_i_inds = output_ind\n\n ans += (score + (len(l_i_inds)-1)*10)\n print("l: {}".format(l_n))\n print("ls: ")\n for k in l_i_inds:\n print(l[k])\n for tt in l_i_inds[::-1]:\n l.pop(tt)\n\n# print(an_l)\n# print(l)\nprint(ans)\n\n', "# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0\n# abcde\ts=input()\ts='abcde'\n# abcde\ts=list(input())\ts=['a', 'b', 'c', 'd', 'e']\n\n# 1 2\t| x,y = map(int,input().split()) |\tx=1,y=2\n\n\n\n\n# INPUT\n# 3\n# hoge\n# foo\n# bar\n# ANSWER\n# n=int(input())\n\n\nimport math\nimport numpy as np\nimport copy\nfrom collections import defaultdict, Counter\nfrom itertools import product\nfrom bisect import bisect_left, bisect_right\ndef inpl(): return list(map(int, input().split()))\n\nli = list(map(int, input().split()))\nN, A, B, C = li[0], li[1], li[2], li[3]\nl = sorted([ int(input()) for i in range(N) ])\n\nINF = 1e9\n\ndef dfs(ind, a, b, c):\n if ind == N:\n if min(a, b, c) > 0:\n return abs(a-A) + abs(b-B) + abs(c-C) - 30\n else:\n return INF\n ret0 = dfs(ind+1, a, b, c)\n ret1 = dfs(ind+1, a + l[ind], b, c) + 10\n ret2 = dfs(ind+1, a, b + l[ind], c) + 10\n ret3 = dfs(ind+1, a, b, c + l[ind]) + 10\n return min(ret0, ret1, ret2, ret3)\n\nprint(dfs(0, 0, 0, 0))"]
['Wrong Answer', 'Accepted']
['s098493910', 's938068752']
[12236.0, 12440.0]
[150.0, 208.0]
[1920, 1253]
p03111
u193264896
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['import itertools\nN,A,B,C = map(int,input().split())\nL = [int(input()) for _ in range(N)]\n \nINF = 10 ** 18\nanswer = INF\nfor pattern in itertools.product(range(4), repeat = N):\n x = [0] * 4\n MP = 0\n for take, length in zip(pattern, L):\n if take == 3:\n continue\n if x[take] != 0:\n MP += 10\n x[take] += length\n if x[0] == 0 or x[1] == 0 or x[2] == 0:\n continue\n MP += abs(A-x[0])\n MP += abs(B-x[1])\n MP += abs(C-x[2])\n if answer > MP:\n answer = MP\nprint(answer', 'import itertools\nN,A,B,C = map(int,input().split())\nL = [int(input()) for _ in range(N)]\n \nINF = 10 ** 18\nanswer = INF\nfor pattern in itertools.product(range(4), repeat = N):\n x = [0] * 4\n MP = 0\n for take, length in zip(pattern, L):\n if take == 3:\n continue\n if x[take] != 0:\n MP += 10\n x[take] += length\n if x[0] == 0 or x[1] == 0 or x[2] == 0:\n continue\n MP += abs(A-x[0])\n MP += abs(B-x[1])\n MP += abs(C-x[2])\n if answer > MP:\n answer = MP\nprint(answer)']
['Runtime Error', 'Accepted']
['s703800216', 's920620563']
[3064.0, 3064.0]
[17.0, 273.0]
[489, 490]
p03111
u194894739
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['from collections import deque\n\nN, A, B, C = map(int, input().split())\nL = [int(input()) for _ in range(N)]\nminMP = 10**5\n\np = deque()\np.append([-1] * len(L))\nwhile p:\n stats = p.pop()\n stats = list(stats)\n a, b, c = 0, 0, 0\n MP = 0\n cntA = 0; cntB = 0; cntC = 0\n for i in range(N):\n if stats[i] == 1:\n a += L[i]\n cntA += 1\n elif stats[i] == 2:\n b += L[i]\n cntB += 1\n elif stats[i] == 3:\n c += L[i]\n cntC += 1\n\n if cntA >= 1 and cntB >= 1 and cntC >= 1:\n MP += abs(A - a) + abs(B - b) + abs(C - c) + 10 * (cntA+cntB+cntC-3)\n minMP = min(minMP, MP)\n\n if not -1 in stats:\n continue\n j = stats.index(-1)\n for k in range(4):\n stats[j] = k\n newStats = tuple(stats)\n p.append(newStats)\n print(newStats)\nprint(minMP)\ninput()\n', "N, A, B, C = map(int, input().split())\nL = [int(input()) for _ in range(N)]\nINF = float('inf')\n\ndef dfs(cursor=0, a=0, b=0, c=0):\n if cursor == N:\n return abs(a-A) + abs(b-B) + abs(c-C) - 30 if a*b*c > 0 else INF\n\n no_compound = dfs(cursor+1, a, b, c)\n A_compound = dfs(cursor+1, a+L[cursor], b, c) + 10\n B_compound = dfs(cursor+1, a, b+L[cursor], c) + 10\n C_compound = dfs(cursor+1, a, b, c+L[cursor]) + 10\n return min(no_compound, A_compound, B_compound, C_compound)\n\nprint(dfs())\n"]
['Runtime Error', 'Accepted']
['s186134898', 's815957584']
[5492.0, 3064.0]
[586.0, 70.0]
[883, 508]
p03111
u196697332
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['N, A, B, C = map(int, input().split())\n\nlength = [0] * N\n\nfor i in range(N):\n length[i] = int(input())\n\ninf = 10 ** 9\n\ndef dfs(pos, a, b, c):\n if pos == N:\n if min(a, b, c) > 0:\n \n return abs(a - A) + abs(b - B) + abs(c - C) - 30\n else:\n return inf\n \n ret1 = dfs(pos + 1, a, b, c)\n ret2 = dfs(pos + 1, a + length[pos], b, c) + 10\n ret3 = dfs(pos + 1, a, b + length[pos], c) + 10\n ret4 = dfs(pos + 1, a, b, c + length[pos]) + 10\n return min(ret1, ret2, ret3, ret4)\n \ndfs(0, 0, 0, 0)', 'N, A, B, C = map(int, input().split())\n\nlength = [0] * N\n\nfor i in range(N):\n length[i] = int(input())\n\ninf = 10 ** 9\n\ndef dfs(pos, a, b, c):\n if pos == N:\n if min(a, b, c) > 0:\n \n return abs(a - A) + abs(b - B) + abs(c - C) - 30\n else:\n return inf\n \n ret1 = dfs(pos + 1, a, b, c)\n ret2 = dfs(pos + 1, a + length[pos], b, c) + 10\n ret3 = dfs(pos + 1, a, b + length[pos], c) + 10\n ret4 = dfs(pos + 1, a, b, c + length[pos]) + 10\n return min(ret1, ret2, ret3, ret4)\n \nprint(dfs(0, 0, 0, 0))']
['Wrong Answer', 'Accepted']
['s353393722', 's515476248']
[3064.0, 3064.0]
[73.0, 70.0]
[611, 618]
p03111
u197955752
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['n, *abc = [int(x) for x in input().split()]\nl = [int(input()) for i in range(n)]\nA = 0; B = 1; C = 2;\n\nminmp = 10 ** 9\nfor k in range(2 ** (2 * n)):\n mat = [[], [], [], []] \n \n \n \n \n \n for i in range(1, n):\n mat[k & (0b11)].append(l[i])\n k >>= 2\n\n if len(mat[0]) == 0 or len(mat[1]) == 0 or len(mat[2]) == 0:\n continue\n\n mp = 0\n for j in range(3):\n mp += 10 * (len(mat[j]) - 1)\n mp += 1 * abs(abc[j] - sum(mat[j]))\n\n minmp = min(minmp, mp)\n\nprint(minmp)', 'n, *abc = [int(x) for x in input().split()]\nl = [int(input()) for i in range(n)]\nA = 0; B = 1; C = 2;\n\nminmp = 10 ** 9\nfor k in range(2 ** (2 * n)):\n mat = [[], [], [], []] \n \n \n \n \n \n for i in range(n):\n mat[k & (0b11)].append(l[i])\n k >>= 2\n\n if len(mat[0]) == 0 or len(mat[1]) == 0 or len(mat[2]) == 0:\n continue\n\n mp = 0\n for j in range(3):\n mp += 10 * (len(mat[j]) - 1)\n mp += 1 * abs(abc[j] - sum(mat[j]))\n\n minmp = min(minmp, mp)\n\nprint(minmp)']
['Wrong Answer', 'Accepted']
['s925482076', 's016499767']
[3064.0, 3064.0]
[344.0, 374.0]
[815, 812]
p03111
u210543511
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF = 10**9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(A-a) + abs(B-b) + abs(C-c) -30 if min(a, b, c) > 0 else INF\n ret0 = dfs(cur + 1, a, b, c )\n ret1 = dfs(cur + 1, a + l[cur], b, c ) + 10\n ret2 = dfs(cur + 1, a, b + l[cur], c ) + 10\n ret3 = dfs(cur + 1, a, b, c+l[cur]) + 10\n return min(ret0, ret2, ret3)\n\nprint(dfs(0, 0, 0, 0))', 'N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF = 10**9\n \ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(A-a) + abs(B-b) + abs(C-c) -30 if min(a, b, c) > 0 else INF\n ret0 = dfs(cur + 1, a, b, c )\n ret1 = dfs(cur + 1, a + l[cur], b, c ) + 10\n ret2 = dfs(cur + 1, a, b + l[cur], c ) + 10\n ret3 = dfs(cur + 1, a, b, c+l[cur]) + 10\n return min(ret0, ret1, ret2, ret3)\n \nprint(dfs(0, 0, 0, 0))']
['Wrong Answer', 'Accepted']
['s372845837', 's987745080']
[3064.0, 3064.0]
[68.0, 75.0]
[495, 503]
p03111
u214434454
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['n,A,B,C = map(int,input().split(()))\nl = [int(input()) for i in range(n)]\ninf = 10 ** 9\n\ndef dfs(i,a,b,c):\n if i == n:\n if min(a,b,c) > 0:\n return abs(a-A) + abs(b-B) + abs(c-C) - 30\n else:\n return inf\n ret0 = dfs(i+1, a, b, c)\n ret1 = dfs(i+1, a + l[i], b, c) + 10\n ret2 = dfs(i+1, a, b + l[i], c) + 10\n ret3 = dfs(i+1, a, b, c + l[i]) + 10\n return min(ret0, ret1, ret2, ret3)\n\nprint(dfs(0,0,0,0))\n', 'n,A,B,C = map(int,input().split())\nl = [int(input()) for i in range(n)]\ninf = 10 ** 9\n\ndef dfs(i,a,b,c):\n if i == n:\n if min(a,b,c) > 0:\n return abs(a-A) + abs(b-B) + abs(c-C) - 30\n else:\n return inf\n ret0 = dfs(i+1, a, b, c)\n ret1 = dfs(i+1, a + l[i], b, c) + 10\n ret2 = dfs(i+1, a, b + l[i], c) + 10\n ret3 = dfs(i+1, a, b, c + l[i]) + 10\n return min(ret0, ret1, ret2, ret3)\n\nprint(dfs(0,0,0,0))\n']
['Runtime Error', 'Accepted']
['s042095306', 's288669170']
[3064.0, 3064.0]
[19.0, 76.0]
[453, 451]
p03111
u223133214
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
["def Base_10_to_n(X, n):\n if (int(X/n)):\n return Base_10_to_n(int(X/n), n)+str(X%n)\n return str(X%n)\n\nn,a,b,c=map(int,input().split())\nL=[]\nfor _ in range(n):\n L.append(int(input()))\nprint(L)\nat,bt,ct=[],[],[]\nans_list=[]\nans=999999999\nfor i in range(4**len(L)-1):\n i_4_list=list(Base_10_to_n(i, 4).zfill(len(L)))\n at,bt,ct=[],[],[]\n for num,i_4 in enumerate(i_4_list):\n if i_4=='0':\n at.append(L[num])\n elif i_4=='1':\n bt.append(L[num])\n elif i_4=='2':\n ct.append(L[num])\n else:\n continue\n if at!=[] and ct!=[] and ct!=[]:\n al=0\n al+=(len(at)+len(bt)+len(ct)-3)*10\n al+=(abs(sum(at)-a)+abs(sum(bt)-b)+abs(sum(ct)-c))\n if al < ans:\n ans=al\nprint(ans)\n\n\n", "def Base_10_to_n(X, n):\n if (int(X/n)):\n return Base_10_to_n(int(X/n), n)+str(X%n)\n return str(X%n)\n\nn,a,b,c=map(int,input().split())\nL=[]\nfor _ in range(n):\n L.append(int(input()))\n\nans=99999\nfor i in range(4**len(L)+1):\n i_4_list=list(Base_10_to_n(i, 4).zfill(len(L)))\n at,bt,ct=[],[],[]\n for num,i_4 in enumerate(i_4_list):\n if i_4=='0':\n at.append(L[num])\n elif i_4=='1':\n bt.append(L[num])\n elif i_4=='2':\n ct.append(L[num])\n else:\n continue\n if min(len(at),len(bt),len(ct))>0:\n al=0\n al+=(len(at)+len(bt)+len(ct)-3)*10\n al+=(abs(sum(at)-a)+abs(sum(bt)-b)+abs(sum(ct)-c))\n if al < ans:\n ans=al\nprint(ans)", 'N,A,B,C=map(int,input().split())\nL = []\nfor i in range(N):\n L.append(int(input()))\n\ndef dfs(n,a,b,c):\n if n == N:\n if min(a,b,c)>0:\n return abs(A-a)+abs(B-b)+abs(C-c)-30\n else:\n return 10000\n root1=dfs(n+1,a+L[n],b,c)+10\n root2=dfs(n+1,a,b+L[n],c)+10\n root3=dfs(n+1,a,b,c+L[n])+10\n root4=dfs(n+1,a,b,c)\n return min(root1,root2,root3,root4)\n \nprint(dfs(0,0,0,0))\n\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s108285898', 's575632213', 's737890178']
[3064.0, 3188.0, 3064.0]
[624.0, 629.0, 74.0]
[791, 748, 423]
p03111
u223904637
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['n,a,b,c=map(int,input().split())\nl=[]\nfor i in range(n):\n l.append(int(input()))\nop=[[0],[1],[2]]\nfor i in range(n-1):\n tmp=[]\n for j in op:\n tmp.append(j+[0])\n tmp.append(j+[1])\n tmp.append(j+[2])\n op=tmp\nans=1000000000\nfor i in op:\n ta=0\n tb=0\n tc=0\n for j in range(len(i)):\n if i[j]==0:\n ta+=l[j]\n elif i[j]==1:\n tb+=l[j]\n else:\n tc+=l[j]\n mp=abs(a-ta)+abs(b-tb)+abs(c-tc)\n if ta==0 or tb==0 or tc==0:\n mp=1000000000\n ans=min(ans,mp)\nprint(ans)', 'n,a,b,c=map(int,input().split())\nl=[]\nfor i in range(n):\n l.append(int(input()))\nop=[[0],[1],[2],[3]]\nfor i in range(n-1):\n tmp=[]\n for j in op:\n tmp.append(j+[0])\n tmp.append(j+[1])\n tmp.append(j+[2])\n tmp.append(j+[3])\n op=tmp\nans=1000000000\nfor i in op:\n ta=0\n tb=0\n tc=0\n mp=0\n for j in range(len(i)):\n if i[j]==0:\n if ta!=0:\n mp+=10\n ta+=l[j] \n elif i[j]==1:\n if tb!=0:\n mp+=10\n tb+=l[j]\n elif i[j]==2:\n if tc!=0:\n mp+=10\n tc+=l[j]\n mp+=abs(a-ta)+abs(b-tb)+abs(c-tc)\n if ta==0 or tb==0 or tc==0:\n mp=1000000000\n ans=min(ans,mp)\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s489023372', 's669519178']
[4212.0, 15092.0]
[43.0, 320.0]
[562, 754]
p03111
u225642513
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['N,A,B,C = map(int, input().split())\nl = [int(input()) for _ in range(N)]\nINF = 10**9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a-A)+abs(b-B)+abs(c-C) > 0 else INF\n ret0 = dfs(cur+1, a, b, c)\n ret1 = dfs(cur+1,a+l[cur],b,c) +10\n ret2 = dfs(cur+1,a,b+l[cur],c)+10\n ret3 = dfs(cur+1,a,b,c+l[cur])+10\n return min(ret0,ret1,ret2,ret3)\nprint(dfs(0,0,0,0))', 'N,A,B,C = map(int, input().split())\nl = [int(input()) for _ in range(N)]\nINF = 10**9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c) > 0 else INF\n ret0 = dfs(cur+1, a, b, c)\n ret1 = dfs(cur+1,a+l[cur],b,c) +10\n ret2 = dfs(cur+1,a,b+l[cur],c)+10\n ret3 = dfs(cur+1,a,b,c+l[cur])+10\n return min(ret0,ret1,ret2,ret3)\nprint(dfs(0,0,0,0))']
['Runtime Error', 'Accepted']
['s871296901', 's029695211']
[2940.0, 3188.0]
[17.0, 73.0]
[382, 399]
p03111
u232852711
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic point). Choose one bamboo and increase its length by 1. * Shortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1. * Composition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.) At least how much MP is needed to achieve the objective?
['inf = 10**9\nn, a, b, c = map(int, input().split())\nl = [int(input()) for _ in range(n)]\n\ndef dfs(i, a_cur, b_cur, c_cur):\n if i == n:\n return abs(a_cur-a) + abs(b_cur-b) + abs(c_cur-c) - 30 if min(a_cur, b_cur, c_cur) > 0 else inf\n ans0 = dfs(i+1, a+l[i], b, c) + 10\n ans1 = dfs(i+1, a, b+l[i], c) + 10\n ans2 = dfs(i+1, a, b, c+l[i]) + 10\n ans3 = dfs(i+1, a, b, c)\n return min(ans0, ans1, ans2, ans3)\n\nprint(dfs(0, 0, 0, 0))', 'inf = 10**9\nn, a, b, c = map(int, input().split())\nl = [int(input()) for _ in range(n)]\n\ndef dfs(i, a_cur, b_cur, c_cur):\n if i == n:\n return abs(a_cur-a) + abs(b_cur-b) + abs(c_cur-c) - 30 if min(a_cur, b_cur, c_cur) > 0 else inf\n ans0 = dfs(i+1, a_cur+l[i], b_cur, c_cur) + 10\n ans1 = dfs(i+1, a_cur, b_cur+l[i], c_cur) + 10\n ans2 = dfs(i+1, a_cur, b_cur, c_cur+l[i]) + 10\n ans3 = dfs(i+1, a_cur, b_cur, c_cur)\n return min(ans0, ans1, ans2, ans3)\n\nprint(dfs(0, 0, 0, 0))']
['Wrong Answer', 'Accepted']
['s118192283', 's228817862']
[3064.0, 3064.0]
[82.0, 75.0]
[449, 497]