Harryxun/stf_run huggingface dataset:
import sys


def main(lines):
    s, t = lines.split('\n')

    s_ = ''
    for i in sorted(s):
        s_ += i

    t_ = ''
    for i in sorted(t, reverse=True):
        t_ += i

    if s_ < t_:
        return 'Yes'
    else:
        return 'No'


if __name__ == '__main__':
    lines_ = sys.stdin.readlines()
    ret = main(lines_)
    print(ret)

### FIXED CODE ###

import sys


def main(s, t):
    s_ = ''
    for i in sorted(s):
        s_ += i

    t_ = ''
    for i in sorted(t, reverse=True):
        t_ += i

    if s_ < t_:
        return 'Yes'
    else:
        return 'No'


if __name__ == '__main__':
    _s = input()
    _t = input()
    ret = main(_s, _t)
    print(ret)
n, x = map(int, input().split())
l = list(map(int, input().split()))

xnow = 0
ans = 0
while xnow <= x:
    ans+=1
    xnow += l[ans-1]
print(ans)


### FIXED CODE ###

n, x = map(int, input().split())
l = list(map(int, input().split()))

cum = [0] * (n+1)
for i in range(1, n+1):
    cum[i] = cum[i-1] + l[i-1]

f = True
for i in range(n+1):
    if cum[i] > x:
        f = False
        print(i)
        break
if f:
    print(n+1)
n=int(input())
A=list(map(int,input().split()))
print(*A[::-2],*A[n%2::2])

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
if N%2==0:
    B=A[::-2]+A[::2]
else:
    B=A[::-2]+A[1::2]
print(*B)
a = input()
print(a + a**2 + a**3)

### FIXED CODE ###

a = int(input())
print(a + a ** 2 + a ** 3);
a b = map(int, input().split())

if a//b == 0:
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

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

if (a*b)%2 == 0:
  print('Even')
else:
  print('Odd')
from collections import deque
import numpy as np


def main():
    h, w, m = map(int, input().split())
    base = np.zeros((h, w), dtype=int)
    for n in range(m):
        h1, w1 = map(int, input().split())
        base[h1-1][w1-1] = 1
    hs, ws = [], []
    for n in range(h):
        hs.append(sum(base[n]))
    for n in range(w):
        ws.append(sum(base[:, n]))
    hs = np.array(hs)
    ws = np.array(ws)
    h_maxindex = [i for i, x in enumerate(hs) if x == max(hs)]
    w_maxindex = [i for i, x in enumerate(ws) if x == max(ws)]
    fla = 0
    for i in h_maxindex:
        for j in w_maxindex:
            if base[i][j] == 0:
                print(max(hs) + max(ws))
                fla = 1
                break
    if fla == 0:
        print(max(hs) + max(ws) - 1)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    h, w, m = map(int, input().split())
    bombs_h = [0] * h
    bombs_w = [0] * w
    B = []
    for n in range(m):
        h1, w1 = map(lambda x: int(x)-1, input().split())
        B.append((h1, w1))
        bombs_w[w1] += 1
        bombs_h[h1] += 1
    max_h = max(bombs_h)
    max_w = max(bombs_w)
    h_maxindex = [i for i, x in enumerate(bombs_h) if x == max_h]
    w_maxindex = [i for i, x in enumerate(bombs_w) if x == max_w]
    cnt = 0
    k = len(h_maxindex) * len(w_maxindex)
    for i, j in B:
        if bombs_h[i] == max_h and bombs_w[j] == max_w:
            cnt += 1
    ans = max_h + max_w - (cnt == k)
    print(ans)
    
    
if __name__ == "__main__":
    main()
import math
from itertools import combinations

