You are given two arrays $a$ and $b$ both consisting of $n$ positive (greater than zero) integers. You are also given an integer $k$.

In one move, you can choose two indices $i$ and $j$ ($1 \le i, j \le n$) and swap $a_i$ and $b_j$ (i.e. $a_i$ becomes $b_j$ and vice versa). Note that $i$ and $j$ can be equal or different (in particular, swap $a_2$ with $b_2$ or swap $a_3$ and $b_9$ both are acceptable moves).

Your task is to find the maximum possible sum you can obtain in the array $a$ if you can do no more than (i.e. at most) $k$ such moves (swaps).

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 200$) — the number of test cases. Then $t$ test cases follow.

The first line of the test case contains two integers $n$ and $k$ ($1 \le n \le 30; 0 \le k \le n$) — the number of elements in $a$ and $b$ and the maximum number of moves you can do. The second line of the test case contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 30$), where $a_i$ is the $i$-th element of $a$. The third line of the test case contains $n$ integers $b_1, b_2, \dots, b_n$ ($1 \le b_i \le 30$), where $b_i$ is the $i$-th element of $b$.


-----Output-----

For each test case, print the answer — the maximum possible sum you can obtain in the array $a$ if you can do no more than (i.e. at most) $k$ swaps.


-----Example-----
Input
5
2 1
1 2
3 4
5 5
5 5 6 6 5
1 2 5 4 3
5 3
1 2 3 4 5
10 9 10 10 9
4 0
2 2 4 3
2 4 2 3
4 4
1 2 2 1
4 4 5 4

Output
6
27
39
11
17



-----Note-----

In the first test case of the example, you can swap $a_1 = 1$ and $b_2 = 4$, so $a=[4, 2]$ and $b=[3, 1]$.

In the second test case of the example, you don't need to swap anything.

In the third test case of the example, you can swap $a_1 = 1$ and $b_1 = 10$, $a_3 = 3$ and $b_3 = 10$ and $a_2 = 2$ and $b_4 = 10$, so $a=[10, 10, 10, 4, 5]$ and $b=[1, 9, 3, 2, 9]$.

In the fourth test case of the example, you cannot swap anything.

In the fifth test case of the example, you can swap arrays $a$ and $b$, so $a=[4, 4, 5, 4]$ and $b=[1, 2, 2, 1]$.

Difficulty: introductory

Starter code:

Solutions:
import sys
input = sys.stdin.readline
rInt = lambda: int(input())
mInt = lambda: list(map(int, input().split()))
rLis = lambda: list(map(int, input().split()))

t = int(input())
for _ in range(t):
    n, k = mInt()
    a = rLis()
    b = rLis()
    a.sort()
    b.sort(reverse = True)
    for i in range(k):
        if a[i] < b[i]:
            a[i] = b[i]
    print(sum(a))


q = int(input())
for _ in range(q):
	n,k = map(int,input().split())
	a = list(map(int,input().split()))
	b = list(map(int,input().split()))
	a.sort()
	b.sort()
	b.reverse()
	i = 0
	while i < k and b[i] >= a[i]:
		a[i] = b[i]
		i += 1
	print(sum(a))

T = int(input())
for t in range(T):
    n, k = list(map(int, input().split()))

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

    sa = sorted(a)
    sb = sorted(b, reverse=True)

    for i in range(k):
        if sa[i] < sb[i]:
            sa[i] = sb[i]
        else:
            break

    res = sum(sa)
    print(res)


for _ in range(int(input())):
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    a.sort()
    b.sort()
    b.reverse()
    s = sum(a)
    for i in range(k):
        if b[i]-a[i] <= 0:
            break
        s += b[i]-a[i]
    print(s)

def read_int():
    return int(input())


def read_ints():
    return list(map(int, input().split(' ')))


t = read_int()
for case_num in range(t):
    n, k = read_ints()
    a = list(read_ints())
    b = list(read_ints())
    a.sort()
    b.sort(reverse=True)
    for i in range(k):
        if a[i] < b[i]:
            a[i] = b[i]
        else:
            break
    print(sum(a))



t = int(input())

for loop in range(t):

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

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

    for i in range(k):

        a.sort()
        b.sort()

        if a[0] < b[-1]:

            tmp = a[0]
            a[0] = b[-1]
            b[-1] = tmp

    print(sum(a))


