TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
a, b, c = input().split("/")

x = b+c
x = int(x)
print(x)
if x > 430:
    print("TBD")
else:
    print("Heisei")


a, b, c = input().split("/")

x = b+c
x = int(x)
if x > 430:
    print("TBD")
else:
    print("Heisei")


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import datetime
target = datetime.datetime(2019,4,30)
y,m,d = map(int,input().split("/"))
indata = datetime.datetime(y,m,d)
if indata <= target:
  print("Heisai")
else:
  print("TBD")


import datetime
target = datetime.datetime(2019,4,30)
y,m,d = map(int,input().split("/"))
indata = datetime.datetime(y,m,d)
if indata <= target:
  print("Heisei")
else:
  print("TBD")


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import datetime;
def main():
    s=input()
    y,m,d=s.split('/')
    y=int(y)
    m=int(m)
    d=int(d)

    d1= datetime.date(y,m,d)
    Heisei=datetime.date(2019,4,30)

    if(Heisei>=d1):
        print('Heisei')
    else:
        print('TBD')

import datetime;

s=input()
y,m,d=s.split('/')
y=int(y)
m=int(m)
d=int(d)

d1= datetime.date(y,m,d)
Heisei=datetime.date(2019,4,30)

if(Heisei>=d1):
    print('Heisei')
else:
    print('TBD')

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s = input()
day = (s.split("/"))
if day[1] == "4":
 print("Heisei")
else:
 print("TBD")

s = input()
d = s.split("/")
if day[1] > 4:
 print("TBD")
else:
 print("Heisei")

s = input()
day = (s.split("/"))
if day[1] == "4":
 print("Heisei")
else:
 print("Reiwa")

s = input()
day = (s.split("/"))
if int(day[1]) <= "4":
 print("Heisei")
else:
 print("TBD")


s = input()
day = (s.split("/"))
if int(day[1]) <= 4:
 print("Heisei")
else:
 print("TBD")

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
y,m,d=input().split('/')
print('TBD' if int(m+d)>=430 else 'Heisei')

y,m,d=input().split('/')
print('TBD' if int(m+d)>430 else 'Heisei')

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
S = input()
S = S.split("/")
S = [int(s) for s in S]
if S[0] < 2019 and S[1] < 4 and S[2] < 30:
    print("Heisei")
else:
    print("TBD")

S = input()
S = S.split("/")
S = [int(s) for s in S]
if S[0] < 2019 and S[1] < 4 and S[1] < 30:
    print("Heisei")
else:
    print("TBD")

S = input()
S = S.split("/")
S = [int(s) for s in S]
if S[0] < 2019:
    print("Heisei")
if S[0] < 2019 and S[1] < 4:
    print("Heisei")
if S[0] < 2019 and S[1] < 4 and S[2] < 30:
    print("Heisei")
else:
    print("TBD")

S = input()
S = S.split("/")
S = [int(s) for s in S]
if S[0] < 2019:
    print("Heisei")
elif S[1] < 4:
    print("Heisei")
elif S[2] < 30:
    print("Heisei")
else:
    print("TBD")

S = input()
S = S.split("/")
S = [int(s) for s in S]
if S[0] <= 2019 and S[1] <= 4 and S[2] <=30:
    print("Heisei")
else:
    print("TBD")

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
# coding: utf-8
s = input()
s if s <='2019/04/30' else print("TBD")

# coding: utf-8
s = input()
if s <='2019/04/30':
    print("Heisei")
else:
    print("TBD")

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s = [int(x) for x in input().split("/")]

if s[1] < 4:
  print("Heisei")
elif s[1] == 4 and s[2] < 30:
  print("Heisei")
else:
  print("TBD")

s = [int(x) for x in input().split("/")]
 
if s[1] < 4:
  print("Heisei")
elif s[1] == 4 and s[2] <= 30:
  print("Heisei")
else:
  print("TBD")

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
yy,mm,dd =map(int,input().split('/'))

if yy>2019:
  print('TBD')