def main():
    k = int(input())
    res = 0
    memo = [[0 for _ in range(k+1)] for _ in range(k+1)]
    for i ian range(1, k+1):
        for j in range(i, k+1):
            tmp = math.gcd(i,j)
            memo[i][j] = tmp
            memo[j][i] = tmp

    for i in range(1, k+1):
        res += i 

    for c in combinations(range(1,k+1),2):
        ab = memo[c[0], c[1]]
        res += ab * 6

    for c in combinations(range(1,k+1), 3):
        ab = memo[c[0], c[1]]
        abc = memo[ab, c[2]]
        res += abc * 6
    print(res)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from itertools import permutations

def main():
    n = int(input())
    s = input()
    res = 0
    r = 0
    g = 0
    b = 0
    for i, c in enumerate(s):
        if c == 'R':
            r += 1
        elif c == 'G':
            g += 1
        else:
            b += 1
    
    rgb = []
    for t in permutations('RGB'):
        rgb.append(''.join(t))

    cnt = 0
    for i in range(n-2):
        for j in range(i+1, n-1):
            k = 2*j - i 
            if k >= n:
                break
            if (s[i] + s[j] + s[k]) in rgb:
                cnt += 1
    print(r*g*b - cnt)


if __name__ == '__main__':
    main()
import math
A,B = map(int,input().split())
print(int(A * B / math.gcd(A,B)))


### FIXED CODE ###

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

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

