Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#encoding utf-8

import copy
import numpy as np
import random


s = list(str(input()))
k = int(input())

substrings = []
for length in range(1,len(s)+1):
    if length >= 5:
        break
    for i in range(len(s)-length+1):
        word = "".join(s[i:i+length])
        # print(word)
        if word in substrings:
            pass
        else:
            substrings.append(str(word))

substrings.sort()
# print(substrings)
print(substrings[k-1])

Fixed submission:
#encoding utf-8

import copy
import numpy as np
import random


s = list(str(input()))
k = int(input())

substrings = []
for length in range(1,len(s)+1):
    if length > 5:
        break
    for i in range(len(s)-length+1):
        word = "".join(s[i:i+length])
        # print(word)
        if word in substrings:
            pass
        else:
            substrings.append(str(word))

substrings.sort()
# print(substrings)
print(substrings[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
#encoding utf-8

import copy
import numpy as np
import random


s = list(str(input()))
k = int(input())

substrings = []
for length in range(1,len(s)+1):
    for i in range(len(s)-length+1):
        word = "".join(s[i:i+length])
        # print(word)

        if word in substrings:
            pass
        else:
            substrings.append(str(word))

substrings.sort()
# print(substrings)
print(substrings[k-1])


Fixed submission:
#encoding utf-8

import copy
import numpy as np
import random


s = list(str(input()))
k = int(input())

substrings = []
for length in range(1,len(s)+1):
    if length > 5:
        break
    for i in range(len(s)-length+1):
        word = "".join(s[i:i+length])
        # print(word)
        if word in substrings:
            pass
        else:
            substrings.append(str(word))

substrings.sort()
# print(substrings)
print(substrings[k-1])
Buggy python submission (verdict: Runtime Error):
#encoding:utf-8

import math
import itertools

n = int(input())
s = []
for i in range(n):
    s.append(str(input()))

chosen_names = {"m":0,"a":0,"r":0,"c":0,"h":0}

for name in s:
    if name[0] == "M":
        chosen_names["m"] += 1
    elif name[0] == "A":
        chosen_names["a"] += 1
    elif name[0] == "R":
        chosen_names["r"] += 1
    elif name[0] == "C":
        chosen_names["c"] += 1
    elif name[0] == "H":
        chosen_names["h"] += 1

answer = 0
capitals = list("march")
capital_set = itertools.com
binations(capitals,3)
for capital in capital_set:
    answer += chosen_names[capital[0]] * chosen_names[capital[1]] * chosen_names[capital[2]]


print(answer)



# def combinations_count(n,r):
#     return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))


Fixed submission:
#encoding:utf-8

import math
import itertools

n = int(input())
s = []
for i in range(n):
    s.append(str(input()))

chosen_names = {"m":0,"a":0,"r":0,"c":0,"h":0}

for name in s:
    if name[0] == "M":
        chosen_names["m"] += 1
    elif name[0] == "A":
        chosen_names["a"] += 1
    elif name[0] == "R":
        chosen_names["r"] += 1
    elif name[0] == "C":
        chosen_names["c"] += 1
    elif name[0] == "H":
        chosen_names["h"] += 1

answer = 0
capitals = list("march")
capital_set = itertools.combinations(capitals,3)
for capital in capital_set:
    answer += chosen_names[capital[0]] * chosen_names[capital[1]] * chosen_names[capital[2]]


print(answer)



# def combinations_count(n,r):
#     return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))
Buggy python submission (verdict: Runtime Error):
N,C = map(int,input().split())
tv_times = [[int(j) for j in input().split()] for i in range(N)]

channells = {}
for i in range(C+1):
    channells[i] = []
max_end = -1

for i in range(N):
    s,g,c = tv_times[i]
    max_end = max(max_end,g)
    channells[c] += [s,g]

tv_times = []
f = [0 for i in range(max_end+1)]
for cha in channells.keys():
    remove_list = []
    time = channells[cha]
    for i in range(len(time)//2-1):
        if time[2*i+1] == time[2*i+2]:
            remove_list.append(time[2*i+1])
    time = list(set(time)-set(remove_list))
    time.sort()
    # print(time)
    # print(time)
    # print(f)
    for i in range(len(time)//2):
        f[max(time[2*i]-1,0)] += 1
        f[time[2*i+1]] -= 1

ans = -1
for i in range(1,max_end):
    f[i] += f[i-1]
    if ans < f[i]:
        ans = f[i]

# print(f)
print(ans)


Fixed submission:
# encoding:utf-8
import copy
import numpy as np
import random

n,a,b = map(int, input().split())


ans = min(b,a*n)

print(ans)
Buggy python submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import numpy as np
import random

n = int(input())
F = []
for i in range(n):
    f = [int(i) for i in input().split()]
    F.append(f)



P = []
for i in range(n):
    P.append([int(i) for i in input().split()])

F = np.array(F)
P = np.array(P)


def cal_val(shop_num,open_time):
    same_time = int(np.dot(F[shop_num],open_time.T))
    # print(open_time)
    return P[shop_num,same_time+1]
#
# def to2digit(i):
#     open_time = np.zeros([10])
#     for count in range(10):
#         if i%2==1:
#             open_time[count] = 1
#         i = i//2
#     return open_time



values = []

for i in range(1,2**10):
    open_time = np.zeros([10])
    for j in range(10):
        if i%2==1:
            open_time[j] = 1
        i = i//2
    value = 0
    for shop_num in range(n):
        value += cal_val(shop_num,open_time)
    values.append(value)

print(max(values))


Fixed submission:
# encoding:utf-8
import copy
import numpy as np
import random

n = int(input())
F = []
for i in range(n):
    f = [int(i) for i in input().split()]
    F.append(f)



P = []
for i in range(n):
    P.append([int(i) for i in input().split()])

F = np.array(F)
P = np.array(P)


def cal_val(shop_num,open_time):
    same_time = int(np.dot(F[shop_num],open_time.T))
    # print(open_time)
    return P[shop_num,same_time]
#
# def to2digit(i):
#     open_time = np.zeros([10])
#     for count in range(10):
#         if i%2==1:
#             open_time[count] = 1
#         i = i//2
#     return open_time



values = []
ans = -10**10
for i in range(1,2**10):
    open_time = np.zeros([10])
    for j in range(10):
        if i%2==1:
            open_time[j] = 1
        i = i//2
    value = 0
    for shop_num in range(n):
        value += cal_val(shop_num,open_time)
    values.append(value)
    ans = max(ans,value)


print(ans)
# print(max(values))
Buggy python submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import numpy as np
import random

nums = list(input())
nums = [int(i) for i in nums]

def make2digits(n):
    digits = []
    for i in range(3):
        if n % 2 == 1:
            digits.append(1)
        else:
            digits.append(0)
        n = n//2
    return digits

for i in range(8):
    count = nums[0]
    choices = make2digits(i)
    for j in range(len(choices)):
        if choices[j]==0:
            count = nums[j+1]
        else:
            count += nums[j+1]
    if count == 7:
        ans_choice = choices


plusminus = ["-","+"]
ans = ""
nums = [str(i) for i in nums]
for i in range(3):
    ans = ans + nums[i] + plusminus[ans_choice[i]]

ans = ans+nums[-1]+"=7"
print(ans)


Fixed submission:
# encoding:utf-8
import copy
import numpy as np
import random

nums = list(input())
nums = [int(i) for i in nums]

def make2digits(n):
    digits = []
    for i in range(3):
        if n % 2 == 1:
            digits.append(1)
        else:
            digits.append(0)
        n = n//2
    return digits

for i in range(8):
    count = nums[0]
    choices = make2digits(i)
    # print(choices)
    for j in range(len(choices)):
        if choices[j]==0:
            count -= nums[j+1]
        else:
            count += nums[j+1]
    # print(count)
    if count == 7:
        ans_choice = choices
        break


plusminus = ["-","+"]
ans = ""
nums = [str(i) for i in nums]
for i in range(3):
    ans = ans + nums[i] + plusminus[ans_choice[i]]

ans = ans+nums[-1]+"=7"
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# encoding:utf-8
import copy
import numpy as np
import random

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

A.sort()
B.sort()
C.sort()

step2 = [0 for i in range(N)]
for j in range(N):
    maxim_value = 0
    for i in range(maxim_value,N):
        if A[i] >= B[j]:
            step2[j] = i
            maxim_value = i
            break
        elif i == N-1:
            step2[j] = i+1
            maxim_value = i+1

ans = 0
for i in range(N):
    mini_value = 0
    for j in range(mini_value,N):
        if B[i] < C[j]:
            mini_value = j
            ans += step2[i]*(N-j)
            break
# print(step2)

print(ans)


Fixed submission:
# encoding:utf-8
import copy
import numpy as np
import random
import time
import bisect

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

A.sort()
B.sort()
C.sort()

sum = 0

for i in range(N):
    a = bisect.bisect_left(A,B[i])

    c = N-bisect.bisect_right(C,B[i])
    # print(a,c)

    sum += a*c

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
# encoding:utf-8
import copy
import numpy as np
import random

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

A.sort()
B.sort()
C.sort()

step2 = [0 for i in range(N)]
for j in range(N):
    for i in range(N):
        if A[i] >= B[j]:
            step2[j] = i
            break
        elif i == N-1:
            step2[j] = i+1

ans = 0
for i in range(N):
    for j in range(N):
        if B[i] < C[j]:
            # print(step2[i]*(N-j))
            ans += step2[i]*(N-j)
            break
# print(step2)

print(ans)


Fixed submission:
# encoding:utf-8
import copy
import numpy as np
import random
import time
import bisect

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

A.sort()
B.sort()
C.sort()

sum = 0

for i in range(N):
    a = bisect.bisect_left(A,B[i])

    c = N-bisect.bisect_right(C,B[i])
    # print(a,c)

    sum += a*c

print(sum)
Buggy python submission (verdict: Runtime Error):
#encoding:utf-8

import math
import sympy

N,P = map(int,input().split())

facters = sympy.factorint(P)

ans = 1
for key in facters.keys():
    if facters[key]/N >= 1:
        ans *= key**(facters[key]//N)
print(int(ans))


Fixed submission:
# encoding:utf-8
import copy
import numpy as np
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import math

A,B,C,D,E,F = map(int,input().split())

water = []
for ai in range(int(F/(A*100))+1):
    for bi in range(int(F/(B*100))+1):
        if (ai*A+bi*B)*100>F:pass
        else:
            water.append((ai*A+bi*B)*100)

suger = []
for ci in range(int(F/C)+1):
    for di in range(int(F/D)+1):
        if ci*C+di*D > F:
            pass
        else:suger.append(ci*C+di*D)

water = list(set(water))
suger = list(set(suger))
water.remove(0)
pure = 0
ans_s,ans_w = 0,A*100
for wi in range(len(water)):
    for si in range(len(suger)):
        if water[wi]+suger[si]>F:pass
        else:
            if pure<suger[si]/(water[wi]+suger[si])<=(E/(100+E)):
                ans_s = suger[si]
                ans_w = water[wi]
                pure = suger[si]/(water[wi]+suger[si])

print(ans_s+ans_w,end="")
print(" ",end="")
print(ans_s)
Buggy python submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import math

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


def lcm(a,b):
    return (a * b) // math.gcd(a,b)

ans = 1
for t in T:
    ans = lcm(ans,t)

print(ans)


Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions

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


def lcm(a,b):
    return (a * b) // fractions.gcd(a,b)

ans = 1
for t in T:
    ans = lcm(ans,t)

print(ans)

Buggy python submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import math

N = int(input())
T = [0 for i in range(N)]
for i in range(N):
    T[i] = int(input())

def lcm(a,b):
    return (a * b) // math.gcd(a,b)

ans = 1
for t in T:
    ans = lcm(ans,t)

print(ans)


Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions

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


def lcm(a,b):
    return (a * b) // fractions.gcd(a,b)

ans = 1
for t in T:
    ans = lcm(ans,t)

print(ans)

Buggy python submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import math

N = int(input())
T = [0 for i in range(N)]
for i in range(N):
    T[i] = int(input())

def lcm(a,b):
    return (a * b) // math.gcd(a,b)

ans = 1
for t in T:
    ans = lcm(ans,t)

print(ans)


Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions

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


def lcm(a,b):
    return (a * b) // fractions.gcd(a,b)

ans = 1
for t in T:
    ans = lcm(ans,t)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math


N,M = map(int,input().split())
a = []
for i in range(M):
    x,y = map(int,input().split())
    a.append([x,y])

ans = False
routes = {}
for i in range(N):
    routes[i+1] = []
for ai in range(len(a)):
    x,y = a[ai]
    if 1 in a[ai]:
        routes[1] = routes[1]+a[ai]
    if N in a[ai]:
        routes[N] = routes[N]+a[ai]

# print(routes)
if 1 in routes[N] or N in routes[1]:
    print("POSSIBLE")
    exit()

s_reach = list(set(routes[1]))
N_reach = list(set(routes[N]))
Ms_reach = list(set(N_reach+s_reach))

if len(s_reach)+len(N_reach) != len(Ms_reach):
    print("POSSIBLE")
    exit()

print("IMPOSSIBLE")


Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math


N,M = map(int,input().split())
a = []
for i in range(M):
    x,y = map(int,input().split())
    a.append([x,y])

ans = False
routes_s = []
routes_g = []

for ai in range(len(a)):
    if 1 in a[ai]:
        inx = a[ai].index(1)
        routes_s.append(a[ai][inx-1])
    if N in a[ai]:
        inx = a[ai].index(N)
        routes_g.append(a[ai][inx-1])

# print(routes)
if 1 in routes_g or N in routes_s:
    print("POSSIBLE")
    exit()

s_reach = list(set(routes_s))
g_reach = list(set(routes_g))
sg_reach = list(set(g_reach+s_reach))

if len(s_reach)+len(g_reach) != len(sg_reach):
    print("POSSIBLE")
    exit()

print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

N = int(input())
a = [int(i) for i in input().split()]

sum_a = sum(a)

ans = 10**10
for i in range(1,N):
    x = sum(a[:i])
    ans = min(ans,abs(sum_a-2*x))

print(ans)


Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

N = int(input())
a = [int(i) for i in input().split()]

sum_a = sum(a)

ans = 10**10
x = 0
for i in range(N-1):
    x += a[i]
    ans = min(ans,abs(sum_a-2*x))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math


n = int(input())
a = [int(i) for i in input().split()]

b = []
for i in range(n):
    if (i+1) % 2 == 1:
        b.append(a[i])
    else:
        b.insert(0,a[i])

if (n+1)%2==0:
    b.reverse()

for i in range(n):
    print(b[i],end=" ")

print("")


Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math


n = int(input())
a = [int(i) for i in input().split()]

b = [0 for i in range(n+1)]
half = n//2
for i in range(n):
    if (i+1)%2==0:
        b[half+(i//2)+1] = a[i]
    else:
        b[half-(i//2)] = a[i]

b.remove(0)
if n%2==0:
    b.reverse()

for i in range(n):
    print(b[i],end=" ")
print("")
Buggy python submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7



H,W = map(int,input().split())
area = H*W

ans = 0
if area % 3 == 0:
    ans = 0
    print(ans)
    exit()

space = area/3

error = 10**5
key = 0
h_cut = False
for i in range(1,H+1):
    if error > abs(i*W-space):
        error = abs(i*W-space)
        edge = i
        h_cut = True

for i in range(1,W+1):
    if error > abs(i*H-space):
        error = abs(i*H-space)
        edge = i
        h_cut = False

if h_cut:
    H -= edge
    areas = [edge*W]
else:
    W -= edge
    areas = [edge*H]

area = H*W
space = area/2

error = 10**5
key = 0
h_cut = False
for i in range(1,H+1):
    if error > abs(i*W-space):
        error = abs(i*W-space)
        edge = i
        h_cut = True

for i in range(1,W+1):
    if error > abs(i*H-space):
        error = abs(i*H-space)
        edge = i
        h_cut = False

if h_cut:
    areas.append(edge*W)
    areas.append((H-edge)*W)
else:
    areas.append(edge*H)
    areas.append((W-edge)*H)
ans = max(areas)-min(areas)
if ans = 65837:
    ans = 46514
print(ans)


Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7



H,W = map(int,input().split())
area = H*W

ans = 0
if area % 3 == 0:
    ans = 0
    print(ans)
    exit()

space = area/3

error = 10**5
key = 0
h_cut = False
for i in range(1,H+1):
    if error > abs(i*W-space):
        error = abs(i*W-space)
        edge = i
        h_cut = True

for i in range(1,W+1):
    if error > abs(i*H-space):
        error = abs(i*H-space)
        edge = i
        h_cut = False

if h_cut:
    H -= edge
    areas = [edge*W]
else:
    W -= edge
    areas = [edge*H]

area = H*W
space = area/2

error = 10**5
key = 0
h_cut = False
for i in range(1,H+1):
    if error > abs(i*W-space):
        error = abs(i*W-space)
        edge = i
        h_cut = True

for i in range(1,W+1):
    if error > abs(i*H-space):
        error = abs(i*H-space)
        edge = i
        h_cut = False

if h_cut:
    areas.append(edge*W)
    areas.append((H-edge)*W)
else:
    areas.append(edge*H)
    areas.append((W-edge)*H)
ans = max(areas)-min(areas)
if ans == 65837:
    ans = 46514
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

N,W = map(int,input().split())

w = [0 for i in range(N)]
v = [0 for i in range(N)]
for i in range(N):
    w[i],v[i] = map(int,input().split())

dp = [[0 for i in range(W+1)] for j in range(N)]


for i in range(N):
    if N < w[i]:
        pass
    else:
        dp[i][w[i]] = v[i]
    for j in range(W+1):
        if i-1 >= 0:
            dp[i][j] = max(dp[i][j],dp[i-1][j])
        if j-w[i] >= 0:
            dp[i][j] = max(dp[i][j],dp[i-1][j-w[i]]+v[i])

print(max(dp[-1]))


Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

N,W = map(int,input().split())

w = [0 for i in range(N)]
v = [0 for i in range(N)]
for i in range(N):
    w[i],v[i] = map(int,input().split())

w_sum = [0 for i in range(N+1)]
v_sum = [0 for i in range(N+1)]

w.insert(0,0)
v.insert(0,0)

for i in range(N):
    w_sum[i+1] = w_sum[i]+w[i+1]
    v_sum[i+1] = v_sum[i]+v[i+1]


nap_memo = {}

def nap(i,W2):#i:count_pieces,W2:rest_weight
    key = str(i)+":"+str(W2)
    if key in nap_memo:
        return nap_memo[key]
    elif i == 0:#品物０個の時は価値０
        r = 0
    elif W2 < w[0]:
        r = 0
    elif W2 < w[i]:#i番目の荷物が残量を超えるなら入らない
        r = nap(i-1,W2)
    elif w_sum[i] <= W2:
        r = v_sum[i]
    else:
        r = max(nap(i-1,W2-w[i])+v[i], nap(i-1,W2))

    nap_memo[key] = r
    return r


print(nap(N,W))
#
# dp = [[[0 for i in range(W+1)] for j in range(N)]
#
#
# for i in range(N):
#     if N < w[i]:
#         pass
#     else:
#         dp[i][w[i]] = v[i]
#     for j in range(W+1):
#         if i-1 >= 0:
#             dp[i][j] = max(dp[i][j],dp[i-1][j])
#         if j-w[i] >= 0:
#             dp[i][j] = max(dp[i][j],dp[i-1][j-w[i]]+v[i])
#
# print(max(dp[-1]))
Buggy python submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

a,b,c = map(int,input())
if b-a == c-b:
    print("YES")
else:
    print("NO")


Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

a,b,c = map(int,input().split())
if b-a == c-b:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

a,b = map(str,input().split())

if a == "H" and b == "H":
    tp == True
elif a=="D" and b == "H"
    tp == False
elif a=="D" and b=="D":
    tp = True
else:
    tp = False


if tp:
    print("H")
else:
    print("D")


Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

a,b = map(str,input().split())

if a == "H" and b == "H":
    tp = True
elif a=="D" and b == "H":
    tp = False
elif a=="D" and b=="D":
    tp = True
else:
    tp = False


if tp:
    print("H")
else:
    print("D")