Problem:


Score : 100 points

Problem Statement

Two deer, AtCoDeer and TopCoDeer, are playing a game called Honest or Dishonest.
In this game, an honest player always tells the truth, and an dishonest player always tell lies.
You are given two characters a and b as the input. Each of them is either H or D, and carries the following information:

If a=H, AtCoDeer is honest; if a=D, AtCoDeer is dishonest.
If b=H, AtCoDeer is saying that TopCoDeer is honest; if b=D, AtCoDeer is saying that TopCoDeer is dishonest.

Given this information, determine whether TopCoDeer is honest.

Constraints

a=H or a=D.

b=H or b=D.

Input

The input is given from Standard Input in the following format:

a b

Output

If TopCoDeer is honest, print H. If he is dishonest, print D.

Sample Input 1

H H

Sample Output 1

H

In this input, AtCoDeer is honest. Hence, as he says, TopCoDeer is honest.

Sample Input 2

D H

Sample Output 2

D

In this input, AtCoDeer is dishonest. Hence, contrary to what he says, TopCoDeer is dishonest.

Sample Input 3

D D

Sample Output 3

H



Sample input:
H H


Sample output:
H

Submission status: Runtime Error

Solution code:
a, b = map( int, input().split())
if a == 'H':
    if b == 'H':
        print('H')
    else:
        print('D')
else:
    if b == 'H':
        print('D')
    else:
        print('H')

Submission status: Runtime Error

Solution code:
a,b = map(str,input().split())
H = 1
D = 0
print(a^b)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
if a == 'H':
    print(b)
else:
    if b == 'H':
        print('D')
    else:
        print('H')

Submission status: Runtime Error

Solution code:
x = int(input())
a = 0
for i in range(1, 10 ** 9):
    if a >= x:
        print(i - 1)
        break
    a += i

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if a=='H':
    print('H' if b=='H' else 'D')
else:
    print('D' if b=='H' else 'H')

Submission status: Runtime Error

Solution code:
print("HD"[len(set(input().split()))])

Submission status: Runtime Error

Solution code:
a, b = list(map(int, input().split()))
if a == 'H':
  print(b)
elif b == 'H':
  print('D')
else:
  print('H')

Submission status: Runtime Error

Solution code:
a,b=input()
if a=='H':
    if b=='H':
        print('H')
    else:
        print('D')
else:
    if b=='H':
        print('D')
    else:
        print('H')

Submission status: Runtime Error

Solution code:
a,b = input().split()

ans = 1

if a == "D":
    ans *= -1
if b == "D":
    ans *= -1

if ans = 1:
    print("H")
else:
    print("D")

Submission status: Runtime Error

Solution code:
a, b = input().split()
if a = 'H' and b ='H':
    print('H')
elif a = 'H' and b ='D':
    print('D')
elif a = 'D' and b = 'H':
    print('D')
elif a = 'D' and b = 'D':
    print('H')

Submission status: Runtime Error

Solution code:
if a=='H':
	print(b)
else:
	if b=='H':
		print('D')
	else:
		print('H')

Submission status: Runtime Error

Solution code:
a, b = input()

if a == b:
  print('H')
else:
  print('D')

Submission status: Runtime Error

Solution code:
a,b = map(str , input().split())
if a == "H":
    if b == "H":
        print("H")
    else:
        print("D")
elif b == "H":
        print("D")
    else:
        print("H")

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

if a == 'H' and b == 'H':
    print('H')
elif a == 'H' and b == 'D':
    print('H')
elif a == 'D' and b == 'H':
    print('D')
else:
    print('H')

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

if a == 'H' and b == 'H':
    print('H')
elif a == 'H' and b == 'D':
    print('D')
elif a == 'D' and b == 'H':
    print('D')
else:
    print('H')

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
if a == b:
  print("H")
else:
  print("D")

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
if a == b:
	print("H")
else:
	print("D")

Submission status: Runtime Error

Solution code:
a,b = input().split()
if a==b:
  print(H)
else:
  print(D)

Submission status: Runtime Error

Solution code:
a,b=input().split()
if a=="H":
  f=True
else:
  f=False
if f:
  print("H" if b=="H" else "D")
