Harryxun/stf_run huggingface dataset:
i = 0
while 1:
    x,y = map(int,input().split())
    i += 1
    if x == 0 or y==0:
        break
    n=[x,y]
    n.sort()
    print n

### FIXED CODE ###

while 1:
  x,y = map(int,raw_input().split())
  if x==0 and y==0:
    break
  else:
    n=[x,y]
    n.sort()
    print n[0],n[1]
n = int(input())
h = list(map(int, input().split()))

memo = [-1] * n
def cost(i):
    if i == 0:
        return 0
    elif i == 1:
        return abs(h[i]-h[i-1])
    else:
        if memo[i-1] == -1:
            return min(cost(i-1)+abs(h[i-1]-h[i]), cost(i-2)+abs(h[i-2]-h[i]))
print(cost(n-1))

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))

cost = [0] * (n + 1)
cost[0] = 0
cost[1] = abs(h[1] - h[0])

for i in range(2, n):
  cost1 = cost[i-2] + abs(h[i] - h[i-2])
  cost2 = cost[i-1] + abs(h[i] - h[i-1])
  cost[i] = min(cost1, cost2)
print(cost[n-1])
N, M = map(int, input().split())
ABs = [tuple(map(int, input().split())) for _ in range(M)]

par = [i for i in range(N)]

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def same(x, y):
    return find(x) == find(y)

def unite(x, y):
    x = find(x)
    y = find(y)
    if x != y:
        par[x] = y

for a, b in ABs:
    unite(a-1, b-1)

print(len(set(par) -1))


### FIXED CODE ###

N, M = map(int, input().split())
ABs = [tuple(map(int, input().split())) for _ in range(M)]

par = [i for i in range(N)]

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x, y):
    x = find(x)
    y = find(y)
    if x != y:
        par[x] = y

for a, b in ABs:
    unite(a-1, b-1)

for x in range(N):
    find(x)

print(len(set(par))-1)
import sys
input = sys.stdin.readline

N, X = map(int, input().split())
l, p = [1], [1]

def f(N, X)
    for i in range(N):
        if N == 0:
            return 0 if X == 0 else 1
        elif X <= 1 + l[N-1]:
            return f(N-1, X-1)
        else:
            return p[N-1] + 1 + f(N-1, X-2-a[N-1])
    
print(f(N, X))


### FIXED CODE ###

import sys
input = sys.stdin.readline

N, X = map(int, input().split())
l, p = [1], [1]

for i in range(N):
    l.append(l[i]*2 + 3)
    p.append(p[i]*2 + 1)

def f(N, X):
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + l[N-1]:
        return f(N-1, X-1)
    else:
        return p[N-1] + 1 + f(N-1, X-2-l[N-1])
    
print(f(N, X))
S = [*input()] # これで文字列を一文字にできる
T = input()
for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if(word == T):
        print('Yes')
        break
    elif(i == j):
        print('No')


### FIXED CODE ###

S = tuple(input()) # これで文字列を一文字にできる
T = input()

for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if word == T:
        print('Yes')
        break
    elif i == j:
        print('No')
        break
n = input()
S = (input().split())
q = input()
T = (input().split())

#print(len(S&T))
#set:???????????????????????????

cnt = 0

for i in range(T):
    left = 0
    right = n-1
    while left < right:
        mid = (left+right) // 2
        if S[mid] == i:
            cnt += 1
            break
        elif S[mid] < i:
            left = mid+1
        else:
            right = mid-1
print(cnt)

### FIXED CODE ###

n = int(input())
S = input().split()
q = int(input())
T = input().split()

#print(len(S&T))
#set:???????????????????????????

cnt = 0

for i in range(len(T)):
    left = 0
    right = n
    while left < right:
        mid = (left+right) // 2
        if int(S[mid]) == int(T[i]):
            cnt += 1
            break
        elif int(S[mid]) < int(T[i]):
            left = mid+1
        else:
            right = mid
print(cnt)
def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
def dbg(o):
    print(o, file=sys.stderr)

# ---------------------------------------

def main():
    s = input()
    dc = {}
    for st in s:
        if not st in dc:
            dc[st] = 1
        else:
            dc[st] += 1
    dbg(dc)
    for k, v in dc.items():
        if v % 2 == 1:
            print("No")
            exit()
    print("Yes")

main()


### FIXED CODE ###

import collections
w = list(input())

cnt = collections.Counter(w)
ans = "Yes"
for v in cnt.values():
    if v%2!=0:
        ans = "No"
        break
        
