Harryxun/stf_run huggingface dataset:
def dfs(kazu,i,j,ans):
    global result
    if ans>k:
        result.append(kazu-1)
        return
    elif i>=n and j>=m:
        result.append(kazu)
        return
    elif i>=n:
        #bの本を読む
        dfs(kazu+1,i,j+1,ans+b[j])
    elif j>=m:
        #aの本を読む
        dfs(kazu+1,i+1,j,ans+a[i])
    else:
        #aの本を読む
        dfs(kazu+1,i+1,j,ans+a[i])
        #bの本を読む
        dfs(kazu+1,i,j+1,ans+b[j])

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

result = []

dfs(0,0,0,0)

print(max(result))

### FIXED CODE ###

n,m,k = map(int,input().split())
tmp_a = list(map(int,input().split()))
tmp_b = list(map(int,input().split()))
a = [0]
b = [0]
for i in range(n):
    a.append(a[i]+tmp_a[i])
for i in range(m):
    b.append(b[i]+tmp_b[i])
#print(a)
#print(b)
ans = 0
j = m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans,i+j)
print(ans)
S = input()
K = int(input())
for T in range(0,min(K,len(S))):
    if S[T]!='1':
        Disp = S[T]
        Flag = False
        break
if Flag: print('1')
else: print(Disp)

### FIXED CODE ###

S = input()
K = int(input())
Flag = True
for T in range(0,min(K,len(S))):
    if S[T]!='1':
        Disp = S[T]
        Flag = False
        break
if Flag: print('1')
else: print(Disp)
N, K = map(int, input().split())
V = list(map(int, input().split()))

def calc(l, r, d):
    hold = []
    for i in range(l):
        hold.append(V[i])
    for i in range(N-1, N-1-r, -1):
        hold.append(V[i])
    hold.sort()
    return sum(hold[d:])

ret = 0
for l in range(K):
    for r in range(K-l):
        d = K - l - r
        if d > l + r:
            continue
        ret = max(ret, calc(l, r, d))
print(ret)

### FIXED CODE ###

N, K = map(int, input().split())
V = list(map(int, input().split()))
U = V[::-1]
ret = 0

m = min(N, K)
for l in range(m+1):
    for r in range(m+1-l):
        hold = V[:l] + U[:r]
        hold.sort()
        for d in range(K+1-l-r):
            ret = max(ret, sum(hold[d:]))

print(ret)
n,x = map(int,input().split())
a_list = [1]
p_list = [1]
for i in range(n):
  a_list.append(a_list[-1] * 2 + 3)
  p_list.append(p_list[-1] * 2 + 1)
def dfs(n,x):
  if x == 1:
    return 0
  if n == 1:
    if x ==2:
      return 1
    if x == 3 :
      return 2
    if x == 4 or x == 5:
      return 3
  elif 1 < x  and x <= a_list[n-1] +1:
    return dfs(n-1,x-1)
  elif x == a_list[n-1] + 2:
    return p_list[n-1] + 1
  elif a_list[n-1] + 2 < x and x <= 2 * a_list[n-1] + 2:
    return p_list[n-1] + 1 + dfs(n-1,x - (a_list[n-1] + 2))
  elif x == 2 * a_list[i-1] + 3:
    return 2 * p_list[n-1] + 1

print(dfs(n,x))
  

### FIXED CODE ###

n,x = map(int,input().split())
a_list = [1]
p_list = [1]
for i in range(n):
  a_list.append(a_list[-1] * 2 + 3)
  p_list.append(p_list[-1] * 2 + 1)