else:
  print("H" if b=="D" else "D"

Submission status: Runtime Error

Solution code:
if b == 'H':
    print(a)
elif a == b:
    print('H')
else:
    print('D')

Submission status: Runtime Error

Solution code:
a,b = [int(i) for i in input().split()]
if a=='H':
  if b=='H':
    print('H')
  else:
    print('D')
else:
  if b=='H':
    print('D')
  else:
    print('H')

Submission status: Runtime Error

Solution code:
a = input()
b = input()
flag = True
if (a=='H' and b=='H'):
    flag = True
if (a=='H' and b=='D'): 
    flag = False
if (a=='D' and b=='H'): 
    flag = False
if (a=='D' and b=='d'): 
    flag = True
print('H' if flag else 'D')

Submission status: Runtime Error

Solution code:
a = input()
b = input()
flag = true
if (a=='H') and (b=='H')
    flag = true
if (a=='H') and (b=='D') 
    flag = false
if (a=='D') and (b=='H') 
    flag = false
if (a=='D') and (b=='d') 
    flag = true
print(flag?H:D)

Submission status: Runtime Error

Solution code:
a,b=map(str, input().split())

if (a="H" and b="H") or (a="D" and b="D"):
    print("H")
else:
    print("D")

Submission status: Runtime Error

Solution code:
from bisect import bisect_left, bisect_right, insort_left, insort_right


def solve():
    x = int(input())
    cumulative_sum = [(k * (k - 1)) // 2 for k in range(1, 46)]
    target = bisect_left(cumulative_sum, x)
    if x in cumulative_sum:
        print(cumulative_sum.index(x))
    else:
        print(target - 2 + (x - cumulative_sum[target - 1] + 1))


solve()

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
if A == "H" and B == "H":
    print("H")
elif A == "H" and B == "D":
    print("D")
elif A == "D" and B == "H":
    print("D")
else:
    print("H")

Submission status: Runtime Error

Solution code:
def solve():
    a, b = list(map(int, input().split(" ")))
    
    if a == b:
        print("H")
    else:
        print("D")


solve()

Submission status: Runtime Error

Solution code:
N, K = [int(n) for n in input().split()]
A = [int(n) for n in input().split()]

A.sort()

res = []

for n_ex in range(N):
  dp = [[False] * K for n in range(N+1)]
  dp[0][0] = True
  for n in range(N):
    for k in range(0, K):
      dp[n+1][k] = dp[n][k]
    if n != n_ex:
      for k in range(0, K - A[n]):
        if dp[n][k] == True:
          dp[n+1][k+A[n]] = True
  for k in range(K-A[n_ex], K):
    if dp[N][k] == True:
      res.append(n_ex)
      break
print(N-len(res))

Submission status: Runtime Error

Solution code:
a,b = list(int(i) for i in input().split())
if a == 1:
    a = 14
if b == 1:
    b = 14
if a==b:
    print("Draw")
else:
    print("Alice" if a>b else "Bob")

Submission status: Runtime Error

Solution code:
a, b = list(map(int, input().split()))
if (a == 'H' and b == 'H') or (a == 'D' and b == 'D'):
    print('H')
else:
    print('D')

Submission status: Runtime Error

Solution code:
a,b=[int(x) for x in input().split()]
if (a=="H" and b="D") or (a=="D" and b=="H"):
    print("D")
else:
    print("H")

Submission status: Runtime Error

Solution code:
W, a, b = map(int, input().split())

if a + W < b:
    print(b - a - W)
elif a + W == b:
    print(0)
elif (b < a + W) & (a < b):
    print(0)
elif a == b:
    print(0)
elif b < a:
    print(0)
elif a == b + W:
    print(0)
elif b + W < a:
    print(a - b - W)
else:
    pass

Submission status: Runtime Error

Solution code:

if a + W < b:
    print(b - a - W)
elif a + W = b:
    print(0)
elif (b < a + W) & (a < b):
    print(0)
elif a == b:
    print(0)
elif b < a:
    print(0)
elif a = b + W:
    print(0)
elif b + W < a:
    print(a - b - W)
else:
    pass

Submission status: Runtime Error

Solution code:
W, a, b = map(int, input().split())

if a + W < b:
    print(b - a - W)
elif a + W = b:
    print(0)
elif (b < a + W) & (a < b):
    print(0)
elif a == b:
    print(0)
elif b + W <= a:
    print(a - b - W)
else:
    pass

Submission status: Runtime Error

Solution code:
if A == B:
    print("H")
elif A != B:
    print("D")

Submission status: Runtime Error

Solution code:
import sys
N,K=map(int, input().split())
a=list(map(int, input().split()))
sum=0
for i in range(0,N):
  sum+=a[i]
if sum<K:#全部不必要
  print(N)
  sys.exit()
if sum==K:#全部必要
  print(0)
  sys.exit()
a.sort()
a.reverse()

#K未満の最大の数字のラベルはどこ？
l=N
for i in range(N-1,-1,-1):
  if a[i]<K:
    l=i
  else:
    break

if l==N:
  print(N)
  sys.exit()

count=N
#lまでの要素が必要か不要かチェック
for i in range(0,l):
  sum=0
  for j in range(l,N):
    if sum+a[j]<K:
      sum+=a[j]
  if sum+a[i]>=K:#必要ってことだ
    count-=1
#lからの要素は自分のことを抜かないといけないことに注意
for i in range(l,N):
  sum=0
  b=a[:]
  C=b.pop(i)
  for j in range(l-1,N-1):
    if sum+b[j]<K:
      sum+=b[j]
  if sum+C>=K:#必要ってことだ
    count-=1
print(count)

Submission status: Runtime Error

Solution code:
W, a, b = map(int, raw_input().split())
print min(abs(b-a-W), abs(b-a), abs(b+W-a), abs(b-a))

Submission status: Runtime Error

Solution code:
if raw_input() == 'H': print 'H' if raw_input() == 'H' else 'D'
else: print 'H' if raw_input() == 'D' else 'D'

Submission status: Runtime Error

Solution code:
if raw_input() == 'H': print raw_input() == 'H'
else: print raw_input() == 'D'

Submission status: Runtime Error

Solution code:
a, b = (int(i) for i in input().split())

#if a == "H" and b == "H" or a == "D" and b = "D":
if a ==  b
	return "H"
else:
	return "D"

Submission status: Runtime Error

Solution code:
W, a, b = [int(i) for i in input().split()]

if a > b:
    a, b = b, a

print(b-(a+W))

Submission status: Runtime Error

Solution code:
a,b=raw_input().split()
if (a=='H' and b='H') or (a=='D' and b=='D'):
    print 'H'
else:
    print 'D'

Submission status: Runtime Error

Solution code:
a,b = map(char,input().split())

if a == 'H':
   if b = 'H':
      print('H')
   elif b == 'D':
      print('D')
elif a == 'D':
   if b == 'H':
      print('D')
   elif b == 'D':
      print('H')

Submission status: Runtime Error

Solution code:
a,b = map(int, raw_input().split())
if a == "H":
	print b
if a == "D":
	if b == "H":
		print "D"
	else:
		print "H"

Submission status: Runtime Error

Solution code:
def whatIsMinNumber(X_copy,K):
    pickupNum = X_copy[len(X_copy)//2]
    X_rest = X[:]
    X_rest.remove(pickupNum)
    if can_do_number(X_rest,0,K-pickupNum,K-1):
        if len(X_copy) > 2:
            return whatIsMinNumber(X_copy[len(X_copy)//2+1:len(X_copy)],K)
        else:
            return pickupNum
    else:
        if len(X_copy) > 1:
            return whatIsMinNumber(X_copy[0:len(X_copy)//2],K)
        else:
            return pickupNum+1

def can_do_number(X,sum,min,max):
    if len(X) == 0:
        return False
    for i in range(0,len(X)):
        if min <= sum+X[i] <= max:
            return True
        elif min > sum+X[i]:
            X_rest = X[:]
            sum = sum + X_rest.pop(i)
            can_do_number(X_rest,sum,min,max)
        else:
            pass
    return False

N,K = list(map(int, input().split()))
X = list(map(int, input().split()))
X = [6,20,10,4,3,10,25,2]
N = X.pop(0)
K = X.pop(0)
X.sort(reverse = True)
thenum = whatIsMinNumber(X[:],K)
print(len(list(filter((lambda x:x<whatIsMinNumber(X[:],K)),X))))

Submission status: Runtime Error

Solution code:
def whatIsMinNumber(X_copy,K):
    pickupNum = X_copy[len(X_copy)//2]
    X_rest = X[:]
    X_rest.remove(pickupNum)
    if can_do_number(X_rest,pickupNum,K,K+pickupNum-1):
        if len(X_copy) > 2:
            return whatIsMinNumber(X_copy[len(X_copy)//2+1:len(X_copy)],K)
        else:
            return pickupNum
    else:
        if len(X_copy) > 1:
            return whatIsMinNumber(X_copy[0:len(X_copy)//2],K)
        else:
            return pickupNum+1

def can_do_number(X,sum,min,max):
    #残りのカードがない場合はFalseを返す
    if len(X) == 0:
        return False
    #残りのカードで順番に調べる
    for i in range(0,len(X)):
        if min <= sum+X[i] <= max:
            return True
        elif min > sum+X[i]:
            X_rest = X[:]
            sum = sum + X_rest.pop(i)
            can_do_number(X_rest,sum,min,max)
        else:
            pass
    return False

N,K = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort(reverse = True)
thenum = whatIsMinNumber(X[:],K)
print(len(list(filter((lambda x:x<thenum),X))))

Submission status: Runtime Error

Solution code:
X = int(input())
P = {0}
i=1
while True:
    Q = {0}
    for p in P:
        Q.add(p+i)
        Q.add(p-i)
    P = P.union(Q)
    if X in P:
        print(i)
        break
    i = i+1

Submission status: Runtime Error

Solution code:
arg = input().split(' ')
a = arg[0]
b = arg[1]'

if a=='D':
    b = 'D' if b=='H' else 'H'
    
print(b)

Submission status: Runtime Error

Solution code:
x = abs(int(input()))
total = 0
for i in range(x+1):
    total += i
    if total >= x:
        print(i)
        break

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import itertools
N, K = map(int, input().split())
A = list(map(int, input().split()))
unnec = 0
for i in range(0,N):
    B = list(A)
    v = B.pop(i)
    nec = False
    for j in range(len(B),0,-1):
        for l in list(itertools.combinations(B,j)):
            s = sum(l)
            #print("%s, %d, %d" % (str(l), s, v))
            if s >= K:
                continue
            elif s + v >= K:
                nec = True
                break
        if nec == True:
            break
    if nec == False:
        unnec = unnec + 1
print(unnec)

Submission status: Runtime Error

Solution code:
a=input()
b=input()
if a !=b:
    print("H")
else:
    print("D")

Submission status: Runtime Error

Solution code:
l = input().split()

if l[0]==l[1]:
    return "H"
else:
    return "D"

Submission status: Runtime Error

Solution code:
import math
w, a, b = [int(i) for i in input().split()]
if a+w < b:
    print(int(math.fabs(b-a-w)))
elif b+w < a:
    print(int(math.fabs(b+w-a)))
else:
    print(int(0))

Submission status: Runtime Error

Solution code:
import numpy as np
from itertools import product as p
N, K = map(int, input().split())
a = np.array(list(map(int, input().split())))
bs = np.array(list(p((True, False), repeat=N)))

z = np.zeros(N, dtype=int)
ids = np.arange(N)
if sum(a) < K:
 print(0)
else:
 for i in range(N):
  Si = sum(a[bs[i,:]])
  if Si < K: continue
  for j in ids[bs[i,:]]:
   if Si - a[j] < K: z[j] = 1
 print(N-sum(z))

Submission status: Runtime Error

Solution code:
import itertools
N,K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
need = []
iranaiko = []
for a in A:
	if a >= K:
		need.append(a)
	elif a in need:
		need.append(a) 
	elif a in iranaiko:
		pass
	else:
		z = 0
		B = A[:]
		B.remove(a)
		fusoku = [K - i - 1 for i in range(a)]
		for bi,b in enumerate(B):
			if b >= K:
				break
		B = B[:bi + 1]
		for i in range(1,len(B) + 1):
			C = list(itertools.combinations(B,i))
			for c in C:
				if sum(c) in fusoku:
					need.append(a)
					z = 1
					break
			if z == 1:
				break
		if z == 0:
			iranaiko.append(a)
print(N - len(need))

Submission status: Runtime Error

Solution code:
n_vec = list(map(int, input().split()))
n1 = n_vec[0]
n2 = n_vec[1]
n3 = n_vec[2]
def metricf1(w,a,b) :
    if (a+w < b) :
        return b-a-w
    elif (a-w <= b <= a+w) :
        return 0
    else :
        return a-b-w
print(metricf1(n1,n2,n3))

Submission status: Runtime Error

Solution code:
#coding:utf-8
x=int(raw_input())  # 1 # 一つの数字のみ
# w, a, b =map(int,raw_input().split())  # 2 3  # 二つの数字
sums=0
for i in range(14145):
    sums += i
    # if x == place:
    # print sum
    # print i
    if sums < x:
        pass
    elif sums >= x:
        print i
        break

Submission status: Runtime Error

Solution code:
X = int(input())
dist = [0]
prev_dist = [0]
time = 0
while not X in dist:
    time += 1
    for i in prev_dist:
        if not i+time in dist: dist.append(i+time)
        if not i-time in dist: dist.append(i-time)
    prev_dist = dist[:]
print(time)

Submission status: Runtime Error

Solution code:
a, b=map(str,input().split())
if(a=="H"):
	print(b)
else:
	if(b=="H"):
		print(D)
	else:
		print(H)

Submission status: Runtime Error

Solution code:
a = input()
b = input()

if a =="H":
	if b=="H":
		return "H"
	else:
		return "D"
else:
	if b=="H":
		return "D"
	else:
		return "H"

Submission status: Runtime Error

Solution code:
a, b = map(int, raw_input().split())
if a == b:
    print 'H'
else:
    print 'D'

Submission status: Runtime Error

Solution code:
a, b=map(str,input().split())
if(a=='H'):
	print(b)
else:
	if(b=='H'):
		print(D)
	else:
		print(H)

Submission status: Runtime Error

Solution code:
def main(a,b):
	if a =="H":
		if b=="H":
			return "H"
		else:
			return "D"
	else:
		if b=="H":
			return "D"
		else:
			return "H"



a = input()
b = input()
print(main(a,b))

Submission status: Runtime Error

Solution code:
def taskA(a,b):
	if a =="H":
		if b=="H":
			return "H"
		else:
			return "D"
	else:
		if b=="H":
			return "D"
		else:
			return "H"



a = input()
b = input()
print(taskA(a,b))

Submission status: Runtime Error

Solution code:
l = map(int, raw_input().split())

A=l[0]
B=l[1]

if A=='H' and B=='H':
    print('H')

elif A=='H'and B=='D':
    print('D')

elif A=='D' and B=='H':
    print('D')
else:
    print('H')

Submission status: Runtime Error

Solution code:
#l = raw_input().split()
A=l[0]
B=l[1]

if A=='H' and B=='H':
    print('H')

elif A=='H'and B=='D':
    print('D')

elif A=='D' and B=='H':
    print('D')
else:
    print('H')

Submission status: Runtime Error

Solution code:
def main(a,b):
	if a =="H":
		if b=="H":
			return "H"
		else:
			return "D"
	else:
		if b=="H":
			return "D"
		else:
			return "H"

print(main(a,b))

Submission status: Runtime Error

Solution code:
#l = map(str, raw_input().split())

A=l[0]
B=l[1]

if A=='H' and B=='H':
    print('H')

elif A=='H'and B=='D':
    print('D')

elif A=='D' and B=='H':
    print('D')
else:
    print('H')

Submission status: Runtime Error

Solution code:
a, b = raw_input.split()

if a == "H":
    print b
else:
    if b == "H":
        print "D"
    else:
        print "H"

Submission status: Runtime Error

Solution code:
def main(a,b):
	if a =="H":
		if b=="H":
			return "H"
		else:
			return "D"
	else:
		if b=="H":
			return "D"
		else:
			return "H"

print(main())

Submission status: Runtime Error

Solution code:
a, b = input().split()

if a == b:
 print('H')
else:
 print('D')s

Submission status: Runtime Error

Solution code:
def main():
    w, a, b = map(int, input().split())
    if a <= b <= a + w or b <= a <= b + w:
        print(0)
    else:
        print(min(abs(a + w - b), abs(b + w - a)))


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
if a =="H":
	if b=="H":
		return "H"
	else:
		return "D"
else:
	if b=="H":
		return "D"
	else:
		return "H"

Submission status: Runtime Error

Solution code:
a,b = input().split(' ')

if a == "H":
    print(b)
else if b == "H":
    print(a)
else:
    print("H")

Submission status: Runtime Error

Solution code:

	if a =="H":
		if b=="H":
			return "H"
		else:
			return "D"
	else:
		if b=="H":
			return "D"
		else:
			return "H"

Submission status: Runtime Error

Solution code:
a,b = input().split()

if a == "H":
    print(b)
else if b == "H":
    print(a)
else:
    print("H")

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

a, b = map(str, raw_input().split())
result = ''
if a == ‘H’:
	if b== ‘H’:
		result = ‘H’
	else:
		result = ‘D’
else:
	if b==‘H’
		result=‘D’
	else:
		result=‘H'

# 出力
print result