print(ans)
arr_len_int = int(input().split(' ')[1])
a = [input() for i in range(arr_len_int)]
a.sort()
print(''.join(a ))

### FIXED CODE ###

arr_len_int = int(input().split(' ')[0])
if (arr_len_int==1):
  print(input())
else:
  a = [input() for i in range(arr_len_int)]
  a.sort()
  print(''.join(a))
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
print(sum(l[:k])

### FIXED CODE ###

n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
print(sum(l[:k]))
# coding: utf-8

n = int(input().strip())
vs = [int(s) for s in input().strip().split()]

as_i = [vs[i*2] for i in range(n//2)]
as_i2 = [vs[i*2+1] for i in range(n//2)]

count_i = [0] * 10001
for a in as_i:
    count_i[a] += 1

as_i2 = [vs[i*2+1] for i in range(n//2)]
count_i2 = [0] * 10001
for a in as_i2:
    count_i2[a] += 1


max_val_i = 0
max_count_i = 0
next_max_val_i = 0
next_max_count_i = 0
for i in range(1, 10001):
    if count_i[i] > max_count_i:
        next_max_count_i, next_max_val_i = max_count_i, max_val_i
        max_count_i, max_val_i = count_i[i], i

max_val_i2 = 0
max_count_i2 = 0
next_max_val_i2 = 0
next_max_count_i2 = 0
for i in range(1, 10001):
    if count_i2[i] > max_count_i2:
        next_max_count_i2, next_max_val_i2 = max_count_i2, next_max_val_i2
        max_count_i2, max_val_i2 = count_i2[i], i

# print(max_val_i, max_count_i)
# print(max_val_i2, max_count_i2)

keep_num = 0
if max_val_i != max_val_i2:
    keep_count = max_count_i + max_count_i2
else:
    if max_count_i > max_count_i2:
        keep_count = max_count_i + next_max_count_i2
    else:
        keep_count = next_max_count_i + max_count_i2

print(n - keep_count)


### FIXED CODE ###

# coding: utf-8
import collections

n = int(input().strip())
vs = [int(s) for s in input().strip().split()]

e = [vs[i*2] for i in range(n//2)]
o = [vs[i*2+1] for i in range(n//2)]

e_counter = collections.Counter(e).most_common()
o_counter = collections.Counter(o).most_common()

e1, e1_count = e_counter[0]
try:
    e2, e2_count = e_counter[1]
except IndexError:
    e2_count = 0

o1, o1_count = o_counter[0]
try:
    o2, o2_count = o_counter[1]
except IndexError:
    o2_count = 0

if e1 != o1:
    keep_num_count = e1_count + o1_count
else:
    keep_num_count = e1_count + o2_count
    if keep_num_count < e2_count + o1_count:
        keep_num_count = e2_count + o1_count

print(n - keep_num_count)
import itemgetter()
N = int(input())
task = []
for i in range(N):
  M = list(map(int,input().split()))
  task.append(M)
task.sort(key = itemgetter(1))
K = 0
ans = 1
for i in range(N):
  K += task[i,0]
  if (K>task[i,1]):
    ans = 0
    break
if ans:
  print("Yes")
else:
  print("No")
  

### FIXED CODE ###

N = int(input())
task = []
for i in range(N):
  M = list(map(int,input().split()))
  M[0],M[1]=M[1],M[0]
  task.append(M)
task.sort()
K = 0
ans = 1
for i in range(N):
  K += task[i][1]
  if (K>task[i][0]):
    ans = 0
    break
if ans:
  print("Yes")
else:
  print("No")
L,N=(int(i) for i in input().split())
X = []
for i in range(0,N):
    a = int(input())
    X.append(a)
import math
result=0
if X[math.ceil(N/2)]<L/2:
  for i in range (1,math.ceil(N/2)):
    for j in range (N,math.ceil(N/2),-1):
      result+=abs(X[j]-X[i])
else:
   for i in range (1,math.ceil(N/2)):
    for j in range (N,math.ceil(N/2),-1):
      result+=abs(X[i]-X[j])
print(result)

### FIXED CODE ###

a,b,c=(int(i) for i in input().split())
if b+1>=c:
  print(b+c)
else:
  if a+1>=c-b:
    print(b+c)
  else:
    print(2*b+a+1)
N = int(input())

C = []

for i in range(N):

    c = int(input())

    if len(C) == 0 or C[-1] != c-1:
        C.append(c-1)

lis = []
last = [-1] * N

for i in range(len(C)):

    if i == 0:
        lis.append(1)
    
    elif last[C[i]] == -1 or last[C[i]] == i-1:
        lis.append(lis[-1])

    else:
        lis.append(lis[-1]+lis[last[C[i]]])

    last[C[i]] = i


print (lis[-1])

### FIXED CODE ###


N = int(input())

C = []

for i in range(N):

    c = int(input())

    if len(C) == 0 or C[-1] != c-1:
        C.append(c-1)

lis = []
last = [-1] * (2 * (10**5))

for i in range(len(C)):

    if i == 0:
        lis.append(1)
    
    elif last[C[i]] == -1 or last[C[i]] == i-1:
        lis.append(lis[-1])

    else:
        lis.append(lis[-1]+lis[last[C[i]]])

    lis[-1] %= 10 ** 9 + 7
    last[C[i]] = i


print (lis[-1])
N, M = map(int, input().split())
P = list(map(int, input().split()))

class UnionFind():
    def __init__(self, N):
        self.nodes = [i for i in range(N)]

    def root(self, x):
        if self.nodes[x] == x:
            return x
        else:
            root = self.root(self.nodes[x])
            return root

    def is_same(self, x, y):
        return self.root(x) == self.root(y)

    def union(self, x, y):
        self.nodes[self.root(x)] = self.root(y)

tree = UnionFind(N+1)
for _ in range(M):
    x, y = map(int, input().split())
    tree.union(x, y)

ans = 0
for idx, p in enumerate(P):
    if tree.is_same(idx+1, p):
        ans += 1
print(ans)


### FIXED CODE ###

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

class UnionFind():
    def __init__(self, N):
        self.nodes = [i for i in range(N)]

    def root(self, x):
        if self.nodes[x] != x:
            self.nodes[x] = self.root(self.nodes[x])
        return self.nodes[x]

    def is_same(self, x, y):
        return self.root(x) == self.root(y)

    def union(self, x, y):
        self.nodes[self.root(x)] = self.root(y)

tree = UnionFind(N)
for _ in range(M):
    x, y = map(int, input().split())
    tree.union(x-1, y-1)

ans = 0
for idx, p in enumerate(P):
    if tree.is_same(idx, p-1):
        ans += 1
print(ans)
N = int(input())
S = 0
for i in range(1,N+1):
  if i%3==0 or i%5==0 or i%3==0 and i%5==0
	continue
  S +=i
print(S) 

### FIXED CODE ###

N = int(input())
out = 0
for i in range(1,N+1):
    if i%3 == 0 and i%5 == 0 or i%3==0 or i%5==0:
       continue
    out += i
print(out)
N = int(input())
A = list(map(int, input().split()))

A.sort()
i = 0
print(A)
while i < len(A) - 2:
    if A[i] == A[i + 1]:
        A.pop(i)
        A.pop(i + 2)
    else:
        i += 1
    print(i,A)

if A[-1] == A[-2]:
    print(len(A) - 1)
else:
    print(len(A))
        



### FIXED CODE ###

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

B = list(set(A))

if len(B) % 2 == 0:
    print(len(B) - 1)
else:
    print(len(B))
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード
    #B
    #input
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())

    #output
    #A < Bの時
        #V <= Wであれば、相手はひたすら逃げれば良く、この時鬼は相手を捕まえられない。
        #V > Wであれば、鬼は1秒に相手との距離をV-Wだけ詰められる。
        #B-A//V-WがTより小さいか同じ場合は鬼は相手を捕まえられる。
    #A > Bの時
        #上の議論とほぼ同じ。

    # %%
    if A < B:
        if V <= W:
            print("No")
            exit()
        else:
            if (B-A) <= T * (V-W):
                print("Yes")
                exit()
            else:
                print("No")
                exit()
    elif A > B:
        if V <= W:
            print("No")
            exit()
        else:
            if (A-B) <= T * (V-W)
                print("Yes")
                exit()
            else:
                print("No")
                eixt()

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()


### FIXED CODE ###

#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード
    #B
    #input
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())

    #output
    #A < Bの時
        #V <= Wであれば、相手はひたすら逃げれば良く、この時鬼は相手を捕まえられない。
        #V > Wであれば、鬼は1秒に相手との距離をV-Wだけ詰められる。
        #B-A//V-WがTより小さいか同じ場合は鬼は相手を捕まえられる。
    #A > Bの時
        #上の議論とほぼ同じ。

    if A < B:
        if V <= W:
            print("NO")
        else:
            if (V-W)*T >= B-A:
                print("YES")
            else:
                print("NO")
    elif A > B:
        if V <= W:
            print("NO")
        else:
            if (V-W)*T >= A-B:
                print("YES")
            else:
                print("NO")

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()
A,B,K = map(int,input().split())
S = list(range(A,B+1))

S2 = set(S[:K]+S[-K:])
S3 = sorted(S2)

for s in S3:
	print(s)

### FIXED CODE ###

A,B,K = map(int,input().split())
S = []
#list(range(A,B+1))
for i in range(K):
	S.append(A+i)
	S.append(B-i)

S = sorted(list(set(S)))

for i in range(len(S)):
	if A<=S[i]<=B:
		print(S[i])
n = int(input())
nums = [list(map(int,input().split()))for i in range(n)]


first = True
record = {}
target = None
for x, y, h in nums:
    if h != 0:
        target = x, y, h

if target is not None:
    x, y, h = target
    for i in range(0,101):
        for j in range(0, 101):
            if abs(x - i) + abs(x - j) + h >= 1:
                record[(i,j)] = abs(x - i) + abs(y - j) + h
    
    for x, y, h in nums:
        for (i, j) in list(record.keys()):
            if max(record[(i, j)] - abs(x-i) - abs(y-j), 0) != h:
                record.pop((i,j))
    key = list(record.keys())[0]

    print(*key, record[key])
else:
    for x, y, h in nums:
        record[(x,y)] = True
    ndone = True
    for i in range(101):
        for j in range(101):
            if (i, j) not in record and ndone:
                print(i, j, 1)
                ndone = False


### FIXED CODE ###

n = int(input())
nums = [list(map(int,input().split())) for i in range(n)]


first = True
record = {}
target = None
for x, y, h in nums:
    if h != 0:
        target = x, y, h

if target is not None:
    x, y, h = target
    for i in range(0,101):
        for j in range(0, 101):
            if abs(x - i) + abs(x - j) + h >= 1:
                record[(i,j)] = abs(x - i) + abs(y - j) + h
    
    for x, y, h in nums:
        for (i, j) in list(record.keys()):
            if max(record[(i, j)] - abs(x-i) - abs(y-j), 0) != h:
                record.pop((i,j))
    key = list(record.keys())[0]

    print(key[0],key[1], record[key])
else:
    for x, y, h in nums:
        record[(x,y)] = True
    ndone = True
    for i in range(101):
        for j in range(101):
            if (i, j) not in record and ndone:
                print(i, j, 1)
                ndone = False
l = list(range(10))  # LIST10桁の数字を生成
n, k = map(int, input().split())  # n=値段,10000以下 k=嫌いな個数
lis = list(map(int, input().split()))  # 嫌いな数字入力
[l.remove(x) for x in lis]  # 10桁の数字から嫌いな数字を削除
h = n / 10 ** (len(str(n))-1)  # 値段の一番左の数字を取得するための計算
temp = []
for x in l:
    if h < x:
        temp.append(x)
ans = []
ans.append(temp[0])
for x in range(len(str(n))-1):
    ans.append(l[0])
print(int("".join(map(str, ans))))

### FIXED CODE ###

numbers = {str(i) for i in range(10)}
N, K = map(int, input().split())
*D, = map(str, input().split())
D = set(D)
available = numbers - D
ans = 0
for i in range(N, 100000):
    nums = set(str(i))
    if nums <= available:
        print(i)
        break
import sys
sys.setrecursionlimit(1000000)
def times(h,kp):
    if h==1:
        return 1
    else:
        if h >= 10**9:
            return 1+2*times(int(h//2),kp)
        elif kp[h]==0:
            kp[h]=1+2*times(int(h//2),kp)
            return kp[h]
        else:
            return kp[h]
        
H=int(input())
kp=[0]*10**9
print(times(H,kp))

### FIXED CODE ###

#

import sys
input=sys.stdin.readline

def main():
    H=int(input())
    cnt=0
    ans=0
    while(H>1):
        H=int(H//2)
        ans+=2**cnt
        cnt+=1
    ans+=2**cnt
    print(ans)
    
    
    
if __name__=="__main__":
    main()
N = int(input())
S = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(N)]

ans = 0
for i in S:
    ans = max(ans, S.count(i) - T.count(i))

print(ans)

### FIXED CODE ###

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

ans = 0
for i in S:
    ans = max(ans, S.count(i) - T.count(i))

print(ans)
#!/usr/bin/env python3

N = int(input().split()[0])
p_list = list(map(int, input().split()))
count = 0
for i in range(N):
    index = i + 1
    if index == p_list[i]:
        if i != 0 and i != 1:
            if p_list[i + 1] == index + 1:
                p_list[i] = p_list[i + 1]
                p_list[i + 1] = index
            else:
                p_list[i] = p_list[i - 1]
                p_list[i - 1] = index
        elif i != 0:
            p_list[i] = p_list[i - 1]
            p_list[i - 1] = index
        elif i != 1:
            p_list[i] = p_list[i + 1]
            p_list[i + 1] = index

        count += 1

ans = count
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3

N = int(input().split()[0])
p_list = list(map(int, input().split()))
count = 0
for i in range(N):
    index = i + 1
    if index == p_list[i]:
        if i != 0 and i != N - 1:
            if p_list[i + 1] == index + 1:
                p_list[i] = p_list[i + 1]
                p_list[i + 1] = index
            else:
                p_list[i] = p_list[i - 1]
                p_list[i - 1] = index
        elif i != 0:
            p_list[i] = p_list[i - 1]
            p_list[i - 1] = index
        elif i != N - 1:
            p_list[i] = p_list[i + 1]
            p_list[i + 1] = index

        count += 1

ans = count
print(ans)
s=int(input())
ans=1
for i in range(1,n+1):
  ans=ans%(10**9+7)*i
  
  
print(ans%(10**9+7))

### FIXED CODE ###

s=int(input())
ans=1
for i in range(1,s+1):
  ans=ans%(10**9+7)*i
  
  
print(ans%(10**9+7))
array = ['L','R','U','D']
s = input()
c = 0
for i in range(len(s)):
  if i%2 == 0:
    if s[i] = 'L' or s[i] = 'U' or s[i] = 'D':
      continue
    else:
      c = 1
  if i%2 == 1:
    if s[i] = 'R' or s[i] = 'U' or s[i] = 'D':
      continue
    else:
      c = 1
if c== 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

array = ['L','R','U','D']
s = input()
c = 0
for i in range(len(s)):
  if i%2 == 1:
    if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
      continue
    else:
      c = 1
  if i%2 == 0:
    if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
      continue
    else:
      c = 1
if c== 0:
  print('Yes')
else:
  print('No')
N, M = map(int, input('').split(' '))
list = []
flag = []
num = 0
for j in range(N):
    if(j == N - 1):
        list.append(1)
    else:
        list.append(0)
    flag.append(0)
if(M == 0):
    M = 1
for i in range(M):
    s, c = map(int, input('').split(' '))
    s = int(s)
    if flag[N - s] == 1 and list[N - s] != c:
        print(-1)
        exit(0)
    else:
        list[N - s] = c
        flag[N - s] = 1
for j in range(N):
    num += list[j] * 10 ** j
if num > 0:
    print(num)
else:
    print(-1)

### FIXED CODE ###

import collections as cl
N, M = map(int, input().split())
dic = cl.defaultdict(lambda:-1)
num = 0
for i in range(0, M):
    s, c = map(int, input().split())
    if N - s in dic and dic[N-s] != c:
        print(-1)
        exit(0)
    else:
        dic[N-s] = c
if dic[N-1] == -1:
    if N == 1:
        dic[N-1] = 0
    else:
        dic[N-1] = 1
for j in dic.keys():
    num += dic[j] * (10 ** j)
if N > 1 and num < 10 ** (N - 1):
    print(-1)
else:
    print(num)
from collections import Counter

N = int(input())
s = [input() for i in range(N)]
c = []
rem = []
num = 0

for i,si in enumerate(s):
    s.pop(i)
    snum = 0
    for j,sj in enumerate(s):
        if Counter(si) == Counter(sj):
            snum+=1
            rem.append(j)
    rem.reverse()
    if(snum==1):
        num = num + 1
    else:
        num = num + int(snum*(snum+1)/2)

    for r in rem:
        s.pop(r)
    rem.clear()
print(num)

### FIXED CODE ###

N = int(input())
s = ["".join(sorted(input())) for i in range(N)]
s.sort()
ss = s[0]
num = 0
ans=0
for i in range(N):
    if ss == s[i]:
        num+=1
    else:
        ans+=num*(num-1)//2
        num=1
        ss=s[i]
ans+=num*(num-1)//2
print(ans)
N,M=map(int,input().split())
A=[input()for i in range(N)]
B=[input()for i in range(M)]
b=''
a='no'
for i in range(M):
    b+=B[i]
for i in range(N-M+2):
    if B[0]in A[0] and B[1] in A[1]:
        for j in range(N-M+2):
            a=''
            for k in range(M):
                a+=A[i+k][j:j+M]
    if a==b:
        print("Yes")
        exit()
print("No")

### FIXED CODE ###

N,M=map(int,input().split())
A=[input()for i in range(N)]
B=[input()for i in range(M)]
b=''
a='no'
for i in range(M):
    b+=B[i]
for i in range(N-M+1):
    if B[0]in A[i] :
        for j in range(N-M+1):
            a=''
            for k in range(M):
                a+=A[i+k][j:j+M]
            if a==b:
                print("Yes")
                exit()
print("No")
N, M = map(int, input())

if N = M:
    print("Yes")

else:
    print("No")

### FIXED CODE ###

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

if N == M:
    print("Yes")

else:
    print("No")
INFTY = 10**10
N,W = map(int,input().split())
X = [list(map(int,input().split())) for _ in range(N)]
dp = [[[-INFTY for _ in range(3*N+1)] for _ in range(N+1)] for _ in range(N+1)]
for i in range(N+1):
    dp[i][0][0] = 0
for i in range(1,N+1):
    for j in range(1,i+1):
        for k in range(3*N+1):
            if i>j:
                dp[i][j][k] = dp[i-1][j][k]
                if k>=X[i-1][0]-X[0][0]:
                    dp[i][j][k] = max(dp[i][j][k],dp[i-1][j-1][k-X[i-1][0]+X[0][0]]+X[i-1][1])
            else:
                dp[i][i][k] = dp[i-1][i-1][k-X[i-1][0]+X[0][0]]+X[i-1][1]
cmax = 0
for j in range(1,N+1):
    if W-j*X[0][0]>=0:
        for k in range(W-j*X[0][0]+1):
            cmax = max(cmax,dp[N][j][k])
print(cmax)

### FIXED CODE ###

INFTY = 10**10
N,W = map(int,input().split())
X = [list(map(int,input().split())) for _ in range(N)]
dp = [[[-INFTY for _ in range(3*(N-1)+1)] for _ in range(N+1)] for _ in range(N+1)]
for i in range(N+1):
    dp[i][0][0] = 0
for i in range(1,N+1):
    for j in range(1,i+1):
        for k in range(3*(N-1)+1):
            dp[i][j][k] = dp[i-1][j][k]
            if k>=X[i-1][0]-X[0][0]:
                dp[i][j][k] = max(dp[i][j][k],dp[i-1][j-1][k-X[i-1][0]+X[0][0]]+X[i-1][1])
cmax = 0
for j in range(1,N+1):
    for k in range(3*(N-1)+1):
        if j*X[0][0]+k<=W:
            cmax = max(cmax,dp[N][j][k])
print(cmax)
n = int(input())
l = [int(input()) for i in range(n)][::-1]
maximum = l[0] - min(l[1:])
x = l
if maximum > 0:
    x = [i for i in l if l[0] <= i]
for j in range(len(x)-1):
    if maximum < l[j] - min(l[j+1:]):
        maximum = l[j] - min(l[j+1:])
input(maximum)

### FIXED CODE ###

n = int(input())
r = [int(input()) for i in range(n)]
start = r[0]
score = r[1] - r[0]
for i in range(1,n):
    if r[i] - start > score: score = r[i] - start
    if r[i] < start: start = r[i]
print(score)
N = int(input())
d = list(map(int, input().split())) 
print(len(d))

if(len(d)%2!=0):
    print(0)
else: 
    print(d[int(len(d)/2)+1]-d[int(len(d)/2)])

### FIXED CODE ###

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

if(len(d)%2!=0):
    print(0)
else: 
    print(d[int(len(d)/2)]-d[int(len(d)/2)-1])
a = int(input())
b = int(input())

if a*b==15:
    print("*")
elif a+b==15:
    print("+")
else:
    print("x")

### FIXED CODE ###

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

if a*b == 15:
    print("*")
elif a+b == 15:
    print("+")
else:
    print("x")
import math
a,b = map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))

### FIXED CODE ###

import fractions
a,b = map(int,input().split())
print(int((a * b) / fractions.gcd(a, b)))