def dfs(n,x):
  if x == 1:
    return 0
  if n == 1:
    if x ==2:
      return 1
    if x == 3 :
      return 2
    if x == 4 or x == 5:
      return 3
  elif 1 < x  and x <= a_list[n-1] +1:
    return dfs(n-1,x-1)
  elif x == a_list[n-1] + 2:
    return p_list[n-1] + 1
  elif a_list[n-1] + 2 < x and x <= 2 * a_list[n-1] + 2:
    return p_list[n-1] + 1 + dfs(n-1,x - (a_list[n-1] + 2))
  elif x == 2 * a_list[n-1] + 3:
    return 2 * p_list[n-1] + 1

print(dfs(n,x))
import heapq
n,k=map(int,input().split())
data=[]
for i in range(n):
    t,d=map(int,input().split())
    data.append((-d,t))
data=sorted(data)
neta=set()
que1=[]
que2=[]
p,x=0,0
for i in range(k):
    if data[i][1] in neta:
        heapq.heappush(que1,data[i])
        x-=data[i][0]
    else:
        x-=data[i][0]
        p+=1
        neta.add(data[i][1])
for i in range(k,n):
    if data[i][1]in neta:
        pass
    else:
        heapq.heappush(que2,data[i])
mx=x+p*p
tmp=x+p*p
while que1:
    a=heapq.heappop(que1)
    while True:
        b=heapq.heappop(que2)
        if b[1] not in neta:
            break
    tmp=(tmp-p*p)+a[0]-b[0]+(p+1)**2
    p+=1
    neta.add(b[1])
    mx=max(mx,tmp)
print(mx)



### FIXED CODE ###

import heapq
n,k=map(int,input().split())
data=[]
for i in range(n):
    t,d=map(int,input().split())
    data.append((-d,t))
data=sorted(data)
neta=set()
que1=[]
p,x=0,0
for i in range(k):
    if data[i][1] in neta:
        heapq.heappush(que1,(-data[i][0],data[i][1]))
        x-=data[i][0]
    else:
        x-=data[i][0]
        p+=1
        neta.add(data[i][1])
mx=x+p*p
for i in range(k,n):
    if data[i][1] in neta:
        pass
    else:
        if que1:
            a=heapq.heappop(que1)
            x=x-a[0]-data[i][0]
            p+=1
            neta.add(data[i][1])
            mx=max(mx,x+p*p)
        else:
            break
print(mx)
N = int(input())
X = list(map(int, input().split(' ')))

s = 0
for xi in X:
    s += xi
si = round(s / N)
ps = 0
for xi in X:
    ps += int(math.pow(xi-si, 2))
print(ps)

### FIXED CODE ###

import math
N = int(input())
X = list(map(int, input().split(' ')))

s = 0
for xi in X:
    s += xi
si = round(s / N)
ps = 0
for xi in X:
    ps += int(math.pow(xi-si, 2))
print(ps)
N = int(input())
a = map(int, input().split())

sorted_list = sorted(a)
print(sorted_list)
num = 0
last_sum = 0
for i in range(N):
    if len(sorted_list) == 1:
        last_sum = (sorted_list[num] + last_sum) / 2
        break
    x = sorted_list[num]
    y = sorted_list[num+1]
    z = (x + y) / 2
    last_sum = z
    sorted_list.pop(num)
    sorted_list.pop(num)

print(last_sum)


### FIXED CODE ###

n = int(input())
v = sorted(list(map(int, input().split())))
ans = v[0]

for i in range(n-1):
    ans = (ans + v[i+1]) / 2
print(ans)
N,Q = map(int,input().split())
parents = {1:0}
for _ in range(N-1):
    a,b = map(int,input().split())
    key,val = max(a,b), min(a,b)
    parents[key] = val
counts = [0]*(N+1)
for _ in range(Q):
    p,x = map(int,input().split())
    counts[p] += x
results = [0]*(N+2)
for i in range(1,N+1):
    results[i] = counts[i]+results[parents[i]]
    print(results[i], end=' ')

### FIXED CODE ###

N,Q = map(int,input().split())
parents = {1:0}
for _ in range(N-1):
    a,b = map(int,input().split())
    key,val = max(a,b), min(a,b)
    parents[key] = val
