peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
w, h, x, y = (int(i) for i in input().split())
s = (w * h) / 2
met = 1 if (x == w/2 and y == h/2) else 0
print(s, met)
# Judge status: Accepted
n,r = (map(int, input().split()))  
if n >= 10:
  print(r)
else:
  print(r+100*(10-n))
# Judge status: Accepted
a = []
for i in range(5):
    a.append(int(input()))
b = []
for i in a:
    if i%10:
        b.append(i)
c = min(b,key = lambda x:x%10) if len(b) else 0
ans = 0
for i in a:
    ans += i+(10-i%10) if i%10 else i
print(ans-(10-c%10) if len(b) else ans)
# Judge status: Wrong Answer
n,k=map(int,input().split())
d = list(map(int,input().split()))
for i in range(n,10000):
    count=0
    for j in range(k):
        u = d[j]
        if(str(i).count(str(u))==0):
            count+=1
    if(count==k):
        break
print(i)
# Judge status: Accepted
N=int(input())
if int((N+1)**.5)**2==N:print(N)
else:print(int(N**.5)**2)
# Judge status: Wrong Answer
A=list(input().split())
A=sorted(A,reverse=True)
print(A)
b=A[0]+A[1]
print(int(b)+int(A[2]))
# Judge status: Accepted
import collections

n,k = map(int,input().split())
s = list(map(int,input().split()))
c = collections.Counter(s)
tap = c.most_common()

ans = 0
while len(tap) > k:
    ans += tap[-1][1]
    tap.pop(-1)

print(ans)
# Judge status: Accepted
S = input()

def check(t):
  if len(t) >= 5 and (t[-5:] == 'dream' or t[-5:] == 'erase'):
    return True,t[:-5]
  elif len(t) >=6 and t[-6:] == 'eraser':
    return True,t[:-6]
  elif len(t) >= 7 and t[-7:] == 'dreamer':
    return True,t[:-7]
  else:
    return False,t

while(len(S) > 0):
  flag,S = check(S)
  if not flag:
    print('NO')
    exit()
print('YES')
# Judge status: Accepted
r, g, b = map(int, input().split())

num = r * 100 + g * 10 + b

if num % 4 == 0:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
a=input()
b=['Sunny','Cloudy', 'Rainy']
for i in range(2):
  if i==3:
    print('Sunny')
    break
  if b[i]==a:
    print(b[i+1])
# Judge status: Wrong Answer
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

# import numpy as np
import itertools

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, L = map(int, readline().split())
F = [L + i for i in range(N)]

ans = sum(F)
for i in itertools.combinations(F, N - 1):
    if abs(sum(F) - sum(i)) < ans:
        ans = sum(i)

print(ans)
# Judge status: Accepted
c_lst = [[int(c) for c in input().split()] for i in range(3)]
if c_lst[0][0] + c_lst[1][1] == c_lst[0][1] + c_lst[1][0] and c_lst[1][1] + c_lst[2][2] == c_lst[1][2] + c_lst[2][1] and c_lst[0][0] + c_lst[2][2] == c_lst[0][2] + c_lst[2][0]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

l = 0
r = sum(a)
ans = 10**10

for i in range(n):
    l += a[i]
    r -= a[i]
    ans = min(ans, abs(l - r))

print(ans)
# Judge status: Accepted
n,k = map(int,input().split())

for i in range(10**9):
  if n < k**i:
    print(i)
    exit()
# Judge status: Wrong Answer
a = list(map(int, input().split()))

res = 0
s = ''
for i in range(a[0]):
    if a[0] * 4 < a[1] or a[0] * 2 > a[1]:
        s = 'No'
        break
    if (a[0] == i + 1) and (res + 2 == a[1] or res + 4 == a[1]):
        s = 'Yes'
    if (a[0] - i) * 4 > a[1] and ((res + 4) + ((a[0] - i + 1) * 2) > a[1]):
        res += 2
        continue
    else:
        res += 4
        continue
