The code I made:

```
li = list(map(int, input().split()))
n = li.pop(0)
k = li.pop(0)
a = li[:n] #first shelf => stores the lower numbers
b = li[n:] #second shelf => stores the larger numbers
for _ in range(k):
a.sort()
b.sort()
a = a[::-1]
b = b[::-1]
if max(a) > max(b):
a, b = b, a
if (a[0] > b[-1]): #if swapping will help
a[0], b[-1] = b[-1], a[0] #swap largest number from a with smallest number in b
print(max(a) + max(b)) #print skew
```

Could someone explain the issue with my code. And suggest how I am supposed to be able to understand what input my code is giving the wrong input for?