from sys import stdin, stdout, setrecursionlimit
for _ in range(int(input())):
    n, k = list(map(int, input().split()))
    a = sorted([int(i) for i in input().split()])
    b = sorted([int(i) for i in input().split()], reverse = True)
    for i in range(k):
        if a[i] > b[i]: break
        else: a[i], b[i] = b[i], a[i]
    print(sum(a))









import math 
def ri():
    return map(int,input().split())
def li():
    return list(map(int,input().split()))
def inp():
    return int(input())
def si():
    return input()
def pYes():
    print("YES")
def pNo():
    print("NO")
def plist(l):
    print("".join(l))
t = int(input())
for i in range(t):
    n,k= ri()
    a= li()
    b=li()
    a.sort()
    b.sort(reverse=True)
    for i in range(k):
        if a[i]<b[i]:
            a[i]=b[i]
        else:
            break
    print(sum(a))    

for _ in range(int(input())):
    n,k = map(int,input().split())
    a = [*map(int,input().split())]
    b = [*map(int,input().split())]
    a.sort()
    b.sort(reverse=True)
    for i in range(k):
        if(a[i]<b[i]):
            tmp = a[i]
            a[i] = b[i]
            b[i] = tmp
    print(sum(a))

for _ in range(int(input())):
    n,k=list(map(int,input().split()))
    a=sorted(list(map(int,input().split())))
    b= sorted(list(map(int, input().split())))
    n-=1
    for i in range(k):
        if a[i]<b[n]:
            a[i]=b[n]
            n-=1
        else:
            break
    print(sum(a))


T = int(input()) 
for _ in range (T): 

    n,k = map(int, input().split()) 
    A = list(map(int, input().split())) 
    B = list(map(int, input().split())) 
    A.sort() 
    B.sort() 
    for i in range (k): 
        A[i] = max (A[i], B[n-i-1]) 
    print (sum(A)) 

import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

#########################
# imgur.com/Pkt7iIf.png #
#########################

def sieve(n):
    if n < 2: return list()
    prime = [True for _ in range(n + 1)]
    p = 3
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 2
    r = [2]
    for p in range(3, n + 1, 2):
        if prime[p]:
            r.append(p)
    return r