counts = [0]*(N+1)
for _ in range(Q):
    p,x = map(int,input().split())
    counts[p] += x
results = [0]*(N+2)
for i in range(1,N+1):
    results[i] = counts[i]+results[parents[i]]
    print(results[i], end=' ')
a = [0]*4
for i in range(3):
  x,y = map(int,input().split())
  a[x] += 1
  a[y] += 1
if sorted(a) = [1,1,2,2]:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a = [0]*5
for i in range(3):
  x,y = map(int,input().split())
  a[x] += 1
  a[y] += 1
if sorted(a) == [0,1,1,2,2]:
  print("YES")
else:
  print("NO")
from copy import deepcopy as dcopy
import fractions
def main():
    global N, ma, mb
    N, ma, mb = map(int, input().split())
    shop = [list(map(int, input().split())) for n in range(N)]

    status = dd(int)
    status[(0,0)] = 0
    minimum = 100000
    for product in shop:
        # buy
        old_status = dcopy(status)
        for s, v in old_status.items():
            key = (s[0]+product[0], s[1]+product[1])
            value = v + product[2]
            if not key in status:
                status[key] = value
                if check(key) and value < minimum:
                    minimum = value
            elif status[key] > value:
                status[key] = value
                if check(key) and value < minimum:
                    minimum = value

    if minimum == 100000:
        print(-1)
    else:
        print(minimum)

def check(key):
    c = fractions.gcd(key[0], key[1])
    if key[0]/c == ma and key[1]/c == mb:
        return True
    else:
        return False

if __name__ == "__main__":# {{{
    try:
        import test
        test.test()
    except:
        main()# }}}


### FIXED CODE ###

# coding: utf-8

import re
from scipy import integrate
import math
from operator import itemgetter
from collections import defaultdict as dd
from collections import Counter
from collections import deque

import numpy as np
import itertools

import heapq

from copy import deepcopy as dcopy
import fractions
def main():
    global N, ma, mb
    N, ma, mb = map(int, input().split())
    shop = [list(map(int, input().split())) for n in range(N)]

    status = dd(int)
    status[(0,0)] = 0
    minimum = 100000
    for product in shop:
        # buy
        old_status = dcopy(status)
        for s, v in old_status.items():
            key = (s[0]+product[0], s[1]+product[1])
            value = v + product[2]
            if not key in status:
                status[key] = value
                if check(key) and value < minimum:
                    minimum = value
            elif status[key] > value:
                status[key] = value
                if check(key) and value < minimum:
                    minimum = value

    if minimum == 100000:
        print(-1)
    else:
        print(minimum)

def check(key):
    c = fractions.gcd(key[0], key[1])
    if key[0]/c == ma and key[1]/c == mb:
        return True
    else:
        return False

if __name__ == "__main__":# {{{
    try:
        import test
        test.test()
    except:
        main()# }}}
input = sys.stdin.readline

N,Y = map(int,input().split())
p = Y//1000
x,y,z = 0,0,0
judge = 0 #0:不可,1:可

#連立方程式
#10000x + 5000y + 1000z = 1000p(Y = 1000p)
#x + y + z = N 
#整数解 x = -4k+p-N , y = 9k-2p+2N, z = N-x-y(k = 0,...2000)

