Harryxun/stf_run huggingface dataset:
# import numpy as np
import sys
sys.setrecursionlimit(10000)
e = 1000000000 + 7
N = 1000000 // 3
# dp = np.zeros((N, N))
memo = {}
for n in range(N):
	s = "n: {}, k: {}".format(n, 0)
	memo[s] = 1
	s = "n: {}, k: {}".format(n, n)
	memo[s] = 1
	# dp[n][0] = 1
	# dp[n][n] = 1

def pascal(n, k):
	# if dp[n][k] == 0:
	# 	dp[n][k] = pascal(n - 1, k - 1) % e + pascal(n - 1, k) % e
	# return dp[n][k] % e
	s = "n: {}, k: {}".format(n, k)
	if s not in memo:
		memo[s] = pascal(n - 1, k - 1) % e + pascal(n - 1, k) % e
	return memo[s] % e

# print(pascal(6, 3))

if __name__ == "__main__":
	X, Y = map(int, input().split())
	if (X + Y) % 3 != 0:
		print("0")
	else:
		n = (X + Y) // 3
		k = Y - n
		print(pascal(n, k))

### FIXED CODE ###

MOD = 10 ** 9 + 7

def modPow(a, x, p):
	res = 1
	while x > 0:
		if x % 2 != 0:
			res = res * a % p
		a = a * a % p
		x = x // 2
	return res
 
def modInverse(a, p):
	return modPow(a, p - 2, p)
 
def modBinomial(n, k, p):
	numerator = 1
	for i in range(k):
		numerator = (numerator * (n - i)) % p
	denominator = 1
	for i in range(1, k + 1):
		denominator = (denominator * i) % p
	return (numerator * modInverse(denominator, p)) % p


if __name__ == "__main__":
	X, Y = map(int, input().split())
	if (X + Y) % 3 != 0 or Y > 2 * X or Y < X / 2.:
		print("0")
	else:
		n = (X + Y) // 3
		k = Y - n
		print(modBinomial(n, k, MOD))
import numpy as np
MOD = 1000000007
n = int(input())

cnt = np.ones(n+1)

for i in range(2, n+1):
    m = i
    for j in range(2, i+1):
        while m % j == 0:
            m = m / j
            cnt[j] += 1
ans = 1
for i in range(2, n+1):
    ans = (ans * cnt[i]) % MOD
print(int(ans))

### FIXED CODE ###

import numpy as np
MOD = 1000000007
n = int(input())

cnt = np.ones(n+1)

for i in range(2, n+1):
    m = i
    for j in range(2, i+1):
        while m % j == 0:
            m = m / j
            cnt[j] += 1
ans = 1
for i in range(2, n+1):
    ans = (ans * cnt[i]) % MOD
print(int(ans))
n = int(input())

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

m = int(input())

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

max_diff = max(max(d),max(t))

diff = [0]*(max_diff+1)

for i in d:
    diff[i] += 1

flag = True

for i in t:
    if diff[i] > 0:
        diff[i] -= 1
    else:
        flag = False
        break

if flag:
    print('YES')
else:
    print('NO')
        

### FIXED CODE ###

from collections import Counter
 
N = int(input())
D = list(input().split())
 
M = int(input())
T = list(input().split())
 
D_count = Counter(D)
T_count = Counter(T)

for k, v in T_count.items():
    if D_count[k] < v:
        print('NO')
        exit()
 
print('YES')
N=int(input())
a=list(map(int,input().split()))
print(abs(max(a)-min(a)))

### FIXED CODE ###

N=int(input())

if N%2==0:
  print(N)
else:
  print(N*2)
import numpy as np

N, A = list(map(int, input().split()))
X = list(map(int, input().split()))

dp = [np.array([[0]*(N*A+1) for _ in range(N+1)])]
#dp[0]: [0, 0]～[N, N*A]

for x in X:
  new_dp = dp[-1]
  new_dp[1:, x:] += dp[-1][0:N, 0:N*A+1-x]
  new_dp[1, x] += 1
  
  dp.append(new_dp)
#print(dp[-1])
  