if s == '':
    s = 'No'
print(s)
# Judge status: Accepted
n=int(input())
dic={}
for i in range(n):
    tmp=input()
    if tmp not in dic.keys():
        dic[tmp]=1
print(len(dic))
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

print(-(-(n-1)//(k-1)))
# Judge status: Accepted
a,b=map(int,input().split())
b-=a
b=-(b//-(a-1))
print(b+1)
# Judge status: Accepted
a = sorted(map(int, input().split()))
ans = 0
diff = a[1] - a[0]
if diff > 0:
    ans += diff // 2
    a[0] += diff // 2 * 2

diff = a[2] - a[1]
if diff > 0:
    ans += diff
    a[1] += diff
    a[0] += diff
if a[0]+1 == a[1] and a[1]+1 == a[2]:
    print(ans+3)
elif a[0]+1 == a[1] and a[1] == a[2]:
    print(ans+2)
elif a[0] == a[1] and a[1]+1 == a[2]:
    print(ans+1)
else:
    print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
ans = [0] * N
for _ in range(M):
  a, b = map(int, input().split())
  ans[a - 1] += 1
  ans[b - 1] += 1
print(*ans, sep="\n")
# Judge status: Accepted
n = int(input())
a = []

for i in range(n):
  s,p = input().split()
  p = int(p)
  a.append([s,-p,i+1])
a.sort()

for i in range(n):
  print(a[i][2])
# Judge status: Accepted
from itertools import accumulate
n, k = map(int, input().split())
A = list(map(int, input().split()))
for _ in range(k):
  B = [0]*(n+1)
  for i, a in enumerate(A):
    B[max(i-a, 0)] += 1
    B[min(i+a+1, n)] -= 1
  A = list(accumulate(B))[:-1]
  if min(A) == n:
    break
print(*A)
# Judge status: Accepted
k = int(input())
dp = [[] for i in range(1000)]
dp[0] = list(range(1,10))
D = [-1,0,1]

count = 0
for i in range(10**5):
  count = len(dp[i])
  if count > k:
    ans = dp[i]
    ans.sort()
    print(ans[k-1])
    exit()
  else:
    k -= count
    for j in dp[i]:
      str_j = str(j)
      for d in D:
        nxt = int(str_j[-1])+d
        if 0<=nxt<=9:
          dp[i+1].append(j * 10 + nxt)
# Judge status: Wrong Answer
nk=list(map(int,input().split()))
d=list(map(int,input().split()))
i=nk[0]
ans=0
while ans==0:
  flag=0
  for j in range(len(str(i))):
    if str(i)[j] in d:
      flag=1
      break
  if flag==0:
    ans=i
  i+=1
print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
c = 0
for i in range(k,n+2):
  c += i*(n-i+1)+1
  c = c%(10**9+7)
print(c)
# Judge status: Accepted
s = int(input())

x1, x2, x3 = 0, 10 ** 9, 1
a = -(-s // (10 ** 9))
b = a * (10 ** 9) - s

y1, y2, y3 = 0, b, a

print(x1, y1, x2, y2, x3, y3)


#print(abs((x2-x1)*(y3-y1) - (x3-x1)*(y2-y1)))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
M = max(a)
ok = [0]*(M+1)
a.sort()

for i in range(n):
    ok[a[i]] += 1
    if ok[a[i]] == 1:
        for g in range(a[i], M+1, a[i]):
            if g != a[i]:
                ok[g] += 2


print(ok.count(1))
# Judge status: Accepted
p,q,r=map(int,input().split())
print(p+q+r-max([p,q,r]))
# Judge status: Accepted
n, m = map(int, input().split())

r = [False] * n
r[0] = True
l = [1] * n

for _ in range(m):
    x, y = map(int, input().split())
    l[x - 1] -= 1
    l[y - 1] += 1
    #if r[x - 1]:
    #    r[y - 1] = True
    r[y - 1] = r[x - 1] | r[y - 1]
    if l[x - 1] == 0:
        r[x - 1] = False

c = 0
for i in range(n):
    if r[i] == True and l[i] > 0:
        c += 1

print(c)
# Judge status: Accepted
n = int(input())
curt, curx, cury = 0, 0, 0
ans = 'Yes'
for _ in range(n):
   t, x, y = map(int, input().split())
   d = abs(x - curx) + abs(y - cury)
   if d > (t - curt) or (t - curt) % 2 != d % 2:
      ans = 'No'
      break
   curt, curx, cury = t, x, y

print(ans)
# Judge status: Accepted
N=int(input())
T,A=map(int,input().split())
mylist=list(map(int,input().split()))
mymin=10**6
index=0

for i in range(N):
  if(mymin>abs(A-(T-0.006*mylist[i]))):
    mymin=abs(A-(T-0.006*mylist[i]))
    index=i
print(index+1)
# Judge status: Wrong Answer
a, b, c = input().split()
if a <= c <= b:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
#!/use/bin/env python3

from collections import defaultdict

a = input()

b = defaultdict(int)


for c in a:
    b[c] += 1

d = []

for c in b.values():
    d.append(c % 2)

e = set(d)

ans = 'Yes' if 1 in e else 'No'

print(ans)
# Judge status: Accepted
A,B = map(int,input().split())
cnt = 0
for i in range(A,B+1):
    str_i = str(i)
    if(str_i[0]==str_i[4] and str_i[1]==str_i[3]):
        cnt+=1
print(cnt)
# Judge status: Accepted
n = int(input())

ans = [50]*26

al = list("abcdefghijklmnopqrstuvwxyz")

for i in range(n):
    t = input()
    for s in range(26):
        ans[s] = min(ans[s],t.count(al[s]))
        
for i in range(26):
    for t in range(ans[i]):
        print(al[i],end = "")
# Judge status: Wrong Answer
a,b=map(int,input().split())

b=max(a,b)
s=min(a,b)

print(str(s)*b)
# Judge status: Accepted
A,B,C,D = (int(x) for x in input().split())
while(C > 0 and A > 0 ):
    C -= B
    if(C <= 0):
        print("Yes")
        break
    A -= D
    if(A <= 0):
        print("No")
        break
# Judge status: Wrong Answer
a,b,n=map(int,input().split())
print((a*(n-1)/b)-(a*int((n-1)/b)))
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-

S = input()
N = len(S)

counter = 0
surplus = [0]*2019
surplus[0] += 1

for i in range(N):
    surplus[int(S[i:]) % 2019] += 1

print(sum([i* i-1 in surplus]))
# Judge status: Accepted
k, x = [int(v) for v in input().split()]

if 500 * k >= x:
  print("Yes");
else:
  print("No");
# Judge status: Accepted
n=int(input())
w=list(int(i) for i in input().split())
a=max(w)
for i in range(len(w)-1):
  tmp=abs(sum(w[:i+1])-sum(w[i+1:]))
  if a > tmp:
    a=tmp
print(a)
# Judge status: Accepted
n,l = map(int, input().split())
sss = []
for _ in range(n):
  sss.append(input())

sss.sort()

print("".join(sss))
# Judge status: Wrong Answer
n,k=map(int,input().split())
S=input()+'X'
c=0
d=0
for i in range(n):
    if S[i]==S[i+1]:
        c+=1
    if S[i]!=S[i+1]:
        d+=1
print(c+2*k if d>k else c+2*k-1)
# Judge status: Accepted
from itertools import accumulate


n = int(input())
a = list(map(int, input().split()))
a_acc = list(accumulate(a))
ans = 2020202020
for i in range(n):
    ans = min(abs(a_acc[-1] - a_acc[i] - a_acc[i]), ans)
print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())

if a+b>=c:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
import itertools
import numpy as np
n, m, x = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
l = np.array(l)
ans = np.sum(l, 0)[0]
# ans_s = np.sum(l, 0)
count = 0
# if np.any(ans_s[1:] < x):
#     print(-1)
#     exit()
for i in range(1, n + 1):
    for j in itertools.combinations(l, i):
        tot = np.sum(j, 0)
        if np.all(tot[1:] >= x) and tot[0] < ans:
            ans = tot[0]
            count += 1
print(int(ans) if count != 0 else -1)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
ans = [0]*n
for i in reversed(range(1,n)):
    if sum(ans[(i-i)::i])%2 != a[i]:
        ans[i] += 1
if sum(ans) != a[0]:
    ans[0] += 1
print("".join(map(str, ans)))
# Judge status: Accepted
def main():
    N, M, *a = map(int, open(0).read().split())
    div = 1000000007
    broken = set(a)
 
    comb_list = [0] * (N + 1)
    comb_list[0] = 1
    if 1 not in broken:
        comb_list[1] = 1
 
    for i in range(2, N + 1):
        if i in broken:
            continue
        comb_list[i] = (comb_list[i - 1] + comb_list[i - 2]) % div
 
    print(comb_list[-1])
 
 
if __name__ == "__main__":
    main()
# Judge status: Accepted
n,m=map(int, input().split())
A=[]
a=list(map(int, input().split()))
for i in  range(n):
  A.append([a[i], 1])
  
l=[]
for i in range(m):
  b,c=map(int, input().split())
  l.append([c,b])

A.extend(l)
A.sort()
A.reverse()
B=[]

j=0
cnt=-1
while cnt<n:
  B.extend([A[j][0]]*A[j][1])
  cnt=cnt+A[j][1]
  if cnt>=n:
    del B[n:]
  j=j+1

print(sum(B))
# Judge status: Accepted
s = input()
if s == 'A'*3 or s == 'B'*3:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
n, a, b = [int(i) for i in input().split()]
a,b=max(a,b),min(a,b)

if (a - b) % 2 == 0:
    print((a - b) // 2)
else:
    c = b + (a -1- b) // 2
    d = n - a + 1 + (n - (n - a + 1) - b) // 2
    print(min(c,d))
# Judge status: Accepted
A = int(input())
B = int(input())
for i in range (1, 4):
  if i != A and i != B:
    print(i)
    break
# Judge status: Accepted
n,m=map(int,input().split())
a=[]
for i in range(1,int(m**.5)+1):
    if m%i==0:
        if m//i>=n:a+=[i]
        if i>=n:a+=[m//i]
print(max(a))
# Judge status: Wrong Answer
K,A,B=map(int,input().split())
bis=1
if K==1:
  bis=2
elif A>=B-1:
  bis=int(K+1)
else:
  if int((K-(A-1)))%2==0:
    bis=int(A+(B-A)*(K-(A-1))/2)
  else:
    bis=int(A+(B-A)*((K-(A-1))//2)+1)
print(bis)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    menu = [int(input()) for _ in range(5)]

    ans = 0
    min_m = 10
    for m in menu:
        ans += (m + 9) // 10 * 10
        if m % 10 > 0:
            min_m = min(min_m, m % 10)
    if min_m > 0:
        ans += min_m - 10
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N=int(input())

if ((N//1.08)+1)*1.08==N:
  print((N//1.08)+1)
if (N//1.08)*1.08==N:
  print(N//1.08)
else:
  print(":(")
# Judge status: Wrong Answer
n = int(input())
p = list(map(int,input().split()))
cnt = 0

for i in range(1,n):
    if abs(p[i-1] - p[i]) > 1:
        cnt += 1

print('YES' if cnt == 0 or cnt == 2 else 'NO')
# Judge status: Accepted
k = int(input())
a, b = map(int, input().split(" "))
res = "NG"
for i in range(a, b + 1):
    if i % k == 0:
        res = "OK"
        break
print(res)
# Judge status: Accepted
n = int(input())

m = list(map(int,input().split()))
xor = 0
for i in m:
    xor ^= i
ans = []
for j in m:
    ans.append(xor ^ j)

print(" ".join([str(k) for k in ans]))
# Judge status: Accepted
a, b, c = map(int, input().split())
if (a+b+c <=21):
  print('win')
else:
  print('bust')
# Judge status: Accepted
#インクルード
import math

#定義

#ロジック箇所
N = int(input())
ruto = math.floor(math.sqrt(N))
ruto = ruto ** 2
print(ruto)
# Judge status: Wrong Answer
O = input()
E = input()
ans = ''
if O>E:
    ans += O[0]
    O = O[1:]
    for o, e in zip(O,E):
        ans += (e + o)
else:
    for o, e in zip(O, E):
        ans += (o + e)
print(ans)
# Judge status: Accepted
s = input()

lAlp = [0 for i in range(26)]

for i in range(len(s)):
    num = ord(s[i]) - ord('a')
    lAlp[num] += 1
    
for i in range(26):
    if(lAlp[i] % 2 == 1):
        print('No')
        break

else:
    print('Yes')
# Judge status: Wrong Answer
n,a,b=map(int, input().split())

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

ret = 0

ret = 2**n + 10**9+7 + 10**9+7 +1
ret = ret - combination(n, a)
ret = ret - combination(n, b)
ret = ret % (10**9+7)
print(ret)
# Judge status: Accepted
k, x = map(int, input().split())
print(*list(range(x-k+1, x+k)))
# Judge status: Wrong Answer
A,B,K = map(int,input().split())
div = []

for i in range(1,100):
	if A%i == 0 and B%i == 0:
		div.append(i)
print(sorted(div)[-K])
# Judge status: Accepted
h,n = map(int,input().split())
a_lst = list(map(int,input().split()))

if h>sum(a_lst):
    print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

def main():
    a, b, c, d = nm()
    if abs(b-a) <= d or abs(c-b) <= d or abs(c-a) <= d:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
digit_list = []
cnt = 0

for i in range(1, n+1):
    digit_list.append(len(str(i)))

for i in digit_list:
    if i % 2 == 1:
        cnt += 1

print(cnt)
# Judge status: Wrong Answer
line = input()

k, x = line.split(' ')

if k * 500 >= x:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n,a,b=map(int,input().split())
if (a-b)%2==0:
    print(abs(a-b)//2)
else:
    ans0=min(a,b)+abs(a-b)//2
    ans1=n-max(a,b)+1+abs(a-b)//2
    print(min(ans0,ans1))
# Judge status: Accepted
import sys
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    ans = max(-1, N - sum(A))
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
# -*- coding: utf-8 -*-

A = input().split()

a1 = int(A[0])
a2 = int(int(A[1][0])*100 + int(A[1][2])*10 + int(A[1][3]))

print(int(a1*a2)//100)
# Judge status: Accepted
X = int(input())
ans = 0
ans += 1000 * (X // 500)
X = X % 500
ans += 5 * (X // 5)
print(ans)
# Judge status: Wrong Answer
a=int(input())
b=0
if 7%a==0:b=b+1
if 77%a==0:b=b+1
if 777%a==0:b=b+1
if 7777%a==0:b=b+1
if 77777%a==0:b=b+1
if 777777%a==0:b=b+1
if 0==b: b=-1
print(b)
# Judge status: Wrong Answer
#!/usr/bin/env python
# coding: utf-8

# In[27]:


N = int(input())
s = str(input())
t = str(input())


# In[29]:


for i in range(len(s)):
#     print(i, s[i:], t[:len(t)-i])
    if s[i:] == t[:len(t)-i]:
        print(s[:i]+t)
        break
    elif i == len(s)-1:
        print(s+t)


# In[ ]:
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 14 17:18:33 2020

@author: NEC-PCuser
"""

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

score = 0
your_hand = [-1] * N
# グー 0 チョキ 1 パー 2
score_dict = {"r":P, "s":R, "p":S}


for i in range(len(T)):
    if T[i] != your_hand[i - K]:
        score += score_dict[T[i]]
        your_hand[i] = T[i]

print(score)
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

ans = 0
for i in range(1, N+1):
    sum_ = sum(map(int, list(str(i))))
    if A <= sum_ <= B:
        ans += i
print(ans)
# Judge status: Wrong Answer
# 85 A
L = input()
L1 = L.replace("7","8")


print(L1)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
numa = 0
numb = 0
num = sum(b)-sum(a)
for i in range(n):
    x = b[i] - a[i]
    if x > 0:
        numa += -(-x//2)
        if x % 2 == 1:
            numb += 1
    else:
        numb -= x
if (num-numa)*2 == num-numb and num >= numa:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
S = list(map(int,input().split()))

if sum(S) >= 22:
    print('burst')
else:
    print('win')
# Judge status: Wrong Answer
from itertools import product

n = input()

if int(n) < 100:
    print(0)
    
ans = 0
    
for i in range(3,len(n)+1):
    s = list(product("753",repeat=i))
    for combi in s:
        n_s = "".join(combi)
        if int(n_s) >= int(n):
            continue
        if ("7" in combi) and ("5" in combi) and ("3" in combi):
            ans += 1
    
print(ans)
# Judge status: Accepted
N=int(input())
L=[[0]*10 for i in range(10)]
for i in range(1,N+1):
    n=str(i)
    first=int(n[0])
    last=int(n[-1])
    L[first-1][last-1]+=1
ans=0
for i in range(1,N+1):
    n=str(i)
    first=int(n[0])
    last=int(n[-1])
    ans+=L[last-1][first-1]

print(ans)
# Judge status: Wrong Answer
n=int(input())
ac=0
wa=0
tle=0
re=0
for i in range(n):
    tmp = input()
    if tmp == "AC":
        ac+=1
    elif tmp == "WA":
        wa+=1
    elif tmp == "TLE":
        tle+=1
    else:
        re+=1
print("AC ×",ac)
print("WA ×",wa)
print("TLE ×",tle)
print("RE ×",re)
# Judge status: Accepted
r, g, b = input().split()
a = int(r + g + b)
if a % 4 == 0:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
n = int(input())
hlist = list(map(int, input().split()))
alist = list(range(1, n+1))

## TLE
shlist = []
for height in hlist:
    if height < n - 1:
        shlist.append(height)

ans = 0
# The absolute difference of their attendee numbers is equal to the sum of their heights.
for i, h1 in enumerate(shlist):
    for j, h2 in enumerate(shlist[i+1:]):
        if h1+h2>n:
            continue
        if j+1 == h1+h2:
            ans += 1
print(ans)
# Judge status: Wrong Answer
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
ans = 'Yes'
if s == t:
    if len(s) <= len(t):
        ans = 'No'
else:
    for sc, tc in zip(s, t):
        if sc == tc:
            continue
        if sc > tc:
            ans = 'No'
        else:
            ans = 'Yes'
        break
print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
x=list(map(int,input().split()))
a=[]
for i in range(n-k+1):
    l=x[i]
    r=x[i+k-1]
    a.append(min(abs(l)+abs(r-l),abs(r)+abs(l-r)))
print(min(a))
# Judge status: Accepted
def resolve():
  s = input()
  for i in range(1<<3):
    e = s[0]
    e += '+' if ((i>>0) & 1) else '-'
    e += s[1]
    e += '+' if ((i>>1) & 1) else '-'
    e += s[2]
    e += '+' if ((i>>2) & 1) else '-'
    e += s[3]
    if eval(e) == 7:
      e += '=7'
      print(e)
      return
  return

if __name__ == "__main__":
  resolve()
# Judge status: Accepted


n, x = map(int, raw_input().split())
ais = map(int, raw_input().split())


q= sum([ai - min(x,ai) for ai in ais])

ais = [min(x,ai) for ai in ais]

for ii in range(1,len(ais)):
	if ais[ii] + ais[ii-1] > x:
		q += ais[ii] + ais[ii-1] - x
		ais[ii] -= ais[ii] + ais[ii-1] - x
print q
# Judge status: Wrong Answer
N = int(input())
rest_dict = {}
city_list = []
for i in range(N):
    city, score = input().split()
    if city not in city_list:
        city_list.append(city)
        rest_dict[city] = [[score, i]]
    else:
        rest_dict[city].append([score, i])

city_list = sorted(city_list)
for city in city_list:
    rest_list = rest_dict[city]
    rest_list = sorted(rest_list, reverse=True)
    for rest in rest_list:
        print(rest[1]+1)
# Judge status: Accepted
Q, H, S, D = map(int, input().split())
N = int(input())
one = min(4*Q, 2*H, S)
two = min(2*one, D)
print(N//2 * two + N % 2 * one)
# Judge status: Accepted
from math import ceil
A, B = map(int, input().split())

ans = ceil((B - A) / (A-1)) + 1
# if B % A :
#     ans += 1

# elif B == A :
#     continue

print(ans)
# Judge status: Accepted
n = int(input())

ans = 0
for i in range(1, n+1):
  cnt = n//i
  ans += i*(cnt*(cnt+1)//2)
  
  
print(int(ans))
# Judge status: Accepted
import queue

q_lunlun_num = queue.Queue()
for i in range(1, 10):
    q_lunlun_num.put(i)

K = int(input())
for _ in range(K):
    now_lunlun_num = q_lunlun_num.get()
    first_digit = now_lunlun_num % 10

    if first_digit != 0:
        q_lunlun_num.put(now_lunlun_num*10 + first_digit - 1)
    
    q_lunlun_num.put(now_lunlun_num*10 + first_digit)

    if first_digit != 9:
        q_lunlun_num.put(now_lunlun_num*10 + first_digit +1 )

print(now_lunlun_num)
# Judge status: Accepted
x = input().split()
h = int(x[0])
a = int(x[1])
count = 0
while h > 0:
  count += 1
  h = h - a
print(count)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if a<=b and b<=c:
    print("Yes")
elif c<=b and b<=a:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
p = list(map(int, input().split()))

cnt = 0
for i in range(N):
    if p[i] != i+1:
        cnt += 1

if cnt == 0 or cnt == 2:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    L=[0]*(N+1)
    L[0]=2
    L[1]=1
    for i in range(2,N+1):
        L[i]=L[i-1]+L[i-2]
    print(L[N])
    
if __name__=="__main__":
    main()
# Judge status: Accepted
N = int(input())
A = [int(i) for i in input().split()]
m2 = 0
m4 = 0
for a in A:
    m2 += int(a%2 == 0 and not a%4 == 0)
    m4 += int(a%4 == 0)
if m4 >= N//2:
    print("Yes")
elif m4*2 + m2 >= N:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
readline=sys.stdin.readline

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

from collections import defaultdict
dic=defaultdict(int)

for i in range(len(A)):
  dic[A[i]]+=1
  
all=0
for v in dic.values():
  all+=v*(v-1)//2
  
for i in range(len(A)):
  print(all-(dic[A[i]]-1))
# Judge status: Accepted
import math

def calc_lcm(x, y):
    return (x * y) // math.gcd(x, y)

N,*T = map(int,open(0).read().split())

lcm = 1

for i in T:
  lcm = calc_lcm(lcm,i)
print(lcm)
# Judge status: Wrong Answer
S = str(input())
T = str(input())
if len(T) == len(S) + 1:
    print("Yes")
else:
    print("No")