lcm = A * B // gcd(A,B)
print(lcm)
print(input().index()//2+1)

### FIXED CODE ###

print(input().index("0")//2+1)
k,x=map(int, input().split())
min_ans=x-k+1
max_ans=x+k-1
ans_list=list(range(min_ans,max_ans+1))
print(" ".join(ans_list))

### FIXED CODE ###

k,x=map(int, input().split())
min_ans=x-k+1
max_ans=x+k-1
ans_list=list(range(min_ans,max_ans+1))
for i in range(len(ans_list)):
  ans_list[i]=str(ans_list[i])
ans=" ".join(ans_list)
print(ans)
import time
s=time.time()
while time.time()-s<39.99:pass
i=input
a,b,c,d,e=map(int,[i(),i(),i(),i(),i()])
if a<0:print(c*-a+d+b*e)
else:print((b-a)*e)

### FIXED CODE ###

import time
s=time.time()
while time.time()-s<39.9:pass
i=input
a,b,c,d,e=map(int,[i(),i(),i(),i(),i()])
if a<0:print(c*-a+d+b*e)
else:print((b-a)*e)
def find(s,t):
    if (len(s)==0 or len(t)==0):
        return ""
    if(s[0]==t[0]):
        if(len(s)==1 or len(t)==1):
            return s[0]
        return s[0]+find(s[1:],t[1:])
    x=y=""
    if(len(t)>1):
        x=find(s[::],t[1:])
    if(len(s)>1):
        y=find(s[1:],t[::])
    if(len(x)>len(y)):
        return x
    else:
        return y
def solve():
    s=input()
    t=input()
    ans=find(s,t)
    print(ans)

solve()

### FIXED CODE ###

from subprocess import*
call(('pypy3','-c',"""
s=input()
t=input()
a=len(s)
b=len(t)
dp=[[0]*(b+1) for i in range(a+1)]
for i in range(a):
  for j in range(b):
    if s[i]==t[j]:
      dp[i+1][j+1]=dp[i][j]+1
    else:
      dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j])
res=''
while a!=0 and b!=0:
  if dp[a][b]==dp[a-1][b]:
    a-=1
  elif dp[a][b]==dp[a][b-1]:
    b-=1
  else:
    a-=1
    b-=1
    res=s[a]+res
print(res)
"""))
"""
from subprocess import*
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
# import numpy as np
starttime = time.time()
# import numpy as np
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]

try:
    # sys.setrecursionlimit(int(pow(10,6)))
    # sys.stdin = open("input.txt", "r")
    # sys.stdout = open("../output.txt", "w")
except:
    pass

"""
S = input().split()
words = []
remain = []
for i in range(len(S)-2):
  words.append(S[i] + S[i+1] + S[i+2])
for j in range(len(words)):
  remain.append(753 - int(words[j]))
ans = remain.index(min(remain))
print(words[ans])
  
  

### FIXED CODE ###

S = list(input())
words = []
remain = []
for i in range(len(S)-2):
    words.append(S[i] + S[i+1] + S[i+2])
for j in range(len(words)):
    if int(words[j]) >= 753:
        remain.append(int(words[j]) - 753)
    else:
        remain.append(753 - int(words[j]))
ans = remain.index(min(remain))
print(remain[ans])
a, b = input().split()
a_w = a * int(b)
b_w = b * int(a)

if a => b:
  print(b_w)
else:
  print(a_w)

### FIXED CODE ###

a, b = input().split()
a_w = a * int(b)
b_w = b * int(a)

if a > b:
  print(b_w)
else:
  print(a_w)
from collections import deque
from sys import exit

N, M, K = [int(x) for x in input().split()]

a_book = [0]
for index, i in enumerate(input().split(), 1):
    if a_book[index-1] + int(i) <= K:
        a_book.append(a_book[index-1] + int(i))
    else:
        break

b_book = [0]
for index, i in enumerate(input().split(), 1):
    if b_book[index-1] + int(i) <= K:
        b_book.append(b_book[index-1] + int(i))
    else:
        break

search = deque()
check = {}


def search_count(v):
    search.appendleft(v)
    while search:
        v = search.popleft()

        if not v in check:
            check[v] = v[0] + v[1]

            if not (v[0] + 1, v[1]) in check:
                if v[0] + 1 <= N:
                    if a_book[v[0] + 1] + b_book[v[1]] <= K:
                        search.appendleft((v[0] + 1, v[1]))

            if not (v[0], v[1] + 1) in check:
                if v[1] + 1 <= M:
                    if a_book[v[0]] + b_book[v[1] + 1] <= K:
                        search.appendleft((v[0], v[1] + 1))


search_count((0, 0))

print(max(check.values()))


### FIXED CODE ###

from bisect import bisect_right
from time import time

N, M, K = [int(x) for x in input().split()]

a_book = [0]
for index, i in enumerate(input().split(), 1):
    if a_book[index-1] + int(i) <= K:
        a_book.append(a_book[index-1] + int(i))
    else:
        N = index - 1
        break

b_book = [0]
for index, i in enumerate(input().split(), 1):
    if b_book[index-1] + int(i) <= K:
        b_book.append(b_book[index-1] + int(i))
    else:
        M = index - 1
        break

check = {}

max_books = 0

for i, a in enumerate(a_book):
    b_pos = bisect_right(b_book, K - a)

    if max_books < b_pos - 1 + i:
        max_books = b_pos - 1 + i

print(max_books)
N=int(input())
xyh=[list(map(int,input().split())) for i in range(N)]
from itertools import product
H={(i,j):-10**9 for i,j in product(range(101),repeat=2)}
for n in range(N):
    x,y,h=xyh[n]
    K=[e for e in H.keys()]
    for i,j in K:
        k0=H[i,j]
        k=abs(i-x)+abs(j-y)+h if h else -(abs(i-x)+abs(j-y))
        if k<0:
            if k0<k:
                H[i,j]=k
        elif k0<0:
            if k<=-k0:
                H[i,j]=k
            else:
                del H[i,j]
        elif k!=k0:
            del H[i,j]
i,j=list(H.keys())[0]
print(i,j,H[(i,j)])

### FIXED CODE ###

N=int(input())
xyh=[list(map(int,input().split())) for i in range(N)]
from itertools import product
H={(i,j):-10**10 for i,j in product(range(101),repeat=2)}
for n in range(N):
    x,y,h=xyh[n]
    K=[e for e in H.keys()]
    for i,j in K:
        k0=H[i,j]
        k=abs(i-x)+abs(j-y)+h if h else -(abs(i-x)+abs(j-y))
        if k<0:
            if k0<k:
                H[i,j]=k
            elif -k<k0:
                del H[i,j]
        elif k0<0:
            if k<=-k0:
                H[i,j]=k
            else:
                del H[i,j]
        elif k!=k0:
            del H[i,j]
i,j=list(H.keys())[0]
print(i,j,H[i,j])
s = str(input())
print(s.replace(',',' ')

### FIXED CODE ###

s = input().replace(","," ")
print(s)
s=list(str(input()))
ans=0
for i in range(4):
    id s[i]=='2':
        ans+=1
print(ans)

### FIXED CODE ###

s=list(str(input()))
ans=0
for i in range(4):
    if s[i]=='2':
        ans+=1
print(ans)
#include <iostream>
#include <vector>
#include <string>
#include <map>

using namespace std;

int main() {
	int h,w;
	cin >> h >> w;
	map<char,int> cnt;
	for(int i = 0; i < h; i++) {
		string s;
		cin >> s;
		for(char c : s) cnt[c]++;
	}
	int c1 = 0;
	int c2 = 0;
	for(auto x : cnt) {
		if(x.second % 2) c1 ++;
		c2 += x.second / 4 * 4;
	}
	if(c1 != (h*w)%2 || c2 < (h/2*2)*(w/2*2) ) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}



### FIXED CODE ###

def func() :
    n,m=map(int,input().split())
    a={}
    for i in range(n) :
        s = input()
        for c in list(s):
            if c in a:
                a[c]+=1
            else :
                a[c] = 1
    c1=sum(map(lambda x : x%2 , a.values()))
    c2=sum(map(lambda x : x//4*4, a.values()))
    if c1 != n*m%2 or c2 < (n//2*2)*(m//2*2) :
        print('No')
    else :
        print('Yes')
func()
from scipy.special import comb

n, m = map(int, input().split())
print(comb(n, 2, exact=True) + comb(m , 2, exact=True))

### FIXED CODE ###

n, m = map(int, input().split())
print(n*(n-1)//2 + m*(m-1)//2)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

IA = lambda: [int(x) for x in input().split()]
IM = lambda N: [IA() for _ in range(N)]

N, K = IA()
AB = IM(N-1)

P = 1000000007

tree = {}
for a, b in AB:
    tree.setdefault(a, set()).add(b)
    tree.setdefault(b, set()).add(a)

root = AB[0][0]
def f(root):
    v = K
    stack = [(None, None, root, K - 1)]
    while stack:
        grand_parent, parent, current, k = stack.pop()

        for i, child in enumerate(tree[current] - {parent}):
            v = v*(k-i) % P
            stack.append( (parent, current, child, K - 2) )
    return v

print(f(root)) 


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

IA = lambda: [int(x) for x in input().split()]
IM = lambda N: [IA() for _ in range(N)]

N, K = IA()
AB = IM(N - 1)

P = 1000000007

tree = {}
for a, b in AB:
    tree.setdefault(a, set()).add(b)
    tree.setdefault(b, set()).add(a)


def f(root):
    stack = [(None, None, root, K - 1)]
    v = K
    while stack:
        grand_parent, parent, current, k = stack.pop()

        for i, child in enumerate(tree[current] - {parent}):
            v = v * (k - i) % P
            stack.append((parent, current, child, K - 2))
    return v


print(f(AB[0][0]) if AB else K)
n=int(input())
z=[]
for i in range(n):
    x,y=map(int,input().split())
    z.append([x,y])
z.sort(reverse=True)
dif=[]
for i in range(n-1):
    x=z[i+1][0]-z[i][0]
    y=z[i+1][1]-z[i][1]
    dif.append([x,y])
dif.sort(reverse=True)
count=-1
buf=1
comp=dif[0]
ans=dif[0]
for i in range(1,n-1):
    if comp==dif[i]:
        #print(comp,dif[i])
        buf+=1
    else:
        #print(comp,dif[i],buf)
        if count<buf:
            count=buf
            ans=comp
        buf=0
        comp=dif[i]
if count<buf:
    count=buf
    ans=comp
print(n-count)

### FIXED CODE ###

n=int(input())
z=[]
for i in range(n):
    x,y=map(int,input().split())
    z.append([x,y])
z.sort(reverse=True)
dif=[]
for i in range(n):
    for j in range(n):
        if i<j:
            x=z[j][0]-z[i][0]
            y=z[j][1]-z[i][1]
            dif.append([x,y])
dif.sort(reverse=True)
count=-1
buf=0
comp=[0,0]
ans=[0,0]
l=len(dif)
for i in range(l):
    if comp==dif[i]:
        buf+=1
    else:
        if count<buf:
            count=buf
            ans=comp
        buf=1
        comp=dif[i]
if count<buf:
    count=buf
    ans=comp
print(n-count)
import math
n = int(input())
for i in range(n):
    for j in range(n):
        if i*4+j*7 == n:
            print("Yes")
            quit()
        if i*4+j*7 >= n:
            break
print("No")

### FIXED CODE ###

a, b = map(int, input().split())
if a%b == 0:
    print(0)
else:
    print(1)
N = int(input())
S = [input() for _ in range(N)]
A = []
cnt = 0
for k in S:
   A.append(''.join(sorted(k)))
for i in A[:]:
    cnt += A.count(i) - 1
    A.remove(i)
print(cnt)

### FIXED CODE ###

A, B = map(int, input().split())
print(max([A + B, A - B, A * B]))
n = int(input())
ws = list(map(int, input().split()))
print(min([abs(sum(ws[:i+1]) - sum(ws[i+1:])) for i in range(len(ws - 1))])

### FIXED CODE ###

n = int(input())
ws = list(map(int, input().split()))
print(min([abs(sum(ws[:i+1]) - sum(ws[i+1:])) for i in range(len(ws) - 1)]))
import math


a, b, c = list(map(int, input().split()))
sa, sb, sc = math.sqrt(a), math.sqrt(b), math.sqrt(c)
d = c-a-b
if len(str*d) > ８:
    if (sa + sb < sc):
        print("Yes")
    else:
        print("No")

else:
    if (c-a-b)**2 > 4*a*b:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

import math


a, b, c = list(map(int, input().split()))
sa, sb, sc = math.sqrt(a), math.sqrt(b), math.sqrt(c)
d = c-a-b

if (c-a-b > 0) and ((c-a-b)**2 > 4*a*b):
    print("Yes")
else:
    print("No")
X = int(input())

ans = 0

def search(a):
    
    global ans
    
    if a > X:
        return 0
    
    if a == X:
        ans = 1
    
    search(a+100)
    search(a+101)
    search(a+102)
    search(a+103)
    search(a+104)
    search(a+105)
    
    return ans
        
print(search(0))

### FIXED CODE ###

X = int(input())

a = X//100

Xlist = str(X)

import sys

if X <100:
    print(0)
    sys.exit()
    
if a*5+1 <= int(Xlist[-2] + Xlist[-1]) and int(Xlist[-2] + Xlist[-1]) <=99:
    print(0)
else:
    print(1)
s,t =input().split()
a,b = map(int, input().split())
u = input()


a = 123
b = 'abc'

print(f'{a} and {b}')
# print(f'{s} {t}')

# if s == u:
#     a-=1
#     print(f'{a} {b}')
# else:
#     b-=1
#     print(f'{a} {b}')


### FIXED CODE ###

s,t =input().split()
a,b = map(int, input().split())
u = input()


if u == s:
    print(a-1, b)
elif u == t:
    print(a, b-1)
N=input()

if len(N)<3:
    print(0)
else:
    arr=set([357, 375, 537, 573, 735, 753])
    for i in range(len(N)-3):
        new=set()
        for num in arr:
            for j in range(len(str(num))+1):
                n=str(num)[:j]+'3'+str(num)[j:]
                new.add(int(n))
                n=str(num)[:j]+'5'+str(num)[j:]
                new.add(int(n))
                n=str(num)[:j]+'7'+str(num)[j:]
                new.add(int(n))
        arr |= new

arr=list(arr)
arr.sort()
cnt=0
for i in range(len(arr)):
    if arr[i]<=int(N):
        cnt+=1
    else:
        break
print(cnt)

### FIXED CODE ###

N=input()

if len(N)<3:
    print(0)
else:
    arr=set([357, 375, 537, 573, 735, 753])
    for i in range(len(N)-3):
        new=set()
        for num in arr:
            for j in range(len(str(num))+1):
                n=str(num)[:j]+'3'+str(num)[j:]
                new.add(int(n))
                n=str(num)[:j]+'5'+str(num)[j:]
                new.add(int(n))
                n=str(num)[:j]+'7'+str(num)[j:]
                new.add(int(n))
        arr |= new

    arr=list(arr)
    arr.sort()
    cnt=0
    for i in range(len(arr)):
        if arr[i]<=int(N):
            cnt+=1
        else:
            break
    print(cnt)
a,b=map(int,inpput().split())
print(max(a+b,max(a,b)+max(a-1,b-1))

### FIXED CODE ###

a,b=map(int,input().split())
print(max(a+b,max(a,b)+max(a-1,b-1)))
n=int(input())
s=input()
a=0
if n>2:
    for i in range(0,n):
        if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
         a=a+1
print(a)

### FIXED CODE ###

n=int(input())
s=input()
a=0
if n>2:
    for i in range(0,n):
        if i<n-2 and s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
         a=a+1
print(a)
import fractions

a, b, c, d = map(int, input().split())

b_c = b//c - (a-1)//c
d_c = b//d - (a-1)//d
cd = (c * d) // math.gcd(c, d)
cd_c = b//cd - (a-1)//cd

print((b - a + 1) - (b_c + d_c - cd_c))


### FIXED CODE ###

s = list(input())

p = ''
for i in s:
    if p == i:
        print('Bad')
        exit()
    else:
        p = i
print('Good')
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
MAX_VAL = 14000
OFFSET = MAX_VAL // 2

h, w = [int(item) for item in input().split()]
a = []
b = []
for i in range(h):
    line = [int(item) for item in input().split()] + [0]
    a.append(line)
a.append([0] * (w + 1))
for i in range(h):
    line = [int(item) for item in input().split()] + [0]
    b.append(line)
b.append([0] * (w + 1))

max_f = [[0] * (w+1) for _ in range(h+1)]
min_f = [[0] * (w+1 )for _ in range(h+1)]
# dp[height][width][bias]
dp = [[[0] * MAX_VAL for _ in range(w+1)] for _ in range(h+1)] 
max_f[0][0] = abs(a[0][0] - b[0][0])
min_f[0][0] = -abs(a[0][0] - b[0][0])

dp[0][0][OFFSET + a[0][0] - b[0][0]] = 1
dp[0][0][OFFSET + b[0][0] - a[0][0]] = 1
for i in range(h):
    for j in range(w):
        diffr = a[i][j+1] - b[i][j+1]
        diffd = a[i+1][j] - b[i+1][j]
        max_f[i][j+1] = max(max_f[i][j+1], max_f[i][j] + diffr)
        min_f[i][j+1] = min(min_f[i][j+1], min_f[i][j] - diffr)
        max_f[i+1][j] = max(max_f[i+1][j], max_f[i][j] + diffd)
        min_f[i+1][j] = min(min_f[i+1][j], min_f[i][j] - diffd)

        max_f[i][j+1] = min(OFFSET-10, max_f[i][j+1])
        min_f[i][j+1] = min(-OFFSET+10, min_f[i][j+1])
        max_f[i+1][j] = min(OFFSET-10, max_f[i+1][j])
        min_f[i+1][j] = min(-OFFSET+10, min_f[i+1][j])

        for k in range(OFFSET + min_f[i][j] - 1, OFFSET + max_f[i][j] + 1):
            if dp[i][j][k] == 0:
                continue
            # Move right
            dp[i][j+1][k+diffr] = 1
            dp[i][j+1][k-diffr] = 1
            # Move down
            dp[i+1][j][k+diffd] = 1
            dp[i+1][j][k-diffd] = 1
ans = 10**9
for i, item in enumerate(dp[h-1][w-1]):
    if item == 1:
        ans = min(ans, abs(i - OFFSET))
print(ans)

### FIXED CODE ###

#!/usr/bin/env python3
import sys
input = sys.stdin.readline
MAX_VAL = 12800
 
h, w = [int(item) for item in input().split()]
a = []
b = []
for i in range(h):
    line = [int(item) for item in input().split()] + [0]
    a.append(line)
a.append([0] * (w + 1))
for i in range(h):
    line = [int(item) for item in input().split()] + [0]
    b.append(line)
b.append([0] * (w + 1))
 
# dp[height][width] bitset
dp = [[0] * (w+1) for _ in range(h+1)] 
delta = abs(a[0][0] - b[0][0])
dp[0][0] |= 1 << (MAX_VAL + delta)
dp[0][0] |= 1 << (MAX_VAL - delta)
for i in range(h):
    for j in range(w):
        diffr = abs(a[i][j+1] - b[i][j+1])
        diffd = abs(a[i+1][j] - b[i+1][j])
        # Move right
        add_delta = dp[i][j] << diffr
        sub_delta = dp[i][j] >> diffr
        dp[i][j+1] |= add_delta | sub_delta
        # Move down
        add_delta = dp[i][j] << diffd
        sub_delta = dp[i][j] >> diffd
        dp[i+1][j] |= add_delta | sub_delta
ans = MAX_VAL
for i in range(MAX_VAL * 2):
    if dp[h-1][w-1] & (1 << i):
        ans = min(ans, abs(i - MAX_VAL))
print(ans)
import math
r = float(raw_input())
print ("%f %f"%(r**2*PI,r*2*PI))

### FIXED CODE ###

import math
r = float(raw_input())
print '%f %f' % (r*r*math.pi,r*2*math.pi)
s = input().rstrip()
k = int(input())
result = []
for i in range(len(s)):
  for j in range(i+1,i+k):
    if i+k <= len(s):
      result.append(s[i:j])
result.sort()
print(result[k-1])

### FIXED CODE ###

s = input().rstrip()
k = int(input())
result = []
for i in range(len(s)):
  for j in range(i+1,i+k+1):
    if j <= len(s) and s[i:j] not in result:
      result.append(s[i:j])
result.sort()
print(result[k-1])
h = input()
w = input()
n = input()

l = max(h, w)
print(n // l)

### FIXED CODE ###

import math

h = int(input())
w = int(input())
n = int(input())

l = max(h, w)
print(math.ceil(n / l))
mport time
import math
a,b = map(int,input().split())
cnt = 0
if a >= b:
  A = int(math.sqrt(b))
else:
  A = int(math.sqrt(a))
pn=[2]

t1 = time.time()
for L in range(3,A):
    chk=True
    for L2 in pn:
        if L%L2 == 0:chk=False
    if chk==True:pn.append(L)
pn.append(1)
t2 = time.time()
for i in pn:
  if a%i ==0 and b%i == 0:
    cnt += 1
t3 = time.time()
print(cnt)

### FIXED CODE ###

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

def make_divisors(n):
	divisors = set()
	for i in range(1, int(n**0.5)+1):
		if n % i == 0:
			divisors.add(i)
			if i != n // i:
				divisors.add(n//i)
	return divisors
	
A = make_divisors(a)
B = make_divisors(b)
S = A & B
#Sから素数だけを抽出してカウント
import math

def is_prime(n):
	if n == 1: return False
	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False
	return True
cnt = 1
for i in S:
	if is_prime(i) == True:
		cnt += 1

print(cnt)
from sys import stdin
K, X = [int(x) for x in stdin.readline().rstrip().split()]

if X =< K*500:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

from sys import stdin
K, X = [int(x) for x in stdin.readline().rstrip().split()]

if X <= K*500:
    print("Yes")
else:
    print("No")