print(sum([dp[-1][i][i*A] for i in range(1, N+1)]))



### FIXED CODE ###

import numpy as np

N, A = list(map(int, input().split()))
X = list(map(int, input().split()))

dp = [np.array([[0]*(N*A+1) for _ in range(N+1)])]
#dp[0]: [0, 0]～[N, N*A]

for x in X:
  new_dp = dp[-1].copy()
  new_dp[1:, x:] += dp[-1][0:N, 0:N*A+1-x]
  if x<=N*A:
    new_dp[1, x] += 1
  
  dp.append(new_dp)
#print(dp[-1])
  
print(sum([dp[-1][i, i*A] for i in range(1, N+1)]))
#200322D
N = int(input())
A = list(map(int,input().split()))
count = 0
for i in range(N):
    for j in range(N):
        if A[i] == A[j]:
            count += 1
All = (count - N) / 2
#print(int(All))

for i in range(N):
    count = 0
    for j in range(N):
        if A[i] == A[j]:
            count += 1
    print(int(All - count + 1))

### FIXED CODE ###

#200322A
N, M = map(int,input().split())
x = N * (N - 1)/2 + M * (M-1) /2
print(int(x))
N=int(input())
bars=list(map(int,input().split()))
if max(list)<sum(list)-max(list):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N=int(input())
bars=list(map(int,input().split()))
if max(bars)<sum(bars)-max(bars):
  print('Yes')