if((p-N) >= 0):
 for k in range((p-N)//4 + 1):
  x = -4*k+p-N
  y = 9*k-2*p+2*N
  z = N-x-y
  if((x>=0)and(y>=0)and(z>=0)):
    judge = 1
    break

if(judge == 1):
  print(x,y,z)
else:
  print(-1,-1,-1)

### FIXED CODE ###

#sys.stdin.readline()
import sys
input = sys.stdin.readline

N,Y = map(int,input().split())
p = Y//1000
x,y,z = 0,0,0
judge = 0 #0:不可,1:可

#連立方程式
#10000x + 5000y + 1000z = 1000p(Y = 1000p)
#x + y + z = N 
#整数解 x = -4k+p-N , y = 9k-2p+2N, z = N-x-y(k = 0,...2000)

if((p-N) >= 0):
 for k in range((p-N)//4 + 1):
  x = -4*k+p-N
  y = 9*k-2*p+2*N
  z = N-x-y
  if((x>=0)and(y>=0)and(z>=0)):
    judge = 1
    break

if(judge == 1):
  print(x,y,z)
else:
  print(-1,-1,-1)
#!/usr/bin/env python3
import sys


def solve(A: "List[int]"):
    print(abs(A[0] - A[1] + abs(A[1] - A[2]))
    return


# Generated by 1.1.4 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)) for _ in range(3) ]  # type: "List[int]"
    solve(A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(A: "List[int]"):
    print(max(A) - min(A))
    return


# Generated by 1.1.4 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)) for _ in range(3) ]  # type: "List[int]"
    solve(A)

if __name__ == '__main__':
    main()
kusiyaki = int(input())
kushi = []

for i in range(kusiyaki*2):
  kushi.append(int(input()))
  
kushi = sorted(kushi)
print(sum(kushi[0::2]))

### FIXED CODE ###

a = int(input())
b = sorted(map(int,input().split()))
print(sum(b[0::2]))
w,h,x,y,r=map(int,input().split())
print('Yes'if r<=x<=w-r && r<=y<=h-r else'No')

### FIXED CODE ###

w,h,x,y,r=map(int,input().split())
print(['No','Yes'][r<=x<=w-r and r<=y<=h-r])
A,B,K=map(int,input().split())

for i in range(A,A+K):
    if i <= B-K:
        print(i)
for i in range(B-K,B):
    print(i)


### FIXED CODE ###

X=input()
A=X[0]
B=X[1]
C=X[2]
if A!=B and B!=C and C!=A:
    print("Yes")
else:
    print("No")
def resolve():
	n, m = map(int, input().split())
	a = list(map(int, input().split()))
	print(n-sum(a) if n-sum(a) > -1 else -1)
resolve()

### FIXED CODE ###

def resolve():
	r = int(input())
	print(2 * r * 3.14159265358)
resolve()
# https://atcoder.jp/contests/abc081/tasks/abc081_b

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


# リスト内の要素に奇数が含まれているかどうかを判断する
# 戻り値：Boolean
def judge_hasOdd(A):
    hasOdd = False
    for a in A:
        if a % 2 == 0:
            continue
        else:
            hasOdd = True
            break
    return hasOdd


# リスト内の全要素を２で割る
# リスト内に奇数が現れるまで上記操作を繰り返す
count = 0
while True:
    if judge_hasOdd(A) == False:
        A = list(map(lambda x: x/2, A))
        count += 1
    else:
        break

print(count)



### FIXED CODE ###

input = input()
total = 0
for element in input:
    total += int(element)

print(total)
N = int(input())
edge_idx = {}
edge_color = {i: None for i in range(N-1)}
E = {v: [] for v in range(1, N+1)}
for i in range(N-1):
    a, b = map(int, input().split())
    edge_idx[(a, b)] = i
    E[a].append(b)
    E[b].append(a)
degs = {v: 0 for v in range(1, N+1)}
for v in range(1, N + 1):
    E[v].sort()
    degs[v] = len(E[v])
K = max(degs.values())
print(K)
c = 1
for v in range(1, N):
    available = {c: True for c in range(1, K+1)}
    for u in E[v]:
        if v > u:
            e_idx = edge_idx[(u, v)]
            available[edge_color[e_idx]] = False
            continue
        e_idx = edge_idx[(v, u)]
        while not available[c]: c = (c + 1) % K if c + 1 != K else K
        edge_color[e_idx] = c
        c += 1
for i in range(N-1):
    print(edge_color[i])

### FIXED CODE ###

from collections import deque

N = int(input())
edge_idx = {}
edge_color = {i: None for i in range(N-1)}
E = {v: [] for v in range(1, N+1)}
for i in range(N-1):
    a, b = map(int, input().split())
    edge_idx[(a, b)] = i
    E[a].append(b)
    E[b].append(a)
degs = {v: 0 for v in range(1, N+1)}
for v in range(1, N + 1):
    degs[v] = len(E[v])
K = max(degs.values())
print(K)
q = deque([(-1, 1)])
visited = {i: False for i in range(1, N+1)}
while q:
    p, v = q.popleft()
    visited[v] = True
    if p == -1:
        used = -1
    else:
        used = edge_color[edge_idx[(p, v)]] if p < v else edge_color[edge_idx[(v, p)]]
    c = 1
    for u in E[v]:
        if visited[u]: continue
        q.append((v, u))
        if c == used: c += 1
        if u < v:
            edge_color[edge_idx[(u, v)]] = c
        else:
            edge_color[edge_idx[(v, u)]] = c
        c += 1
for i in range(N-1):
    print(edge_color[i])
from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math

N = int(stdin.readline().rstrip())
d = [int(s) for s in stdin.readline().rstrip().split()]
count = 0
sumF = d[0]
sumB = d[len(d) - 1]
count = 0
countF = 0
countB = len(d) - 1
while count != len(d):
    if sumF < sumB:
        sumF += d[countF+1]
        countF += 1
        count += 1
    elif sumB < sumF:
        sumB += d[countB-1]
        countB -= 1
        count += 1
    else:
        sumF += d[countF+1]
        countF += 1
        sumB += d[countB-1]
        countB -= 1
        count += 2
print(abs(sum(d[0:countF])-sum(d[countF:len(d)])))


### FIXED CODE ###

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math

N = int(stdin.readline().rstrip())
d = [int(s) for s in stdin.readline().rstrip().split()]
count = 0
sumF = d[0]
sumB = d[len(d) - 1]
count = 0
countF = 0
countB = len(d) - 1
while count < len(d):
    if sumF < sumB:
        sumF += d[countF+1]
        countF += 1
        count += 1
    elif sumB < sumF:
        sumB += d[countB-1]
        countB -= 1
        count += 1
    else:
        sumF += d[countF+1]
        countF += 1
        sumB += d[countB-1]
        countB -= 1
        count += 2
print(abs(sum(d[0:countF])-sum(d[countF:len(d)])))
#!/usr/bin/env python3
import sys

# 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()
    N = int(next(tokens))  # type: str
    K = (next(tokens))  # type: str
    g = set()
    for _ in range(N):
        d = int(next(tokens))
        g = g  or set([int(next(tokens)) for i in range(d)])

    print(N - len(g))    

    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

# 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()

    N = int(next(tokens))  # type: str
    K = int(next(tokens))  # type: str
    # print(N, K)
    g = set()
    for _ in range(K):
        d = int(next(tokens))
        g = g | set([int(next(tokens)) for i in range(d)])

    print(N - len(g))    

    return


if __name__ == '__main__':
    main()
import copy
N, K = map(int,input().split())
A = list(map(int,input().split()))
F = list(map(int,input().split()))
X = []
A = sorted(A)
F = sorted(F)[::-1]
for i in range(N):
  X.append(A[i] * F[i])
XX = copy.deepcopy(X)

import heapq
from heapq import heapify

heapq._heapify_max(X)

def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappop_max(heap):
    lastelt = heap.pop()
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt

for i in range(K):
    x = _heappop_max(X)
    id = XX.index(x)
    if x < 1:
        _heappush_max(X,x)
        break
    else:
        A[id] -= 1
        x = A[id] * F[id]
        XX[id] = x
        _heappush_max(X,x)

print(max(X))



### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N,K = map(int,readline().split())
A = np.array(readline().split(),np.int64)
F = np.array(readline().split(),np.int64)

A.sort(); F.sort(); F=F[::-1]

def test(x):
    return np.maximum(0,A-x//F).sum() <= K

left = -1
right = 10**13
while left+1 < right:
    mid = (left+right)//2
    if test(mid):
        right = mid
    else:
        left = mid
answer = right
print(answer)
from functools import reduce
from math import gcd

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

def gcd_list(nums):
    return reduce(gcd, nums)

ans = -1

for i in range(N):
    g = gcd_list(A[:i] + A[i+1:])
    if g > ans:
        ans = g

print(ans)


### FIXED CODE ###

def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

N = int(input())
A = list(map(int, input().split()))
divisors = sorted(make_divisors(A[0]) + make_divisors(A[1]), reverse=True)

ans = 0
for d in divisors:
    ok_cnt = 0
    for a in A:
        if a % d == 0:
            ok_cnt += 1
    if ok_cnt >= N-1:
        ans = d
        break
print(ans)
import math

n=int(input())
listx=[]
listy=[]

for i in range(n):
  x,y = map(int,input().split())
  listx.append(x)
  listy.append(y)

%print(listx)
%print(listy)
listl=[]
if n==2:
	ans=((listx[1]-listx[0])**2+(listy[1]-listy[0])**2)**0.5



else:
	for i in range(n-1):
		for j in range(i+1,n):
			l=((listx[i]-listx[j])**2+(listy[i]-listy[j])**2)**0.5
			listl.append(l)
	ll=sum(listl)	
	ans=2*ll/n

print(ans)

### FIXED CODE ###

import math

n=int(input())
listx=[]
listy=[]

for i in range(n):
  x,y = map(int,input().split())
  listx.append(x)
  listy.append(y)

#print(listx)
#print(listy)
listl=[]
if n==2:
	ans=((listx[1]-listx[0])**2+(listy[1]-listy[0])**2)**0.5



else:
	for i in range(n-1):
		for j in range(i+1,n):
			l=((listx[i]-listx[j])**2+(listy[i]-listy[j])**2)**0.5
			listl.append(l)
	ll=sum(listl)	
	ans=2*ll/n

print(ans)
N, M = map(int, input().split())
reverse = [1]*(N*M)
num1 = [-M-1, -M, -M+1, -1, 1, M-1, M, M+1]
num2 = [-M, -M+1, 1, M, M+1]
num3 = [-M-1, -M, -1, M-1, M]
for i in range(N*M):
    #print(i, reverse)
    reverse[i] *= -1
    if (i % M) == 0:
        num = num2
    elif ((i + 1) % M) == 0:
        num = num3
    else:
        num = num1
    for j in num:
        if ((i + j) >= 0) and ((i + j) < (N * M)):
            reverse[i+j] *= -1
    #print(reverse)
#print(num)
#print(reverse)
print(reverse.count(-1))


### FIXED CODE ###

N, M = map(int, input().split())
if ((N - 2) == 0) or ((M - 2) == 0):
    result = 0
elif N == M == 1:
    result = 1
elif N == 1:
    result = M - 2
elif M == 1:
    result = N - 2
else:
    result = (N - 2) * (M - 2)
print(result)
o=input()
e=input()
for i in range(len(o)):
    print(o[i],end="")
    print(e[i],end="")


### FIXED CODE ###

o=list(input())
e=input()
for i in range(len(e)):
    o.insert(2*i+1,e[i])
print(*o,sep="")
a,b,c,d=map(int,input().split())
x=list(range(a,b+1))
y=list(range(c,d+1))
for i in range(b-a+1):
    for j in range(d-c+1):
        e=[x[i]*y[j]]
print(max(e))

### FIXED CODE ###

a,b,c,d=map(int,input().split())
lists = []
lists.append(a*c)
lists.append(a*d)
lists.append(b*c)
lists.append(b*d)
print(max(lists))
A,B,K = map(int, raw_input().split())
  
for i in range(B+1):
    if (i >= A and i <= A + K - 1) or (i >= B - K + 1 and i <= B):
        print(i)

### FIXED CODE ###

A,B,K = map(int, raw_input().split())
  
for i in range(K):
    if A + i >= A and A + i <= B:
        print(A + i)
for i in range(K):
    if B - K + 1 + i >= A and B - K + 1 + i <= B and B - K + 1 + i > A + K -1:
        print(B - K + 1 + i)
import functools  # Python3 
N,M = map(int,input().split())
x, y, z = [0] * N, [0] * N, [0] * N
for i in range(N):
	x[i], y[i], z[i] = map(int,input().split())

ppp = sorted([ x[i]+y[i]+z[i] for i in range(N)])[-M:]
pmp = sorted([ x[i]-y[i]+z[i] for i in range(N)])[-M:]
ppm = sorted([ x[i]+y[i]-z[i] for i in range(N)])[-M:]
pmm = sorted([ x[i]-y[i]-z[i] for i in range(N)])[-M:]
mpp = sorted([-x[i]+y[i]+z[i] for i in range(N)])[-M:]
mpm = sorted([-x[i]+y[i]-z[i] for i in range(N)])[-M:]
mmp = sorted([-x[i]-y[i]+z[i] for i in range(N)])[-M:]
mmm = sorted([-x[i]-y[i]-z[i] for i in range(N)])[-M:]

MAX = 0
for lis in [ppp,pmp,ppm,pmm,mpp,mpm,mmp,mmm]:
	cur = functools.reduce(lambda x,y: x+y,filter(lambda t: t >= 0,lis))
	if cur > MAX:
		MAX = cur
print(MAX)


### FIXED CODE ###

import functools  # Python3 
N,M = map(int,input().split())
x, y, z = [0] * N, [0] * N, [0] * N
for i in range(N):
	x[i], y[i], z[i] = map(int,input().split())

if M==0:
	print(0)
	exit()

ppp = functools.reduce(lambda x,y: x+y,sorted([ x[i]+y[i]+z[i] for i in range(N)])[-M:])
pmp = functools.reduce(lambda x,y: x+y,sorted([ x[i]-y[i]+z[i] for i in range(N)])[-M:])
ppm = functools.reduce(lambda x,y: x+y,sorted([ x[i]+y[i]-z[i] for i in range(N)])[-M:])
pmm = functools.reduce(lambda x,y: x+y,sorted([ x[i]-y[i]-z[i] for i in range(N)])[-M:])
mpp = functools.reduce(lambda x,y: x+y,sorted([-x[i]+y[i]+z[i] for i in range(N)])[-M:])
mpm = functools.reduce(lambda x,y: x+y,sorted([-x[i]+y[i]-z[i] for i in range(N)])[-M:])
mmp = functools.reduce(lambda x,y: x+y,sorted([-x[i]-y[i]+z[i] for i in range(N)])[-M:])
mmm = functools.reduce(lambda x,y: x+y,sorted([-x[i]-y[i]-z[i] for i in range(N)])[-M:])

MAX = 0
for lis in [ppp,pmp,ppm,pmm,mpp,mpm,mmp,mmm]:
	if lis  > MAX:
		MAX = lis
print(MAX)
A = input()
B = input()

if A = 1:
    if B = 2:
        print(3)
    else:
        print(2)
elif A = 2:
    if B = 1:
        print(3)
    else:
        print(1)
elif A = 3:
    if B = 1:
        print(2)
    else:
        print(1)


### FIXED CODE ###

import sys

A = input()
B = input()

if A == '1':
    if B == '2':
        print('3')
    else:
        print('2')
elif A == '2':
    if B == '1':
        print('3')
    else:
        print('1')
elif A == '3':
    if B == '1':
        print('2')
    else:
        print('1')