else:
  if mm>4:
    print('TBD')
  else:
    if mm==1 or mm==3:
      if dd>31:
        print('TBD')
      else:
        print('Heisei')
    if mm==2:
      if d>29:
        print('TBD')
      else:
        print('Heisei')
    if mm==4:
      if d>30:
        print('TBD')
      else:
        print('Heisei')




yy,mm,dd =map(int,input().split('/'))

if yy>2019:
  print('TBD')
else:
  if mm>4:
    print('TBD')
  else:
    if mm==1 or m==3:
      if dd>31:
        print('TBD')
      else:
        print('Heisei')
    if mm==2:
      if d>29:
        print('TBD')
      else:
        print('Heisei')
    if mm==4:
      if d>30:
        print('TBD')
      else:
        print('Heisei')



  if mm<=4:
    if dd<=30:
      print('Heisei')
else:
  print('TBD')



yy,mm,dd =map(int,input().split('/'))

if yy>2019:
  print('TBD')
else:
  if mm>4:
    print('TBD')
  else:
    if mm==1 or mm==3:
      if dd>31:
        print('TBD')
      else:
        print('Heisei')
    if mm==2:
      if d>29:
        print('TBD')
      else:
        print('Heisei')
    if mm==4:
      if d>30:
        print('TBD')
      else:
        print('Heisei')



  if mm<=4:
    if dd<=30:
      print('Heisei')
else:
  print('TBD')



yy,mm,dd =map(int,input().split('/'))

if yy>2019:
  print('TBD')
else:
  if mm>4:
    print('TBD')
  else:
    if mm==1 or mm==3:
      if dd>31:
        print('TBD')
      else:
        print('Heisei')
    if mm==2:
      if dd>29:
        print('TBD')
      else:
        print('Heisei')
    if mm==4:
      if dd>30:
        print('TBD')
      else:
        print('Heisei')




Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
dt = [for int(i) in input().split("/")]
if dt[0] >= 2019 and dt[1] >= 5:
    print("TBD")
else :
    print("Heisei")

dt = [int(i) for i in input().split("/")]

if dt[0] >= 2019 and dt[1] >= 5:
    print("TBD")
else :
    print("Heisei")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
s=input()
print(s)
if "2019/04/30">=s:
    print('Heisei')
else:
    print('TBD')


s=input()
if "2019/04/30">=s:
    print('Heisei')
else:
    print('TBD')


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s = input()
if int(s[:4])<2019 and int(s[5:7])<4:
    print("Heisei")
else:
    print("TBD")


s = input()
if int(s[:4])<=2019 and int(s[5:7])<=4:
    print("Heisei")
else:
    print("TBD")


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s=input()
print("Heisei" if int(s[5:7])<5) else "TBD")

s=input()
print("Heisei" if int(s[5:7])<5 else "TBD")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):

S = input()
if S[6:8] == "01" or S[6:8] == "02" or S[6:8] == "03" or S[6:8] == "04":
    print("Heisei")
else:
    print("TBD")


S = input()
if S[5:7] == "01" or S[5:7] == "02" or S[5:7] == "03" or S[5:7] == "04":
    print("Heisei")
else:
    print("TBD")

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
_,m,_ = map(int,input().split("/"))
print("TBD" if m > 4 else "HEISEI")

S = input()
print("HEISEI" if S <= 2019/4/30 else "TBD")

S = input()
print("HEISEI" if(S <= 2019/4/30) else "TBD")

_,m,_ = map(int,input().split("/"))
print("TBD" if m > 4 else "Heisei")

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
y,m,d=int(input().split("/"))
if y<=2018:
  ans="Heisei"
else:
  if m<=4:
    ans="Heisei"
  else:
    ans="TBD"
print(ans)

y,m,d=str(input().split("/"))
if y<=2018:
  ans="Heisei"
else:
  if m<=4:
    ans="Heisei"
  else:
    ans="TBD"
print(ans)

