Harryxun/stf_run huggingface dataset:
n = int(input())
a = list(map(int,input().split()))

if n % 3 != 0:
    if all((a[i] == 0 for i in range(n))):
        print('Yes')
    else:
        print('No')
else:
    while True:
        cnt = 0
        if all((a[i] == 0 for i in range(n))):
            print('Yes')
            exit()
        for i in range(n):
            if a[i] % 2 == 0:
                cnt += 1
                flag = True
            a[i] //= 2
        if flag:
            if cnt * 3 != n:
                print('No')
                exit()


### FIXED CODE ###

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

a.sort()

if n % 3 != 0:
    if all((a[i] == 0 for i in range(n))):
        print('Yes')
    else:
        print('No')
else:
    a1 = a[:n//3]
    a2 = a[n//3:n*2//3]
    a3 = a[n*2//3:]
    if all((a1[i] == 0 for i in range(n//3))) and all((a2[i] == a2[0] for i in range(n//3))) and all((a3[i] == a3[0] for i in range(n//3))):
        print('Yes')
    elif all((a1[i] == a1[0] for i in range(n//3))) and all((a2[i] == a2[0] for i in range(n//3))) and all((a3[i] == a3[0] for i in range(n//3))) and a1[0] ^ a2[0] ^ a3[0] == 0:
        print('Yes')
    else:
        print('No')
from collections import defaultdict

N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]

X.sort()
ctr = defaultdict(int)
for i in range(N - 1):
    for j in range(i + 1, N):
        p = X[i][0] - X[j][0]
        q = X[i][1] - X[j][1]
        ctr[(p, q)] += 1
        ctr[(-p, -q)] += 1

print(N - max(ctr.values()))


### FIXED CODE ###

from itertools import combinations
from collections import Counter

N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]

if N == 1:
    print(1)
    quit()

X.sort()
diff = []
for i, j in combinations(range(N), 2):
    diff.append((X[i][0] - X[j][0], X[i][1] - X[j][1]))
print(N - Counter(diff).most_common()[0][1])
from collections import deque

def pr(A,n):
    for i in range(n):
        if i!=n-1:
            print(A[i],end=" ")
        else:
            print(A[i])

n=int(input())
que_r=deque()
c=0

for i in range(n):
    s=input().split()

    if s[0]=="insert":
        que_r.appendleft(int(s[1]))
    elif s[0]=="delete" and que_r.count(int(s[1]))==0:
        que_r.remove(int(s[1]))
    elif s[0]=="deleteFirst":
        gav=que_r.popleft()
    else:
        gav=que_r.pop()

pr(que_r,len(que_r))


### FIXED CODE ###

from collections import deque


n=int(input())
que_r=deque()

for i in range(n):
    s=input()
    l=len(s)
    if s[0]=="i":
        que_r.appendleft(s[7:])
    elif s[6]==" ":
        try:
            que_r.remove(s[7:])
        except: pass
    elif l>10:
        que_r.popleft()
    elif l>6:
        que_r.pop()

print(*que_r)
s = [i for i in  list(input())]
x = 0
i = 0
a = []
result = []
while x < len(s)-1:
    while s[x] == s[i]:
        i += 1
    a.append([s[x],int(i-x)])
    x = i
if a[-1][0] == 'L':
    a[-1][1] += 1
else:
    a.append(['L', int(1)])
for p in range(len(a)):
    if a[p][0] == 'R':
        n = 0
        n = [0 for q in range(a[p][1]+1)]
        result.extend(n)
        result[len(result)-2] += a[p][1]//2
        result[len(result)-1] += a[p][1]%2+a[p][1]//2
    elif a[p][0] == 'L':
        result[len(result)-2] += a[p][1]//2
        result[len(result)-1] += a[p][1]%2+a[p][1]//2
        n = 0
        n = [0 for q in range(a[p][1]-1)]
        result.extend(n)
print(' '.join(map(str, result)))

### FIXED CODE ###

s = [i for i in  list(input())]
x = 0
i = 0
a = []
result = []
while x < len(s)-1:
    while s[x] == s[i]:
        i += 1
        if i > len(s)-1:
            break
    a.append([s[x],int(i-x)])
    x = i
if a[-1][0] != 'L':
    a.append(['L',1])
for p in range(len(a)):
    if a[p][0] == 'R':
        result.extend([0]*(a[p][1]+1))
        result[len(result)-2] += a[p][1]//2+a[p][1]%2
        result[len(result)-1] += a[p][1]//2
    elif a[p][0] == 'L':
        result[len(result)-2] += a[p][1]//2
        result[len(result)-1] += a[p][1]%2+a[p][1]//2
        result.extend([0]*(a[p][1]-1))
print(' '.join(map(str, result)))
n,r=map(int,input().split())
if n>=10:print(r)
else:print(r-100*(10-k))

### FIXED CODE ###

n,r=map(int,input().split())
if n>=10:print(r)
else:print(r+100*(10-n))
import bisect
a,b,q=map(int,input().split())
S,T=[],[]
for i in range(a):
  S.append(int(input()))
for i in range(b):
  T.append(int(input()))
def f(list,n):
  if n<list[0]:
    return [-float("inf"),list[0]]
  elif list[-1]<n:
    return [list[-1],float("inf")]
  else:
    i=bisect.bisect_left(list,n)
    return [list[i],list[i+1]]
def g(SS,TT,x):
  a,b,c,d=x-SS[0],SS[1]-x,x-TT[0],TT[1]-x
  dis1=max(a,c)
  dis2=min(2*a+d,2*d+a)
  dis3=max(b,d)
  dis4=min(2*b+c,2*c+b)
  return min([dis1,dis2,dis3,dis4])
for i in range(q):
  x=int(input())
  print(g(f(S,x),f(T,x),x))

### FIXED CODE ###

import bisect
a,b,q=map(int,input().split())
S,T=[],[]
for i in range(a):
  S.append(int(input()))
for i in range(b):
  T.append(int(input()))
def f(list,n):
  if n<list[0]:
    return [-float("inf"),list[0]]
  elif list[-1]<n:
    return [list[-1],float("inf")]
  else:
    i=bisect.bisect_left(list,n)
    return [list[i-1],list[i]]
def g(SS,TT,x):
  a,b,c,d=x-SS[0],SS[1]-x,x-TT[0],TT[1]-x
  dis1=max(a,c)
  dis2=min(2*a+d,2*d+a)
  dis3=max(b,d)
  dis4=min(2*b+c,2*c+b)
  return min([dis1,dis2,dis3,dis4])
for i in range(q):
  x=int(input())
  print(g(f(S,x),f(T,x),x))
def BubbleSort(N, C):
    C = [] + C
    for i in range(N):
        for j in range(N-1, i, -1):
            if C[j][1] < C[j-1][1]:
                C[j], C[j-1] = C[j-1], C[j]
    return C

def SelectionSort(N, C):
    C = [] + C
    for i in range(N):
        minj = i
        for j in range(i, N):
            if C[minj][1] > C[j][1]:
                minj = j
        C[i], C[minj] = C[minj], C[i]
    return C

def CompareSuit(L1, L2):
    suit1, suit2 = "", ""
    for i in range(len(L1)):
        suit1 = suit1 + L1[i]
        suit2 = suit2 + L2[i]
    if suit1 == suit2:
        return "Stable"
    else:
        return "Unstable"

N = int(input())
C = input.split()

C1 = BubbleSort(N, C)
C2 = SelectionSort(N, C)

print(" ".join(C1))
print(CompareSuit(C1, C1))
print(" ".join(C2))
print(CompareSuit(C1, C2))

### FIXED CODE ###


def BubbleSort(N, C):
    C = [] + C
    for i in range(N):
        for j in range(N-1, i, -1):
            if C[j][1] < C[j-1][1]:
                C[j], C[j-1] = C[j-1], C[j]
    return C

def SelectionSort(N, C):
    C = [] + C
    for i in range(N):
        minj = i
        for j in range(i, N):
            if C[minj][1] > C[j][1]:
                minj = j
        C[i], C[minj] = C[minj], C[i]
    return C

def CompareSuit(L1, L2):
    suit1, suit2 = "", ""
    for i in range(len(L1)):
        suit1 = suit1 + L1[i]
        suit2 = suit2 + L2[i]
    if suit1 == suit2:
        return "Stable"
    else:
        return "Not stable"

N = int(input())
C = input().split()

C1 = BubbleSort(N, C)
C2 = SelectionSort(N, C)

print(" ".join(C1))
print(CompareSuit(C1, C1))
print(" ".join(C2))
print(CompareSuit(C1, C2))
import itertools

N = int(input())
params = []
for i in range(N):
    xyh = [int(n) for n in input().split()]
    params.append(xyh)

for cxi, cyi in itertools.product(range(101), range(101)):
    for k in range(N):
        if params[k][2] > 0:
            hight = params[k][2] + abs(params[k][0] - cxi) + abs(params[k][1] - cyi)

    for k in range(N):
        if params[k][2] != max(hight - abs(params[k][0] - cxi) - abs(params[k][1] - cyi), 0)
            break
    
    else:
        print(cxi, cyi, hight)

### FIXED CODE ###

N = int(input())
params = []
for i in range(N):
    xyh = [int(n) for n in input().split()]
    params.append(xyh)

for cxi in range(101):
    for cyi in range(101):
        for k in range(N):
            if params[k][2] > 0:
                hight = params[k][2] + abs(params[k][0] - cxi) + abs(params[k][1] - cyi)

        for k in range(N):
            if params[k][2] != max((hight - abs(params[k][0] - cxi) - abs(params[k][1] - cyi)), 0):
                break
        
        else:
            print(cxi, cyi, hight)
import numpy
print(input()*2*numpy.pi)

### FIXED CODE ###

import numpy
print(int(input())*2*numpy.pi)
import numpy as np
from math import min

l, n = [int(i) for i in input().split(' ')]

nl = np.array([i for i in range(n)]) + 1
ll = nl + l - 1

mini = ll.index(min(abs(ll)))
lll = ll.pop(mini)

print(sum(lll))


### FIXED CODE ###

import numpy as np

n, l = [int(i) for i in input().split(" ")]

nl = np.array([i for i in range(n)]) + 1
ll = nl + l - 1

mini = np.where(np.absolute(ll) == np.min(np.absolute(ll)))
ll = list(ll)
del ll[mini[0][0]]

print(np.sum(ll))
N = int(input())
L = list(map(int, input().split()))


L_max = max(L)

L_Down = L.sort(reverse=True)

L_Down_Re = L.Down[1:len(L_Down)]

L_Down_Re_Sum =  sum(L_Down_Re)

if L_max <= L_Down_Re_Sum:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

N = int(input())
L = sorted([int(_) for _ in input().split()])
if L[N - 1] < sum(L[:N - 1]):
    print('Yes')
else:
    print('No')
N, K = map(int, input().split())

for i in range(1, N):
  if N/(K**i) < 1:
    print(i)
    break

### FIXED CODE ###

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

ans = R
if N < 10:
  ans += 100*(10-N)
print(ans)
from scipy.special import comb
N, M = map(int, input().split())

a = comb(N, 2, exact=True)
b = comb(M, 2, exact=True)

print(a+b)


### FIXED CODE ###

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

a = N * (N-1) // 2
b = M * (M-1) // 2
print(a+b)
import sys
i=1
for a in sys.stdin:a=a.strip()
 if a=='0':break
 print(f'Case {i}: {a}')
 i+=1

### FIXED CODE ###

x=int(input())
i=1
while x!=0:
    print("Case %d: %s" %(i,x))
    x=int(input())
    i+=1
n=int(input())
lst=list(map(int,input().split()))

cnt=0
for i in range(len(lst)-1):
    if lst[i]>=lst[i+1]:
        cnt+=1
    else:
        cnt=0
    ans=max(cnt,ans)
print(ans)

### FIXED CODE ###

n=int(input())
lst=list(map(int,input().split()))
ans=0
cnt=0
for i in range(len(lst)-1):
    if lst[i]>=lst[i+1]:
        cnt+=1
    else:
        cnt=0
    ans=max(cnt,ans)
print(ans)
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

A = sorted(A)
B = sorted(B)
C = sorted(C)

BB = [0] * N

cidx = 0
for i in range(N):
    while C[cidx] <= B[i]:
        cidx += 1
        if cidx == N:
            break
    BB[i] = N - cidx

BBB = [0] * N
for i in range(N - 1, -1, -1):
    if (i == N - 1):
        BBB[i] = BB[i]
    else:
        BBB[i] = BB[i] + BBB[i+1]

sum = 0
bidx = 0
for i in range(N):
    while B[bidx] <= A[i]:
        bidx += 1
        if bidx == N:
            break
    if bidx != N:
        sum += BBB[bidx]

print(sum)
pass


### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

A = sorted(A)
B = sorted(B)
C = sorted(C)

BB = [0] * N

cidx = 0
for i in range(N):
    while cidx < N and C[cidx] <= B[i]:
        cidx += 1
    BB[i] = N - cidx

BBB = [0] * N
for i in range(N - 1, -1, -1):
    if (i == N - 1):
        BBB[i] = BB[i]
    else:
        BBB[i] = BB[i] + BBB[i+1]

sum = 0
bidx = 0
for i in range(N):
    while bidx < N and B[bidx] <= A[i]:
        bidx += 1
    if bidx != N:
        sum += BBB[bidx]

print(sum)
ans = 0
for i in range(len(S) // 2):
    if S[i] != S[-1-i]:
        ans += 1
print(ans)

### FIXED CODE ###

S = input()
ans = 0
for i in range(len(S) // 2):
    if S[i] != S[-1-i]:
        ans += 1
print(ans)
li=list(map(int,input().split("\n")))
k=li[5]
if li[1]-li[0]>5 or li[2]-li[1]>5 or li[3]-li[2]>5 or li[4]-li[3]>5:
  print(":(")
else:
  print("Yay!")

### FIXED CODE ###

li=[int(input()) for i in range(5)]
k=int(input())
if li[1]-li[0]>k or li[2]-li[1]>k or li[3]-li[2]>k or li[4]-li[3]>k or li[4]-li[0]>k:
  print(":(")
else:
  print("Yay!")
n, k = map(int, input().split())
x = n
i = 0
c = max(n, k) / min(n, k)
if k == 1:
    print("0")
else:
    while i <= c:
        x = abs(x - k)
        i += 1
    print(min(n, x))


### FIXED CODE ###

n, k = map(int, input().split())
a = n % k
b = k - a
print(min(a, b))
C1 = list(map(str,input().split()))
C2 = list(map(str,input().split()))
C3 = list(map(str,input().split()))

C = C1[0]+C2[1]+C3[2]

print(C)


### FIXED CODE ###

c1 = str(input())
c2 = str(input())
c3 = str(input())

c1_list = list(c1)
c2_list = list(c2)
c3_list = list(c3)

c = c1_list[0] + c2_list[1]+ c3_list[2]

print(c)
import math

def sum_of_digits(n):
    s = 0
    l = len(str(n))
    for i in range(l):
        s += n%10
        n = int(n/10)
    return s

def main():
    s = int(input())
    s = sum_of_digits(s)
    if s % 9==0:
        print('Yes')
    else:
        print('No')

if __name__=="__main__":
  main()

### FIXED CODE ###

import math

def main():
    s = sum(list(map(int, input())))
    if s % 9==0:
        print('Yes')
    else:
        print('No')

if __name__=="__main__":
  main()
data = [list(map(int, input().split())) for i in range(3)]

for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            b1 = data[0][0] - a1
            b2 = data[0][1] - a1
            b3 = data[0][2] - a1

            if (
                b1 + a2 == data[1][0]
                and b2 + a2 == data[1][1]
                and b3 + a2 == data[1][2]
                and b1 + a3 == data[2][0]
                and b2 + a3 == data[2][1]
                and b3 + a3 == data[2][2]
            ):
                print("Yes")
                exit(1)

print("No")

### FIXED CODE ###

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

for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            b1 = data[0][0] - a1
            b2 = data[0][1] - a1
            b3 = data[0][2] - a1

            if (
                b1 + a2 == data[1][0]
                and b2 + a2 == data[1][1]
                and b3 + a2 == data[1][2]
                and b1 + a3 == data[2][0]
                and b2 + a3 == data[2][1]
                and b3 + a3 == data[2][2]
            ):
                print("Yes")
                exit(0)

print("No")
import queue

H, W = map(int, input().split())

s = [list(map(int, input().split())) for _ in range(H)]

ini = 0
if s[0][0] == '#':
    ini = 1

dist = [[ini for _ in range(W)] for _ in range(H)]
start = (0,0)

qq = queue.Queue()

for i in range(H):
    for j in range(W):
        tgt = []
        if j == 0:
            pass
        else:
            if s[i][j-1] == '.' and s[i][j] == '#':
                tgt.append(dist[i][j-1] + 1)

            else:
                tgt.append(dist[i][j-1])

        if i == 0:
            pass
        else:
            if s[i-1][j] == '.' and s[i][j] == "#":
                tgt.append(dist[i-1][j] + 1)
            else:
                tgt.append(dist[i-1][j])
        if i + j == 0:
            continue
        dist[i][j] = min(tgt)

print(dist[H-1][W-1])



### FIXED CODE ###

import queue

H, W = map(int, input().split())

s = [list(input()) for _ in range(H)]

ini = 0
if s[0][0] == '#':
    ini = 1

dist = [[ini for _ in range(W)] for _ in range(H)]
start = (0,0)

qq = queue.Queue()

for i in range(H):
    for j in range(W):
        tgt = []
        if j == 0:
            pass
        else:
            if s[i][j-1] == '.' and s[i][j] == '#':
                tgt.append(dist[i][j-1] + 1)

            else:
                tgt.append(dist[i][j-1])

        if i == 0:
            pass
        else:
            if s[i-1][j] == '.' and s[i][j] == "#":
                tgt.append(dist[i-1][j] + 1)
            else:
                tgt.append(dist[i-1][j])
        if i + j == 0:
            continue
        dist[i][j] = min(tgt)

print(dist[H-1][W-1])
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
ans=[a[0]]
ap=a[0]
for i in range(n-1):
    ap*=a[i+1]
    if i>=k-1:
        ans.append(ap/ans[i-k+1])
    else:
        ans.append(ap)
    
com=ans[k-1]

for i in range(n-k):
    if ans[i+k-1]>=ans[i+k]:
        print("No")
    else:
        print("Yes")
    com=ans[i+k]/ans[i]

### FIXED CODE ###

n,k=map(int,input().split())
a=[int(i) for i in input().split()]
    

for i in range(n-k):
    if a[i]>=a[i+k]:
        print("No")
    else:
        print("Yes")
#
# my_value_list = []
#
# while True:
#     try:
#         my_value_list.append(input().split())
#     except EOFError:
#         break
#
# for i in range(0, len(my_value_list)):
#     if my_value_list[i][1] == "+":
#         print(int(my_value_list[i][0]) + int(my_value_list[i][2]))
#     elif my_value_list[i][1] == "-":
#         print(int(my_value_list[i][0]) - int(my_value_list[i][2]))
#     elif my_value_list[i][1] == "/":
#         print(int(my_value_list[i][0]) // int(my_value_list[i][2]))
#     elif my_value_list[i][1] == "*":
#         print(int(my_value_list[i][0]) * int(my_value_list[i][2]))
#     else:
#         break

# ITP1???4_D
# my_value = int(input())
# my_value_list_str = input().split()
#
# my_value_list = [int(i) for i in my_value_list_str]
# my_value_list.sort()
#
# print("{} {} {}".format(my_value_list[0], my_value_list[my_value-1], sum(my_value_list)))


my_value_list = []
while True:
    try:
        my_value = input().split()
        my_value = [int(x) for x in my_value]
        my_value_list.append(my_value)
    except EOFError:
        break

for i in range(0, len(my_value_list)):
    if my_value_list[i][0] == 0 and my_value_list[i][1] == 0:
        break
    else:
        for j in my_value_list[i][1]:
            for k in my_value_list[i][0]:
                print("*")

### FIXED CODE ###


array = []
while True:
    value = input().split()
    value = [int(x) for x in value]
    if value[0] == 0 and value[1] == 0:
        break
    else:
        array.append(value)

for i in range(0, len(array)):
    for j in range(0, array[i][0]):
        for k in range(0, array[i][1]):
            print("#", end="")
        print("")
    print("")
a,b=input().split()
if a*b % 2 == 0:
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

a,b=map(int, input().split())
if a*b % 2 == 0:
  print('Even')
else:
  print('Odd')
N = int(input())
ab = [list(map(int,input().split())) for _ in range(N-1)]
from collections import deque
l = [deque() for _ in range(N+1)]
ans = [0]*N
for a,b in ab:
  l[a].append(b)
  l[b].append(a)
  
r = [0]*(N+1)
i = 0
p = l[1]
q = deque()
flag = [False]*(N+1)
flag[1]=True
while (len(p)!=0)or(len(q)!=0):
  if i%2==0:
    while len(p)!=0:
      j = p.pop()
      if flag[j]:
        continue
      else:
        q.extend(l[j])
        flag[j]=True
        r[j]=1
    i+=1
  else:
    while len(q)!=0:
      j = q.pop()
      if flag[j]:
        continue
      else:
        p.extend(l[j])
        flag[j]=True
    i+=1
a = deque(range(1,N+1,3))
b = deque(range(2,N+1,3))
c = deque(range(3,N+1,3))
x = sum(r)
if x<=N//3:
  for i in range(1,N+1):
    if r[i]==1:
      ans[i-1]=c.pop()
    else:
      if len(a)!=0:
        ans[i-1]=a.pop()
      else:
        ans[i-1]=b.pop()
elif (N-x)<=N//3:
  for i in range(1,N+1):
    if r[i]==0:
      ans[i-1]=c.pop()
    else:
      if len(a)!=0:
        ans[i-1]=a.pop()
      elif len(b)!=0:
        ans[i-1]=b.pop()
else:
  for i in range(1,N+1):
    if r[i]==1:
      if len(a)!=0:
        ans[i-1]=a.pop()
      elif len(c)!=0:
        ans[i-1]=c.pop()
      else:
        ans[i-1]=b.pop()
    else:
      if len(b)!=0:
        ans[i-1]=b.pop()
      elif len(c)!=0:
        ans[i-1]=c.pop()
      else:
        ans[i-1]=a.pop()
        
print(' '.join(map(str,ans)))

### FIXED CODE ###

N = int(input())
ab = [list(map(int,input().split())) for _ in range(N-1)]
from collections import deque
l = [deque() for _ in range(N+1)]
ans = [0]*N
for a,b in ab:
  l[a].append(b)
  l[b].append(a)
  
r = [0]*(N+1)
i = 0
p = l[1]
q = deque()
flag = [False]*(N+1)
flag[1]=True
while (len(p)!=0)or(len(q)!=0):
  if i%2==0:
    while len(p)!=0:
      j = p.pop()
      if flag[j]:
        continue
      else:
        q.extend(l[j])
        flag[j]=True
        r[j]=1
    i+=1
  else:
    while len(q)!=0:
      j = q.pop()
      if flag[j]:
        continue
      else:
        p.extend(l[j])
        flag[j]=True
    i+=1
a = deque(range(1,N+1,3))
b = deque(range(2,N+1,3))
c = deque(range(3,N+1,3))
x = sum(r)
if x<=N//3:
  for i in range(1,N+1):
    if r[i]==1:
      ans[i-1]=c.pop()
    else:
      if len(a)!=0:
        ans[i-1]=a.pop()
      elif len(b)!=0:
        ans[i-1]=b.pop()
      else:
        ans[i-1]=c.pop()
elif (N-x)<=N//3:
  for i in range(1,N+1):
    if r[i]==0:
      ans[i-1]=c.pop()
    else:
      if len(a)!=0:
        ans[i-1]=a.pop()
      elif len(b)!=0:
        ans[i-1]=b.pop()
      else:
        ans[i-1]=c.pop()
else:
  for i in range(1,N+1):
    if r[i]==1:
      if len(a)!=0:
        ans[i-1]=a.pop()
      elif len(c)!=0:
        ans[i-1]=c.pop()
      else:
        ans[i-1]=b.pop()
    else:
      if len(b)!=0:
        ans[i-1]=b.pop()
      elif len(c)!=0:
        ans[i-1]=c.pop()
      else:
        ans[i-1]=a.pop()
        
print(' '.join(map(str,ans)))
n, m = map(int, input())
ans = n*(n-1)/2 + m*(m-1)/2
print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
ans = n*(n-1)/2 + m*(m-1)/2
print(int(ans))
iter_list = list(range(a,a+k+1)) + list(range(b-k, b+1))
cand = sorted(list(set(iter_list)))
for i in cand:
    if a <= i and i <= b:
        print(i)

### FIXED CODE ###

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

res = set()

for i in range(a, a+k):
    if i <= b:
        res.add(i)

for i in range(b-k+1, b+1):
    if a <= i:
        res.add(i)

# print(res)

for i in sorted(list(res)):
    print(i)
, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())), reverse=True)
r = sorted(list(map(int, input().split())), reverse=True)

p = p[:x]
q = q[:y]
a = p + q + r 
a = sorted(a, reverse=True)
print(sum(a[:x+y]))


### FIXED CODE ###

x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())), reverse=True)
r = sorted(list(map(int, input().split())), reverse=True)

p = p[:x]
q = q[:y]
a = p + q + r 
a = sorted(a, reverse=True)
print(sum(a[:(x+y)]))