else:
  print('No')
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
dir = [(-1,0),(0,-1),(1,0),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"

def main():
    n = int(ipt())
#    n = 20000
    tn = (n//4)*4
    sm = 0
    nm = 0
    ans = []
    for i in range(1,30001):
        if i%2 == 0 or i%3 == 0:
            ans.append(i)
            sm += i
            nm += 1
        if nm == tn:
            break

    if n%4 == 0:
        pass
    elif n%4 == 1:
        ans.append(ans[-1]+6)
    elif n%4 == 2:
        ans.append(ans[-1]+2)
        ans.append(ans[-1]+2)
    else:
        ans.append(ans[-1]+2)
        ans.append(ans[-1]+2)
        ans.append(ans[-1]+2)

    print(" ".join(map(str,ans)))


    return None

if __name__ == '__main__':
    main()


### FIXED CODE ###

'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
dir = [(-1,0),(0,-1),(1,0),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"

def main():
    n = int(ipt())
#    n = 20000
    if n == 3:
        print("2 3 25")
        exit()
    elif n == 4:
        print("2 5 20 63")
        exit()
    tn = (n//8)*8
    sm = 0
    nm = 0
    ans = []
    la = 0
    for i in range(1,30001):
        if i%2 == 0 or i%3 == 0:
            ans.append(i)
            sm += i
            nm += 1
        if nm == tn:
            if ans:
                la = ans[-1]
            break

    if n%8 == 0:
        pass
    elif n%8 == 1:
        ans.append(la+6)
    elif n%8 == 2:
        ans.append(la+2)
        ans.append(la+4)
    elif n%8 == 3:
        ans.append(la+2)
        ans.append(la+4)
        ans.append(la+6)
    elif n%8 == 4:
        ans.append(la+2)
        ans.append(la+4)
        ans.append(la+6)
        ans.append(la+12)
    elif n%8 == 5:
        ans.append(la+2)
        ans.append(la+3)
        ans.append(la+4)
        ans.append(la+6)
        ans.append(la+9)
    elif n%8 == 6:
        ans.append(la+2)
        ans.append(la+3)
        ans.append(la+4)
        ans.append(la+9)
        ans.append(la+8)
        ans.append(la+10)
    elif n%8 == 7:
        ans.append(la+2)
        ans.append(la+3)
        ans.append(la+4)
        ans.append(la+9)
        ans.append(la+8)
        ans.append(la+10)
        ans.append(la+12)


    print(" ".join(map(str,ans)))


    return None

if __name__ == '__main__':
    main()
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
a,b,c=[input() for i in range(3)]
for i in range(n):
  ans += len(set(a[i],b[i],c[i])) - 1
print(ans)

### FIXED CODE ###

#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
a=input()
b=input()
c=input()
def f(a,b,c):
  re=2
  if a==b:
    re-=1
  if c==b:
    re-=1
  if a==c:
    re-=1
  return max(0,re)
for i in range(n):
  count += f(a[i],b[i],c[i])
print(count)
#!/usr/bin/env python3
    import sys


    def solve(A: int, B: int):
        pa = []
        pb = []
        a = A
        b = B

        for x in range(2, int(pow(A, 0.5))+2):
            if a % x == 0:
                pa.append(x)
            while a % (x) == 0:
                a = int(a / x)
        # print(pa)
        for x in range(2, int(pow(B, 0.5))+2):
            if b % x == 0:
                pb.append(x)
            while b % (x) == 0:
                b = int(b / x)
        # print(pb)
        
        an = len(set(pa)&set(pb))+1

        print(an)
        
        return


    # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
    def main():
        def iterate_tokens():
            for line in sys.stdin:
                for word in line.split():
                    yield word
        tokens = iterate_tokens()
        A = int(next(tokens))  # type: int
        B = int(next(tokens))  # type: int
        solve(A, B)

    if __name__ == '__main__':
        main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
# from math import gcd

def gcd(a, b):
    while b: a, b = b, a % b
    return abs(a)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# print(factorization(14)) 

def solve(A: int, B: int):
    a = gcd(A,B)
    ap = a
    ct = 0
    x = 2
    if a % x == 0:
        ct+=1
        while a % x == 0:
            a = a // x
    x = 3
    while x*x < ap+1: 
        if a % x == 0:
            ct+=1
            while a % x == 0:
                a = a // x
        x+=2
    # print(pa)
    if a != 1:
        ct +=1
    print(ct+1)
    
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()
def main():
    n = int(input())
    s = input()

    x, maxv = 0, 0
    for c in s:
        if c == 'I':
            x += 1
        elif c == 'D':
            x -= 1
        if x > maxv:
            maxv = x
    print(maxv)


if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    a, b, c, d = map(int, input().split())
    ans = a*b if a*b >= c*d else c*d
    print(ans)
    

if __name__ == "__main__":
    main()
N,K = map(int,input().split())
A = list(map(int,input().split()))

bs = [0] * 40
for a in A:
    for k in range(40):
        if a&(1<<k):
            bs[k] += 1

x = 0
for k in range(39,-1,-1):
    if x + (1<<k) > K: continue
    if bs[k] < (N+1)s//2:
        x += (1<<k)

ans = 0
for a in A:
    ans += x^a
print(ans)

### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))

bs = [0] * 40
for a in A:
    for k in range(40):
        if a&(1<<k):
            bs[k] += 1

x = 0
for k in range(39,-1,-1):
    if x + (1<<k) > K: continue
    if bs[k] < (N+1)//2:
        x += (1<<k)

ans = 0
for a in A:
    ans += x^a
print(ans)
# input
sx, sy, tx, ty = map(int, input().split())

for i in range(tx - sx):
    print('R')

for i in range(ty - sy):
    print('U')

for i in range(tx - sx):
    print('L')

for i in range(ty - sy):
    print('D')

print('L')

for i in range(ty - sy + 1):
    print('U')

for i in range(tx - sx + 1):
    print('R')

print('D')

print('R')

for i in range(ty - sy + 1):
    print('D')

for i in range('tx - sx + 1'):
    print('L')

print('U')

### FIXED CODE ###

# input
sx, sy, tx, ty = map(int, input().split())

for i in range(ty - sy):
    print('U', end = "")

for i in range(tx - sx):
    print('R', end = "")

for i in range(ty - sy):
    print('D', end = "")

for i in range(tx - sx):
    print('L', end = "")

print('L', end = "")

for i in range(ty - sy + 1):
    print('U', end = "")

for i in range(tx - sx + 1):
    print('R', end = "")

print('D', end = "")

print('R', end = "")

for i in range(ty - sy + 1):
    print('D', end = "")

for i in range(tx - sx + 1):
    print('L', end = "")

print('U')
import math
n, init = map(int, input().split())
x = list(map(lambda a: int(a)-init, input().split()))
g = x[0]
for i in range(n-1):
    g = math.gcd(g,x[i+1])
print(g)


### FIXED CODE ###

n, init = map(int,input().split())
x = list(map(lambda x: abs(int(x)-init), input().split()))
g = x[0]
def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x%y)
for i in range(1,n):
    g = gcd(g,x[i])
print(g)
from math import gcd

N = int(input())
A = list(map(int, input().split()))

cum_left = [A[0]]
cum_right = [A[N - 1]]
for i in range(1, N - 1):
    cum_left.append(gcd(cum_left[-1], A[i]))
    cum_right.append(gcd(cum_right[-1], A[N - 1 - i]))

ans = max(cum_left[N - 2], cum_right[N - 2])
for i in range(1, N - 1):
    ans = max(ans, gcd(cum_left[i - 1], cum_right[N - 2 - i]))
print(ans)


### FIXED CODE ###

from fractions import gcd

N = int(input())
A = list(map(int, input().split()))

cum_left = [A[0]]
cum_right = [A[N - 1]]
for i in range(1, N - 1):
    cum_left.append(gcd(cum_left[-1], A[i]))
    cum_right.append(gcd(cum_right[-1], A[N - 1 - i]))

ans = max(cum_left[N - 2], cum_right[N - 2])
for i in range(1, N - 1):
    ans = max(ans, gcd(cum_left[i - 1], cum_right[N - 2 - i]))
print(ans)
a = input(), b = input()
print a * b, 2 * a + 2 * b

### FIXED CODE ###

a, b = map(int, raw_input().split())
print a * b, 2 * a + 2 * b
x,y=map(int,input().split())
m=list(map(int,input().split()))
ans=0
for i in m:
    if m[i]>=y:
        ans += 1
print(ans)


### FIXED CODE ###

x,y=map(int,input().split())
m=list(map(int,input().split()))
ans=0
for i in m:
    if i>=y:
        ans += 1
print(ans)
n,m=map(int,input().split())
branch=[tuple(map(int,input().split())) for _ in range(m)]
cango=dict()
res=[0]
data=[0 for _ in range(1+n)]

def calc(k):
    return 1/2*k*(k-1)

def search(data,x):
    bef=x
    while data[x]>0:
        data[bef]=data[x]
        bef=x
        x=data[x]
    return x,data[x]

for i in range(m):
    a,b=branch.pop()
    aroot,aidx=search(data,a)
    broot,bidx=search(data,b)
    if aidx!=0:aset=cango[aidx]
    if bidx!=0:bset=cango[bidx]
    lena=len(aset)
    lenb=len(bset)
    if aidx==0 and bidx==0:
        data[a]=-1*a
        data[b]=a
        cango[-1*a]={a,b}
    elif aidx==bidx and aidx!=0:
        res.append(res[-1])
        continue
    elif aidx==0 and bidx!=0:
        cango[bidx]|={a,}
        data[a]=broot
    elif aidx!=0 and bidx==0:
        cango[aidx]|={b,}
        data[b]=aroot
    elif aidx!=0 and bidx!=0 and aidx!=bidx:
        cango.pop(bidx)
        cango[aidx]|=bset
        data[broot]=aroot
    res.append(res[-1]-calc(lena)-calc(lenb)+calc(lena+lenb))

for j in range(m-1,-1,-1):
    print(int(res[m]-res[j]))

### FIXED CODE ###

n,m=map(int,input().split())
branch=[tuple(map(int,input().split())) for _ in range(m)]
res=[0]
data=[-1 for _ in range(1+n)]
def calc(k):
    k=abs(k)
    return 1/2*k*(k-1)

def search(data,x):
    if data[x]<=0:
        return x
    else:
        data[x]=search(data,data[x])
    return data[x]

for i in range(m):
    a,b=branch.pop()
    aroot=search(data,a)
    broot=search(data,b)
    if aroot==broot:
        res.append(res[-1])
        continue
    res.append(res[-1]-calc(data[aroot])-calc(data[broot])+calc(data[aroot]+data[broot]))
    if data[aroot]<=data[broot]:
        data[aroot]+=data[broot]
        data[broot]=aroot
    elif data[aroot]>data[broot]:
        data[broot]+=data[aroot]
        data[aroot]=broot
for j in range(m-1,-1,-1):
    print(int(res[m]-res[j]))
N, A, B = map(int, input().split())

if N == 1:
  print('Hello World')
elif N == 2:
  print(int(A + B))

### FIXED CODE ###

N = int(input())
if N == 1:
  print('Hello World')
  
elif N == 2:
  A = int(input())
  B = int(input())
  print(A + B)
import fraction
from functools import reduce


def gcd_list(numbers):
    return reduce(fraction.gcd, numbers)


N = input()
A = input().split()
for i in range(len(A)):
    A[i] = int(A[i]) 
print("{}".format(gcd_list(A)))

### FIXED CODE ###

A, B = map(int, input().split())
if B%A==0:
    print("{}".format(A+B))
else:
    print("{}".format(B-A))
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def solve(X, K):
    N = len(X)

    cumsum = [0 for _ in range(N)]
    for i in range(1, N):
        cumsum[i] = abs(X[i] - X[i - 1]) + cumsum[i - 1]

    idx_zero = bisect.bisect_left(X, 0)

    ret = 1000000005
    for i in range(0, N):
        if X[i] >= 0:
            break
        res = -X[i]
        k = idx_zero - i
        if k < K:
            res += cumsum[idx_zero + K - k - 1] - cumsum[i]
        ret = min(ret, res)

    return ret


if __name__ == '__main__':
    N, K = map(int, input().split())
    X = list(map(int, input().split()))

    res = 1000000005
    if min(X) >= 0:
        print(X[K - 1])
    elif max(X) <= 0:
        X = X[::-1]
        print(-X[K - 1])
    else:
        res = min(res, solve(X, K))
        X = [-x for x in X]
        res = min(res, solve(X[::-1], K))
        print(res)


### FIXED CODE ###

import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def solve(X, K):
    N = len(X)

    cumsum = [0 for _ in range(N)]
    for i in range(1, N):
        cumsum[i] = abs(X[i] - X[i - 1]) + cumsum[i - 1]

    idx_zero = bisect.bisect_left(X, 0)

    ret = 1000000005
    for i in range(0, N):
        if X[i] >= 0:
            break
        res = -X[i]
        k = idx_zero - i
        if (k < K) and (idx_zero + K - k - 1 < N):
            res += cumsum[idx_zero + K - k - 1] - cumsum[i]
            ret = min(ret, res)

    return ret


if __name__ == '__main__':
    N, K = map(int, input().split())
    X = list(map(int, input().split()))

    res = 1000000005
    if min(X) >= 0:
        print(X[K - 1])
    elif max(X) <= 0:
        X = X[::-1]
        print(-X[K - 1])
    else:
        res = min(res, solve(X, K))
        X = [-x for x in X]
        res = min(res, solve(X[::-1], K))
        print(res)
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<int, int>;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

const int MOD = 1000000007;

// vector<vector<int>> data(3, vector<int>(4));

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll a, b, c, d;
  cin >> a >> b >> c >> d;

  ll ans = a * c;
  ans = max(ans, a * d);
  ans = max(ans, b * c);
  ans = max(ans, b * d);

  printf("%lld", ans);
}


### FIXED CODE ###

a,b,c,d = map(int, input().split())
ans = a*c
ans = max(ans,a*d)
ans = max(ans,b*c)
ans = max(ans,b*d)
print(ans)
a = [raw_input() for i in range(4)]
print len(set(a[1].split())&set(a[3].split())

### FIXED CODE ###

a = [raw_input() for i in range(4)]
print len(set(a[1].split())&set(a[3].split()))
s = input()
a = True

for i in range(les(s)):
    if i%2==0 and s[i]=="L":
        a = False
    elif i%2 ==1 and s[i]=="R":
        a = False
if a:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = list(input())
a = True

for i in range(len(s)):
    if i%2==0 and s[i]=='L':
        a = False
    elif i%2==1 and s[i]=='R':
        a = False
if a:
    print('Yes')
else:
    print('No')
n, t = list(map(int, input().split()))
a = list(map(int, input().split()))

remain_max = [a[-1]]*n
for i in range(1, n):
    remain_max[-(i+1)] = max(a[-i], remain_max[-i])

diffs = [0]*n
for i in range(n):
    diffs[i] = remain_max[i] - a[i]

max_diff = 0
ans = 0
for i in range(n):
    if diffs[i] > max_diff:
        max_diff = diffs[i]
        ans = 1
    elif diffs[i] == max_diff:
        ans1 += 1

print(ans)

### FIXED CODE ###

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

remain_max = [a[-1]]*n
for i in range(1, n):
    remain_max[-(i+1)] = max(a[-i], remain_max[-i])

diffs1 = [0]*n
for i in range(n):
    diffs1[i] = remain_max[i] - a[i]

max_diff1 = 0
ans1 = 0
for i in range(n):
    if diffs1[i] > max_diff1:
        max_diff1 = diffs1[i]
        ans1 = 1
    elif diffs1[i] == max_diff1:
        ans1 += 1
# print(diffs1, ans1)

remain_min = [a[0]]*n
for i in range(1, n):
    remain_min[i] = min(a[i-1], remain_min[i-1])

diffs2 = [0]*n
for i in range(n):
    diffs2[i] = a[i] - remain_min[i]

max_diff2 = 0
ans2 = 0
for i in range(n):
    if diffs2[i] > max_diff2:
        max_diff2 = diffs2[i]
        ans2 = 1
    elif diffs2[i] == max_diff2:
        ans2 += 1
# print(diffs2, ans2)

print(min(ans1, ans2))
a,b = map(str,input().split())
if a == H:
  if b == H:
    print("H")
  else:
    print("D")
else if a == D:
  if b == H:
    print("D")
  else:
    print("H")

### FIXED CODE ###

a,b = input().split()
if a == "H":
  if b == "H":
    print("H")
  else:
    print("D")
else:
  if b == "H":
    print("D")
  else:
    print("H")
a,b,c,d = map(int,input().split())
print(min(a,b)+min(c,d))

### FIXED CODE ###

a,b,c,d = [int(input()) for _ in range(4)]
print(min(a,b)+min(c,d))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Feb  8 05:12:38 2019

@author: shinjisu
"""


def db(x):
    global debug
    if debug:
        print(x)


def gen(tstr):
    if len(tstr) <= len(S):
        for w in words:
            yield w + tstr
            for w2 in gen(w + tstr):
                yield w2
    else:
        yield tstr


debug = False
words = ('dream', 'dreamer', 'erase', 'eraser')
S = input()
ans = False
db(S)
for genstr in gen(''):
    db(genstr)
    if genstr == S:
        ans = True
        break
if ans:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Feb  8 05:12:38 2019

@author: shinjisu
"""


def db(x):
    global debug
    if debug:
        print(x)


# スタックオーバーフロー
def gen(tstr):
    if len(tstr) <= len(S):
        for w in words:
            yield tstr + w
            for w2 in gen(tstr + w):
                yield w2


# RE
def solve():
    ans = False
    for genstr in gen(''):
        db(genstr)
        if genstr == S:
            ans = True
            break
    return ans


# TLE
def solve2():
    stack = list(words)
    while stack != []:
        str = stack.pop()
        db(('pop', str))
        if len(str) < len(S):
            for w in words:
                stack.append(str+w)
        elif len(str) == len(S) and str == S:
            return True
    return False


# 逆方向から探す
def solve3():
    string = S + ' '
    n = len(string)
    while n > 1:
        for w in words:
            db((string.rfind(w, 0, n),len(w),n))
            if string.rfind(w, 0, n) + len(w) + 1 == n:
                break
        else:
            return False
        db((n,w))
        n -= len(w)
    return True


debug = False
words = ('dream', 'dreamer', 'erase', 'eraser')
S = input()
db(S)
if solve3():
    print('YES')
else:
    print('NO')