y,m,d=str(input().split("/")
if y<=2018:
  ans="Heisei"
else:
  if m<=4:
    ans="Heisei"
  else:
    ans="TBD"
print(ans)


y,m,d=map(int,input().split("/"))
if y<=2018:
  ans="Heisei"
else:
  if m<=4:
    ans="Heisei"
  else:
    ans="TBD"
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
y, m, d=map(int, input().split("/"))
if 2020<y:
  print("Heisei")
else:
  if y<2019:
    print("TBD")
    
  else:                   #y==2019
    if 5<m:
      print("Heisei")
    else:
      if m<=4:
        print("TBD")

y, m, d=map(int, input().split("/"))
if 2020<y:
  print("TBD")
else:
  if y<2019:
    print("Heisei")
    
  else:                   #y==2019
    if 5<=m:
      print("TBD")
    else:
      if m<=4:
        print("Heisei")

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
 = input()


# a_y = int(A[0]) * 1000
# b_y = int(A[1]) *100
# c_y = int(A[2])*10
# d_y = int(A[3])



if int(A[5])!=0:
    mm = (int(A[5])*10) + (int(A[6]))
else:
    mm = int(A[6])

if int(A[8])!=0:
    dd = (int(A[8])*10) + (int(A[9]))
else:
    dd = int(A[9])
    


#     print("TBD")
# elif yyyy==2019 and mm>=5:
#     print("TBD")
# else:


if mm>4:
    print("TBD")
else:
    print("Heisei")


A = input()


# a_y = int(A[0]) * 1000
# b_y = int(A[1]) *100
# c_y = int(A[2])*10
# d_y = int(A[3])



if int(A[5])!=0:
    mm = (int(A[5])*10) + (int(A[6]))
else:
    mm = int(A[6])

if int(A[8])!=0:
    dd = (int(A[8])*10) + (int(A[9]))
else:
    dd = int(A[9])
    


#     print("TBD")
# elif yyyy==2019 and mm>=5:
#     print("TBD")
# else:


if mm>4:
    print("TBD")
else:
    print("Heisei")


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import dateutil
S = dateutil.parser.parse(input())
base = dateutil.parser.parse('2019/04/30')
if S<=base:
    print("Heisei")
else:
    print("TBD")

import datetime
S = input()
dt = datetime.date(*list(map(int, S.split('/'))))
base = datetime.date(2019, 4, 30)
if dt<=base:
    print("Heisei")
else:
    print("TBD")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
s = input()
if s[5] == 1:
    print("TBD")
else:
    if s[6]>4:
        print("Heisei")
    else:
        print("TBD")

s = input()
if int(s[5]) == 1:
    print("TBD")
else:
    if int(s[6])>4:
        print("Heisei")
    else:
        print("TBD")

s = input()
if int(s[5]) == 1:
    print("TBD")
else:
    if int(s[6])<5:
        print("Heisei")
    else:
        print("TBD")

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import re
s=input()
h=re.fullmatch(r'2019/(\d+)/(\d+)',s)
if h.groups(1)=='04'or h.groups(1)=='03'or h.groups(1)=='02'or h.groups(1)=='01':
    print('Heosei')
else:
    print('TBD')

import re
s=input()
a=re.search('([0-9]{4})/([0-9]{2})/([0-9]{2})',s)
if int(str(a.group(2)))<=4:
    print('Heosei')
else:
    print('TBD')

import re
s=input()
a=re.search('([0-9]{4})/([0-9]{2})/([0-9]{2})',s)
print(a.group(2))
if int(str(a.group(2)))<=4:
    print('Heosei')
else:
    print('TBD')

import re
s=input()
a=re.search('([0-9]{4})/([0-9]{2})/([0-9]{2})',s)
if int(str(a.group(2)))<=4:
    print('Heisei')
else:
    print('TBD')

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a, b, c = input.split("/")
print("Heisei" if b in ["01","02","03","04"] else "TBD")


a, b, c = input.split("/")
print("Heisei" if "Heisei" in ["01","02","03","04"] else "TBD")


a = input().split("/")
print(a)

a, b, c = input().split("/")
print("Heisei" if b in ["01","02","03","04"] else "TBD")


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s = input
print("TBD") if int(s[5:7]) =>5 else print("Heisei")

s=input()

if int(s[5:7]) <= 4:
    print('Heisei')
else:
    print('TBD')


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
ans = 0

for i in range(N):
  a,b = map(str, input().split())
  if b =="JPY":
    ans += int(a)
  else:
    ans += int(a)*380000
print(ans)


y,m,d = map(int, input().split("/"))
if  m >= 5 :
  print("TBD")
else:
  print("Heisei")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
date = list(map(int, input().split("/")))
if date[0] >= 2019:
	if date[1] >= 5:
		print("Heisei")
else:
	print("TBD")


date = list(map(int, input().split("/")))
if date[0] >= 2019:
	if date[1] >= 5:
		print("TBD")
else:
	print("Heisei")


date = list(map(int, input().split("/")))
if date[0] >= 2019:
	if date[1] >= 5:
		print("TBD")
    else:
      	print("Heisei")
else:
	print("Heisei")


date = list(map(int, input().split("/")))
if date[0] > 2019:
	if date[1] > 5:
		print("Heisei")
else:
	print("TBD")


date = map(int, input().split("/"))
if date[0] > 2019:
	if date[1] > 5:
		print("Heisei")
else:
	print("TBD")


date = list(map(int, input().split("/")))
if date[0] >= 2019 and date[1] >= 5:
	print("TBD")
else:
  print("Heisei")


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import bisect
I = lambda n: [int(input()) for _ in range(n)]
def f(S, x):
    p = bisect.bisect_left(S, x)
    return min([S[p-1], S[p]], key = lambda s: abs(x-s))
g = lambda x, s, t: abs(x-s)+abs(s-t)
INF = 10**18
a, b, q = map(int, input().split())
S, T, X = [-INF]+I(a)+[INF], [-INF]+I(b)+[INF], I(q)
for x in X:
    s, t = f(S, x), f(T, x)
    print(min(g(x, s, f(T, s)), g(x, t, f(S, t))))

s = int(input().replace('/', ''))
print(['Heisei', 'TBD'][s > 20190430])

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
lis = list(input().split("/"))
if lis[1] <= 4:
  print("Heisei")
else:
  print("TBD")

lis = list(map(int,input().split("/")))
if lis[1] <= 4:
  print("Heisei")
else:
  print("TBD")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
S=input()
Y=S[0:4]
M=S[5:7]
D=S[7:9]
YMD=int(Y+M+D)
if YMD<=20190430:
  print("Heisei")
else:
  print("TBD")

S=input()
Y=S[0:4]
M=S[5:7]
D=S[8:10]
YMD=int(Y+M+D)
if YMD<=20190430:
  print("Heisei")
else:
  print("TBD")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a = input()
d = 'Heisei'
if int(a[0:4]) ==2019:
  if int(a[5:7]) == 4:
    if int(a[8:10]) == 30:
      break
    elif int(a[8:10]) <30:
      d = 'TBD'
    else:
      break
  elif int(a[5:7]) <=3:
    d = 'TBD'
  else:
    break
elif int(a[0:4]) <= 2018:
  d = 'TBD'
else:
  break
print(d)

a = input()
d = 'TBD'
if int(a[0:4]) ==2019:
  if int(a[5:7]) == 4:
    if int(a[8:10]) <=30:
      d = 'Heisei'
  elif int(a[5:7]) <=3:
    d = 'Heisei'
elif int(a[0:4]) <= 2018:
  d = 'Heisei'
print(d)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
s = input()

if int(s[6])<4:
    ans = "TBD"
elif int(s[6]) == 4:
    if int(s[8])<3:
        ans = "Heisei"
    else:
        ans = "TBD"
else:
    ans = "Heisei"

print(ans)

s = input()

if int(s[6])<4:
    ans = "Heisei"
elif int(s[6]) == 4:
    if int(s[8])<3:
        ans = "Heisei"
    else:
        ans = "TBD"
else:
    ans = "TBD"

print(ans)

s = input()

if int(s[5]) == 0 and int(s[6])<=4:
    ans = "Heisei"
else:
    ans = "TBD"

print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
Y, M, D = list(map(int, input().split("/")))
s = ''.join([Y,M,D])

if s>20190430:
    print("TBD")
else:
    print("Heisei")

s = input()
ss = s.split('/')
sss = ''.join(ss)

if sss>20190430:
    print("TBD")
else:
    print("Heisei")

Y, M, D = list(map(int, input().split("/")))
s = ''.join([Y,M,D])

if int(s)>20190430:
    print("TBD")
else:
    print("Heisei")


s = ''.join(input().split('/'))
if s>20190430:
    print("TBD")
else:
    print("Heisei")

s = input()
ss = s.replase('/','')

if ss>20190430:
    print("TBD")
else:
    print("Heisei")

Y, M, D = map(int, input().split("/"))
s = ''.join([Y,M,D])

if int(s)>20190430:
    print("TBD")
else:
    print("Heisei")


s = input()
ss = s.aplit('/')
sss = ''.join(ss)

if sss>20190430:
    print("TBD")
else:
    print("Heisei")

Y, M, D = map(str, input().split("/"))
s = ''.join([Y,M,D])

if int(s)>20190430:
    print("TBD")
else:
    print("Heisei")

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
s = input()
if s[5::6] <= 04 and s[8::9] <= 30:
  print("Heisei")
else:
  print("TBD")

s = input()
if s[0::3] <= "2019" and s[5::6] <= "04" and s[8::9] <= "30":
  print("Heisei")
else:
  print("TBD")

s = input()
if s[5::6] >= "04" and s[8::9] >= "30":
  print("Heisei")
else:
  print("TBD")

s = int(input())
if a[5]+a[6] > 4:
  print("Heisei")
else:
  print("TBD")


s = input()
if a[5]+a[6] > 4:
  print("Heisei")
else:
  print("TBD")

s = input()
if s <= "2019/04/30":
  print("Heisei")
else:
  print("TBD")

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
S = str(input())

listS = S.split('/')

if int(listS[0]) < 2019:
    print('Heisei')
elif int(listS[0]) == 2019:
    print('a')
    if int(listS[1]) < 5:
        print('Heisei')
    else:
        print('TBD')
else:
    print('TBD')

S = str(input())

listS = S.split('/')

if int(listS[0]) < 2019:
    print('Heisei')
elif int(listS[0]) == 2019:
    if int(listS[1]) < 5:
        print('Heisei')
    else:
        print('TBD')
else:
    print('TBD')

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
M = [[i for i in input().split()] for i in range(N)]
C = 0

for i in range(N):
    if M[i][1] == 'JPY':
        C += int(M[i][0])
    elif M[i][1] == 'BTC':
        C += float(M[i][0])*380000

print(C)

y, m ,d = map(int, input().split('/'))

A = None

if y > 2019 :
    A = 'TBD'
elif m > 4 :
    A = 'TBD'
elif d > 30 :
    A = 'TBD'
else:
    A = 'Heisei'
    
print(A)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
S = input()
if int(s[5]) == 0 and int(s[6]) <= 4 :
    print('Heisei')
else :
    print('TBD')

s = input()
if int(s[5]) == 0 and int(s[6]) <= 4 :
    print('Heisei')
else :
    print('TBD')

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a, b, c = [int(i) for i in input().split("/")]
if a >= 2019:
    if b >= 4:
        if c >=30:
            print("TBD")
        else:
            print("Heisei")
    else:
        print("Heisei")
else:
    print("Heisei")


a, b, c = [int(i) for i in input().split("/")]
if a == 2019 and b > 4:
    print("TBD")
else:
    print("Heisei")

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
S = input()

A = S.split('/')

if int(A[0]) <= 2019 and int(A[1]) <= 4:
    print("heisei")
else:
  print("TBD")
  

S = input()

A = S.split('/')

if int(A[0]) == 2019 and int(A[1]) <= 4:
    print("heisei")
elif int(A[0]) < 2019:
  print("heisei")
else:
  print("TBD")
  


S = input()

A = S.split('/')

if int(A[0]) == 2019 and int(A[1]) <= 4:
    print("Heisei")
elif int(A[0]) < 2019:
  print("Heisei")
else:
  print("TBD")
  


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a = list(map(int,input().split("/"))

if a[0]>= 2019:
    print("Heisei")
else:
    print("TBD")



a = list(map(int,input().split("/"))

if  a[0]>= 2019
    print("Heisei")
else:
    print("TBD")


a = list(map(int,input().split())

del a[4]
del a[7]

b =sum(a)
q = 19
if q <=a:
    print("Heisei")
else :
    print("TBD")

a = list(map(int,input().split("/"))

if a[0]== 2019 and a[1]<=430 or a[0]<2019 :
    print('Heisei')
else:
   print('TBD')

a = list(map(int,input().split("/")))



if a[0]== 2019 and a[1]<5:
    print("Heisei")
elif a[0]<2019 and a[1]< 12:
    print("Heisei")
else:
    print("TBD")

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9
def dfs(cur, a, b, c):
	if cur == N:
	return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
	ret0 = dfs(cur + 1, a, b, c)
	ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
	ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
	ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
	return min(ret0, ret1, ret2, ret3)
print(dfs(0, 0, 0, 0))

N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9
def dfs(cur, a, b, c):
	if cur == N:
		return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
	ret0 = dfs(cur + 1, a, b, c)
	ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
	ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
	ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
	return min(ret0, ret1, ret2, ret3)
print(dfs(0, 0, 0, 0))

Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
read = input
read = Read(False, """


8 1000 800 100
300
333
400
444
500
555
600
666

""").read
tmp = read()
tmp = list(map(int, tmp.split(' ')))
N,A,B,C = tmp
opt = list(map(int, map(lambda x: read(), range(N))))
def dfs(n,a,b,c):
    ret = 10**7
    if(n == N):
        if(min(a,b,c) == 0):
            return ret
        return abs(A - a) + abs(B - b) + abs(C - c) - 30
    cur = opt[n]
    ret = min(ret, dfs(n+1, a + cur, b, c) + 10)
    ret = min(ret, dfs(n+1, a, b + cur, c) + 10)
    ret = min(ret, dfs(n+1, a, b ,c + cur) + 10)
    ret = min(ret, dfs(n+1, a, b ,c ) + 0)
    return ret
print(dfs(0, 0, 0, 0))

read = input
# read = Read(False, """


# 8 1000 800 100
# 300
# 333
# 400
# 444
# 500
# 555
# 600
# 666

# """).read
tmp = read()
tmp = list(map(int, tmp.split(' ')))
N,A,B,C = tmp
opt = list(map(int, map(lambda x: read(), range(N))))
def dfs(n,a,b,c):
    ret = 10**7
    if(n == N):
        if(min(a,b,c) == 0):
            return ret
        return abs(A - a) + abs(B - b) + abs(C - c) - 30
    cur = opt[n]
    ret = min(ret, dfs(n+1, a + cur, b, c) + 10)
    ret = min(ret, dfs(n+1, a, b + cur, c) + 10)
    ret = min(ret, dfs(n+1, a, b ,c + cur) + 10)
    ret = min(ret, dfs(n+1, a, b ,c ) + 0)
    return ret
print(dfs(0, 0, 0, 0))

Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
def main():
    minmp = 10000000
    def dfs(depth, pt):

        if depth==n:
            mp_tmp = 0
            all_used = True
            for k in range(3):
                if pt.count(k) == 0:
                    all_used = False
                    break

                sum_tmp = 0
                mp_tmp += (pt.count(k) - 1)*10
                for l in range(n):
                    if pt[l] == k:
                        sum_tmp += moto[l]
                
                mp_tmp += abs(sum_tmp-take[k])

            if all_used == True:
                global minmp
                minmp = min(minmp,mp_tmp)
                return
            else:
                return

        for i in range(4):
            pt[depth] = i
            dfs(depth+1, pt)

        return

    
    n,a,b,c = map(int,input().split())
    moto = [int(input()) for i in range(n)]


    take = []
    take.append(a)
    take.append(b)
    take.append(c)

    pt  = [3]*n
    for i in range(n):
        dfs(i,pt)

    print(minmp)

main()

minmp = 10000000
def main():
    def dfs(depth, pt):

        
        if depth==n:
            mp_tmp = 0
            all_used = True
            for k in range(3):
                if pt.count(k) == 0:
                    all_used = False
                    break

                sum_tmp = 0
                mp_tmp += (pt.count(k) - 1)*10
                for l in range(n):
                    if pt[l] == k:
                        sum_tmp += moto[l]
                
                mp_tmp += abs(sum_tmp-take[k])

            if all_used == True:
                global minmp
                minmp = min(minmp,mp_tmp)
            
            return

        
        for i in range(4):
            pt[depth] = i
            dfs(depth+1, pt)

        return

    
    take = [0]*3
    n,take[0],take[1],take[2] = map(int,input().split())
    moto = [int(input()) for i in range(n)]

    pt  = [3]*n
    for i in range(n):
        dfs(i,pt)

    print(minmp)

main()

Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
N, A, B, C = map(int, input().split(' '))
L = [int(input()) for i in range(N)]

MAX = 10 ** 9

def dfs(cur, a, b, c):
  if cur == N:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else MAX
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + L[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + L[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + L[cur]) + 10
  print(ret0,ret1,ret2,ret3)
  return min(ret0,ret1,ret2,ret3)
print(dfs(0, 0, 0, 0))

N, A, B, C = map(int, input().split(' '))
L = [int(input()) for i in range(N)]

MAX = 10 ** 9

def dfs(cur, a, b, c):
  if cur == N:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else MAX
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  print(ret0,ret1,ret2,ret3)
  return min(ret0,ret1,ret2,ret3)
print(dfs(0, 0, 0, 0))

N, A, B, C = map(int, input().split(' '))
L = [int(input()) for i in range(N)]

MAX = 10 ** 9

def dfs(cur, a, b, c):
  if cur == N:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else MAX
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + L[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + L[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + L[cur]) + 10
  return min(ret0,ret1,ret2,ret3)
print(dfs(0, 0, 0, 0))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
import sys
from collections import deque
input = sys.stdin.readline

N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10**9

def dfs(cur, a, b, c):
    if cur == N:
        if min(a, b, c) > 0:
            return abs(a-A) + abs(b-B) + abs(c-C) - 30　
        else:
            return INF 
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))

import sys
from collections import deque
input = sys.stdin.readline

N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10**9

def dfs(cur, a, b, c):
    if cur == N:
        if min(a, b, c) > 0:
            return abs(a-A) + abs(b-B) + abs(c-C) - 30 
        else:
            return INF 
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))

Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
N, A, B, C = [int(item) for item in input().split()]

take = [int(input()) for i in range(N)]

def dfs(n, a, b, c):
  if n == N:
    return abs(a - A) + abs(b - B) + abs(c - C) if min(a, b, c) > 0 else 10**9
  ret0 = dfs(n+1, a+take[n], b, c)
  ret1 = dfs(n+1, a, b+take[n], c)
  ret2 = dfs(n+1, a, b, c+take[n])
  ret3 = dfs(n+1, a, b, c)
  return min(ret0, ret1, ret2, ret3)

ans = dfs(0, 0, 0, 0)
print(ans)

N, A, B, C = [int(item) for item in input().split()]

take = [int(input()) for i in range(N)]

def dfs(n, a, b, c):
  if n == N:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else 10**9
  ret0 = dfs(n+1, a+take[n], b, c) + 10
  ret1 = dfs(n+1, a, b+take[n], c) + 10
  ret2 = dfs(n+1, a, b, c+take[n]) + 10
  ret3 = dfs(n+1, a, b, c)
  return min(ret0, ret1, ret2, ret3)

ans = dfs(0, 0, 0, 0)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
n,a,b,c=map(int,input().split())
l=[]
for i in range(n):
    l.append(int(input()))

def solve(w,x,y,z):
    if w==n:
        if min(x,y,z)>0:
            return abs(x-a)+abs(y-b)+abs(z-c)-30
        else:
            return 10e4
        can0=solve(w+1,x,y,z)
        can1=solve(w+1,x+l[w],y,z)+10
        can2=solve(w+1,x,y+l[w],z)+10
        can3=solve(w+1,x,y,z+l[w])+10
        return min(can0,can1,can2,can3)

print(solve(0,0,0,0))


n,a,b,c=map(int,input().split())
l=[]
for i in range(n):
    l.append(int(input()))

def solve(w,x,y,z):
    if w==n:
        if min(x,y,z)>0:
            return abs(x-a)+abs(y-b)+abs(z-c)-30
        else:
            return 10e4
    can0=solve(w+1,x,y,z)
    can1=solve(w+1,x+l[w],y,z)+10
    can2=solve(w+1,x,y+l[w],z)+10
    can3=solve(w+1,x,y,z+l[w])+10
    return min(can0,can1,can2,can3)

print(solve(0,0,0,0))


Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):

N, len_A, len_B, len_C = map(int, input().split())
l = [int(input()) for i in range(N)]
print(l)
ans = 10 ** 9
pattern = 4 ** N
A = [0] * pattern
B = [0] * pattern
C = [0] * pattern
cost = [0] * pattern
for ite in range(pattern):
    ite_2 = 0
    ite_2 += ite
    A[ite], B[ite], C[ite] = [], [], []
    for j in range(N):
        if ite_2 % 4 == 0:
            A[ite].append(l[j])
        elif ite_2 % 4 == 1:
            B[ite].append(l[j])
        elif ite_2 % 4 == 2:
            C[ite].append(l[j])
        ite_2 = ite_2 // 4
    if len(A[ite]) == 0 or len(B[ite]) == 0 or len(C[ite]) == 0:
        continue
    len_A_magic, len_B_magic, len_C_magic = 0, 0, 0
    for p in A[ite]:
        len_A_magic += p
    for q in B[ite]:
        len_B_magic += q
    for r in C[ite]:
        len_C_magic += r
    cost[ite] += (len(A[ite]) - 1) * 10+abs(len_A-len_A_magic)
    cost[ite] += (len(B[ite]) - 1) * 10+abs(len_B-len_B_magic)
    cost[ite] += (len(C[ite]) - 1) * 10+abs(len_C-len_C_magic)
    if ans > cost[ite]:
        ans = cost[ite]

print(ans)



N, len_A, len_B, len_C = map(int, input().split())
l = [int(input()) for i in range(N)]

ans = 10 ** 9
pattern = 4 ** N
A = [0] * pattern
B = [0] * pattern
C = [0] * pattern
cost = [0] * pattern
for ite in range(pattern):
    ite_2 = 0
    ite_2 += ite
    A[ite], B[ite], C[ite] = [], [], []
    for j in range(N):
        if ite_2 % 4 == 0:
            A[ite].append(l[j])
        elif ite_2 % 4 == 1:
            B[ite].append(l[j])
        elif ite_2 % 4 == 2:
            C[ite].append(l[j])
        ite_2 = ite_2 // 4
    if len(A[ite]) == 0 or len(B[ite]) == 0 or len(C[ite]) == 0:
        continue
    len_A_magic, len_B_magic, len_C_magic = 0, 0, 0
    for p in A[ite]:
        len_A_magic += p
    for q in B[ite]:
        len_B_magic += q
    for r in C[ite]:
        len_C_magic += r
    cost[ite] += (len(A[ite]) - 1) * 10+abs(len_A-len_A_magic)
    cost[ite] += (len(B[ite]) - 1) * 10+abs(len_B-len_B_magic)
    cost[ite] += (len(C[ite]) - 1) * 10+abs(len_C-len_C_magic)
    if ans > cost[ite]:
        ans = cost[ite]

print(ans)


Verdicts: Wrong Answer

Accepted