def divs(n, start=1):
    divisors = []
    for i in range(start, int(math.sqrt(n) + 1)):
        if n % i == 0:
            if n / i == i:
                divisors.append(i)
            else:
                divisors.extend([i, n // i])
    return divisors

def divn(n, primes):
    divs_number = 1
    for i in primes:
        if n == 1:
            return divs_number
        t = 1
        while n % i == 0:
            t += 1
            n //= i
        divs_number *= t

def flin(d, x, default=-1):
    left = right = -1
    for i in range(len(d)):
        if d[i] == x:
            if left == -1: left = i
            right = i
    if left == -1:
        return default, default
    else:
        return left, right

def ceil(n, k): return n // k + (n % k != 0)
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(map(int, input().split()))
def lcm(a, b): return abs(a * b) // math.gcd(a, b)
def prr(a, sep=' ', end='\n'): print(sep.join(map(str, a)), end=end)
def dd(): return collections.defaultdict(int)
def ddl(): return collections.defaultdict(list)

########################################################################################################################
# input = sys.stdin.readline

for _ in range(ii()):
    n, m = mi()
    a = sorted(li())
    b = sorted(li(), reverse=True)
    for i in range(m):
        if a[i] < b[i]:
            a[i], b[i] = b[i], a[i]
    print(sum(a))


import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')


def solve():
    n, k = nm()
    a = nl()
    b = nl()
    a.sort()
    b.sort(reverse=True)
    for i in range(k):
        if a[i] >= b[i]:
            break
        a[i] = b[i]
    print(sum(a))
    return

# solve()

T = ni()
for _ in range(T):
    solve()


# int(input())
# [int(s) for s in input().split()]
# input()


def solve():
    t = int(input())

    for i in range(t):
        n, k = [int(s) for s in input().split()]
        a = sorted([int(s) for s in input().split()])
        b = sorted([int(s) for s in input().split()], reverse=True)

        for j in range(k):
            if a[j] <= b[j]:
                a[j] = b[j]

        print(sum(a))


def __starting_point():
    solve()
__starting_point()

for _ in range(int(input())):
    n, k = [int(x) for x in input().split()]
    a = sorted([int(x) for x in input().split()])
    b = sorted([int(x) for x in input().split()], reverse=True)
    for i in range(k):
        if a[i] < b[i]:
            a[i], b[i] = b[i], a[i]
    print(sum(a))


import sys
input = sys.stdin.readline
import heapq

t=int(input())
for tests in range(t):
    n,k=list(map(int,input().split()))
    A=list(map(int,input().split()))
    B=sorted(map(int,input().split()),reverse=True)

    heapq.heapify(A)

    for i in range(k):
        x=heapq.heappop(A)
        if B[i]>x:
            x=B[i]
        heapq.heappush(A,x)

    print(sum(A))
            


from sys import stdin, stdout  
input = stdin.readline
#print = stdout.write

for _ in range(int(input())):
    n, k = list(map(int, input().split()))
    a = sorted(list(map(int, input().split())))
    b = sorted(list(map(int, input().split())))
    for i in range(k):
        if a[i] >= b[n - i - 1]:
            break
        a[i] = b[n - i - 1]
    print(sum(a))


for _ in range(int(input())):
    n, k = map(int, input().split())
    a = sorted(map(int, input().split()))
    b = sorted(map(int, input().split()))

    for i in range(k):
        if a[i] < b[n-i-1]:
            a[i], b[n-i-1] = b[n-i-1], a[i]
        else:
            break

    print(sum(a))

t=int(input())
while t>0:
    n,k=map(int,input().split())
    a=list(map(int,input().split()))
    b=list(map(int,input().split()))
    a.sort()
    b.sort()
    for i in range(k):
        if a[0]<b[-1]:
            a[0],b[-1]=b[-1],a[0]
        a.sort()
        b.sort()
    print(sum(a))
    t-=1


T = int(input())
n = [0]*T
m = [0]*T
a = [0]*T
b = [0]*T

for t in range(T):
  n, k = [int(i) for i in input().split(' ')]
  a = [int(i) for i in input().split(' ')]
  b = [int(i) for i in input().split(' ')]
  a.sort()
  b.sort()
  for i in range(k):
    if a[i]<b[n-i-1]:
      a[i] = b[n-i-1]
    else:
      break
  print(sum(a))




t = int(input())
for t in range(t):
    n, k = [int(i) for i in input().split(" ")]
    a = [int(i) for i in input().split(" ")]
    b = [int(i) for i in input().split(" ")]
    for i in range(k):
        aMin = min(a)
        bMax = max(b)
        if bMax > aMin:
            a[a.index(aMin)], b[b.index(bMax)] = b[b.index(bMax)], a[a.index(aMin)]
    print(sum(a))

t=int(input())
for i in range(t):
    n,k=map(int,input().split())
    a=list(map(int,input().split()))
    b=list(map(int,input().split()))
    a.sort()
    b.sort()
    b.reverse()
    ans=sum(a)
    for i in range(k):
        if a[i]<b[i]:
            ans+=b[i]-a[i]
    print(ans)

for f in range(int(input())):
    n,k=map(int,input().split())
    a=list(map(int,input().split()))
    b=list(map(int,input().split()))
    a.sort()
    b.sort(reverse=True)
    x=0
    while x<k and a[x]<b[x]:
        a[x]=b[x]
        x+=1
    print(sum(a))

t = int(input())
while t:
    n, k = map(int, input().split())
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]
    a.sort()
    b.sort(reverse=True)
    for i in range(k):
        a[i] = max(a[i], b[i])
    print(sum(a))
    t-=1

t = int(input())
for i in range(t):
    n, k = map(int, input().split())
    a = [int(i) for i in input().split()]
    b = [int(i) for i in input().split()]
    s = sum(a)
    a.sort()
    b.sort()
    cnt = 0
    while cnt < len(b) and cnt < len(a) and cnt < k:
        if b[len(b) - cnt - 1] > a[cnt]:
            s +=b[len(b) - cnt - 1] - a[cnt]
        cnt += 1
    print(s)

import sys
agGK = int(input())
for _ in range(agGK):
    n, k = map(int, input().split())
    a = [int(i) for i in input().split(' ', n - 1)]
    b = [int(i) for i in input().split(' ', n - 1)]
    a.sort()
    b.sort()
    if n - k - 1 == 0:
    	g = 0
    else:
    	g = n - k - 1
    for i in range(n-1, g, -1):
    	if a[n-i-1] < b[i]:
    		a[n-i-1] = b[i]
    	else:
    		break
    print(sum(a))