Harryxun/stf_run huggingface dataset:
class UnionFind:
  def __init__(self, n):
    self.n = [-1]*n
    self.r = [0]*n
    self.co = n

  def find(self, x):
    if self.n[x] < 0:
      return x
    else:
      return self.n[x] = self.find(self.n[x])

  def unite(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x == y:
      return
    if self.r[x] > self.r[y]:
      x, y = y, x
    self.n[y] += self.n[x]
    self.n[x] = y
    if self.r[x] == self.r[y]:
      self.r[y] += 1
    self.co -= 1

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

  def size(self, x):
    return -self.n[self.find(x)]

  def set_count(self):
    return self.co
  
n, m = map(int, input().split())
uf = UnionFind(n)
for _ in range(m):
  a, b = map(int, input().split())
  uf.unite(a-1, b-1)
print(uf.set_count()-1)

### FIXED CODE ###

# UnionFind
import sys
sys.setrecursionlimit(1000000)
class UnionFind:
  def __init__(self, n):
    self.n = [-1]*n
    self.r = [0]*n
    self.siz = n

  def find_root(self, x):
    if self.n[x] < 0:
      return x
    else:
      self.n[x] = self.find_root(self.n[x])
      return self.n[x]

  def unite(self, x, y):
    x = self.find_root(x)
    y = self.find_root(y)
    if x == y:
      return
    elif self.r[x] > self.r[y]:
      self.n[x] += self.n[y]
      self.n[y] = x
    else:
      self.n[y] += self.n[x]
      self.n[x] = y
      if self.r[x] == self.r[y]:
        self.r[y] += 1
    self.siz -= 1

  def root_same(self, x, y):
    return self.find_root(x) == self.find_root(y)

  def count(self, x):
    return -self.n[self.find_root(x)]

  def size(self):
    return self.siz

n,m=map(int,input().split())
u=UnionFind(n)
for _ in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  u.unite(a,b)
print(u.size()-1)
S_list = [input() for i in range(2)]
S_list_1 = S_list[1].split()
even_list = []
for i in S_list_1:   
    if int(i) % 2 == 0:
        even_list.append(int(i))
for i in even_list:
    if i % 3 ==0 or i % 5 ==0 :
        result="APPROVED"
    else:
        result="DENIED"
        break
print(result)

### FIXED CODE ###

S_list = [input() for i in range(2)]
S_list_1 = list(map(int,S_list[1].split()))

for i in S_list_1:   
    if i % 2 == 0 :
        if i % 3 !=0 and i % 5 !=0 :
            result="DENIED"
            break
    else:
        result="APPROVED"        
print(result)
l,r = map(int,input().split())

r = min(r, l+4038)

min = 99999999
for i in range(l,r):
  for j in range(i+1,r+1):
    value = (i*j)%2019
    if min > value:
      min = value
print(min)

### FIXED CODE ###

import numpy as np
n = int(input())
a = [int(input()) for _ in range(n)]

# 最大値のインデックス
i1 = np.argmax(a)
temp = a[i1]
a[i1] = 0
# ２番目の最大値のインデックス
i2 = np.argmax(a)
a[i1] = temp


for i in range(n):
  if i == i1:
    print(a[i2])
  else:
    print(a[i1])
N = float(input())
q = N
while q!=1:
  hoge = (q-1) / (-2)
  if hoge.is_integer():
    r = int(1)
    q = float(hoge)
  else:
    r = int(0)
    q = float(q/(-2))
  r_s.append(r)
r_s.append(1)
r_s = r_s[::-1]
for i in range(len(r_s)):
  print(r_s[i], end="")

### FIXED CODE ###

N, K = map(int, input().split())
r = N % K
if r == 0:
  print(0)
else:
  print(1)
import fractions

def lcm(num_list):
    if len(num_list) > 2:
        lcm_tmp = lcm(num_list[:2])
        if M * 2 < lcm_tmp:
            return None
        num_list_new = [lcm_tmp]
        num_list_new.extend(num_list[2:])
        return lcm(num_list_new)
    elif len(num_list) == 2:
        return num_list[0] * num_list[1] // fractions.gcd(num_list[0], num_list[1])

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

lcm_of_a = lcm(a)
if lcm_of_a is None:
    print(0)
count = M * 2 // lcm_of_a
if count % 2 == 0:
    print(count // 2)
else:
    print((count + 1) // 2)


### FIXED CODE ###

from fractions import gcd
from functools import reduce
import sys

def lcm(nums):
    return reduce(lambda x, y: x * y // gcd(x, y), nums)

n, m = map(int, input().split())
a = [int(item) // 2 for item in input().split()]
b = [0] * n

for i in range(n):
    tmp = a[i]
    while True:
        if tmp % 2 == 0:
            b[i] += 1
            tmp /= 2
        else:
            break

if len(set(b)) != 1:
    print(0)
    sys.exit()

a_lcm = lcm(a)
count = m // a_lcm
if count % 2 == 0:
    print(count // 2)
else:
    print((count + 1) // 2)
A,B  =map(int,input().split())
K = 50
S = [['.']*(2*K) for _ in range(2*K)]
for i in range(K):
    for j in range(2*K):
        S[i][j] ='#'
i,j = 0,0
while A>0:
    S[i][j] ='.'
    if j +2 <2*K:
        j +=2
    else:
        i += 1
    A-=1
i,j = 2*K-1,2*K-1
while B>0:
    S[i][j]='#'
    if j-2>0:
        j-=2
    else:
        i-=1
    B-=1
for s in S:
    print(''.join(s))


### FIXED CODE ###

A,B  =map(int,input().split())
K = 50
S = [['.']*(2*K) for _ in range(2*K)]
for i in range(K):
    for j in range(2*K):
        S[i][j] ='#'
i,j = 0,0
A-=1
B-=1
while A>0:
    S[i][j] ='.'
    if j +2 <2*K:
        j +=2
    else:
        i += 2
        j=0
    A-=1
i,j = 2*K-1,2*K-1
while B>0:
    S[i][j]='#'
    if j-2>0:
        j-=2
    else:
        i-=2
        j=2*K-1
    B-=1
print(str(2*K)+' '+str(2*K))
for s in S:
    print(''.join(s))
import math
r = int(input())
s = r * r * math.pi
l = 2 * r * math.pi
print(s,l)


### FIXED CODE ###

import math
r = float(input())
s = '{:.6f}'.format(r * r * math.pi)
l = '{:.6f}'.format(2 * r * math.pi)
print(s,l)
n,k=LI()
a=LI()

print(*[n]*n)

### FIXED CODE ###

# coding: utf-8
# Your code here!
import time
t1=time.time()
def LI():return list(map(int,input().split()))
n,k=LI()
a=LI()

for _ in range(k):
    tab=[0]*(n)
    for i in range(n):
        q=a[i]
        if 0<=i-q:
            tab[i-q]+=1
        else:
            tab[0]+=1
        if i+q+1<=n-1:
            tab[i+q+1]-=1
        else:
            pass
    b=[tab[0]]
    for i in range(n-1):
        b.append(tab[i+1]+b[-1])
    a=b[:]
    if time.time()-t1>1.5:
        print(*a)
        exit()
print(*a)
maxi=1000000001
int(input())
l=[int(x) for x in input().split()]
arr=[0]*maxi
for i in l:
	arr[i]+=1
max1=0
max2=-1
sqr=0
for i in range(maxi):
	if arr[i]>=2:
		if i > max1:
			max1=i
		if arr[i]>=4:
			sol=i**2
			if sqr < sol :
				sqr=sol
for i in range(maxi):
	if arr[i]>=2:
		if i > max2 and i < max1:
			max2=i

rec=max1 * max2
if rec > sqr:
	print(rec)
else:
	print(sqr)
					

### FIXED CODE ###

int(input())
l=[int(x) for x in input().split()]
arr={}
for i in l:
	if not arr.get(i):
		arr[i]=1
	else:
		arr[i]+=1
max1=0
max2=-1
sqr=0
for i in arr:
	if arr[i]>=2:
		if i > max1:
			max1=i
		if arr[i]>=4:
			sol=i**2
			if sqr < sol :
				sqr=sol
for i in arr:
	if arr[i]>=2:
		if i > max2 and i < max1:
			max2=i

rec=max1 * max2
if rec > sqr:
	print(rec)
else:
	print(sqr)
import math as m
a,b = map(int,input().split())

print(m.round(a + b))

### FIXED CODE ###

l = list(map(int,input().split()))
 
s = l[0] + l[1]
if s % 2 == 1:
    s = s+ 1
else:
    None
print(s // 2)
def countingsort(a,k):
    c=[0]*(k+1)
    n=len(a)
    for i in a:
        c[i]+=1
    for i in range(1,k+1):
        c[i]=c[i]+c[i-1]
    b=[0]*n
    for i in range(n-1,-1,-1):
        b[c[a[i]]-1]=a[i]
        c[a[i]]-=1
    return b
q=int(input())
a=list(map(int,input().split()))
ret=countingsort(a,q)
for i in range(len(ret)):
    if i!=len(ret)-1:
        print(ret[i],end=" ")
    else:
        print(ret[i])


### FIXED CODE ###

def countingsort(a,k):
    c=[0]*(k+1)
    n=len(a)
    for i in a:
        c[i]+=1
    for i in range(1,k+1):
        c[i]=c[i]+c[i-1]
    b=[0]*n
    for i in range(n-1,-1,-1):
        b[c[a[i]]-1]=a[i]
        c[a[i]]-=1
    return b
o=int(input())
a=list(map(int,input().split()))
q=max(a)
ret=countingsort(a,q)
for i in range(o):
    if i!=o-1:
        print(ret[i],end=" ")
    else:
        print(ret[i])
a, b = map(int, input().split())
n = b - a
print(int(n*(n+1)/2-b))

### FIXED CODE ###

n = int(input())
if n > 999:
    print("ABD")
    exit()
print("ABC")
a, b = map(int,input().split())
print(6-a-b)

### FIXED CODE ###

a = int(input())
b = int(input())
print(6-a-b)
INF = 10 ** 9 + 7

S = input()
# dp[i][j]はうしろからi桁を13で割った余りがjであるものの個数
dp = [[0] * 13 for _ in range(len(S) + 1)]
dp[0][0] = 1
mul = 1

for i in range(len(S)):
    x = S[-(i + 1)]
    if x == "?":
        for k in range(10):
            for j in range(13):
                dp[i + 1][(mul * k + j) % 13] += dp[i][j]
                dp[i + 1][(mul * k + j) % 13] %= INF
    else:
        k = int(x)
        for j in range(13):
            dp[i + 1][(mul * k + j) % 13] += dp[i][j]
            dp[i + 1][(mul * k + j) % 13] %= INF
    mul = mul * 10 % 13  # 計算量削減のためここで13で割っている

print(dp[len(S)][5])


### FIXED CODE ###

A, B = map(int, input().split())
if (A + B) % 2 == 0:
    print((A + B) // 2)
else:
    print("IMPOSSIBLE")
n=int(input())
a=list(map(int, input().split()))

total=0
for i in range(n):
  total=total^a[i]
  
result=[]
for i in range(n):
  result.append(total^a[i])
L=' '.join(result)
print(L)

### FIXED CODE ###

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

total = 0
for i in range(n):
  total = total ^ a[i]

for i in range(n):
  print(total^a[i])
s=str(input())
ans=0
for i in range(len(s)-1):
  if s[i]<>[i+1]:
    ans+=1
print(ans)

### FIXED CODE ###

s=str(input())
ans=0
for i in range(len(s)-1):
  if s[i]!=s[i+1]:
    ans+=1
print(ans)
import math

data = input().split()

loop_count = int(data[0])
moto = int(data[1])
least_donut = 100000
one = 0

for i in range(loop_count):
    gram = int(input())
    one = one + gram
    if gram < least_donut:
        least_donut = gram

nokori = moto - one
print(loop_count + math.floor(nokori / least_donut))


### FIXED CODE ###

# -*- coding: utf-8 -*-

ramen_basic = 700

data = list(input())

def is_yes(topping):
    if topping == "o":
        return True
    else:
        return False

count = 0

for topping in data:
    if is_yes(topping):
        count = count + 1

print(ramen_basic + count * 100)
number = "".join(int(input()))
if number % 4 == 0:
  print("YES")
else:
  print("NO")



### FIXED CODE ###

number = list(map(str, input().split(" ")))
N = "".join(number)
if int(N) % 4 == 0:
  print("YES")
else:
  print("NO")
s = list(input())
t = list(input())
 
def f(s, t):
  s.sort()
  t.sort(reverse=True)
  s_sum = 0
  t_sum = 0
  for i in range(len(s)):
    s[i] = ord(s[i])
  
  for i in range(len(t)):
    t[i] = ord(t[i])
  
  for i in range(len(s)):
    s_sum += s[i]
    t_sum += t[i]

    if s_sum < t_sum:
      return 'Yes'
    elif s_sum > t_sum:
      return 'No'

  if len(s) < len(t):
    return 'Yes'
  else:
    return 'No'
  
print(f(s, t))

### FIXED CODE ###

s = list(input())
t = list(input())
 
def f(s, t):
  s.sort()
  t.sort(reverse=True)
  s_sum = 0
  t_sum = 0
  for i in range(len(s)):
    s[i] = ord(s[i])
  
  for i in range(len(t)):
    t[i] = ord(t[i])
  
  for i in range(len(s)):
    if not i + 1 >= len(t):
      s_sum += s[i]
      t_sum += t[i]

      if s_sum < t_sum:
        return 'Yes'
      elif s_sum > t_sum:
        return 'No'
    else:
      break

  if len(s) < len(t):
    return 'Yes'
  else:
    return 'No'

print(f(s, t))
a, b, c = (i for i in input().split())
d, e, f = (i for i in input().split())

if a == f and b == e and c == d:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

s1 = input()
s2 = input()

if s1[0] == s2[2] and s1[1] == s2[1] and s1[2] == s2[0]:
  print('YES')
else:
  print('NO')
from itertools import permutations
while 1:
    n, m = map(int, input().split())
    if n == m == 0:
        break
    *S, = map(int, input().split())
    *D, = map(int, input().split())

    def solve(S, D):
        for P in permutations(S):
            Q = [0]*(n+1)
            for i, e in enumerate(P):
                Q[i+1] = P[i] + Q[i]
            yield sum(min(abs(d - q) for q in Q) for d in D)
    print(min(solve(S, D)))

### FIXED CODE ###

from collections import deque
while 1:
    n, m = map(int, input().split())
    if n == m == 0:
        break
    *S, = map(int, input().split())
    D = sorted(map(int, input().split()))

    SA = sum(S)
    rest = sum(d-SA for d in D if SA <= d)

    memo = {2**n-1: rest}
    def dfs(state, su, idx):
        if state in memo:
            return memo[state]
        res = 10**18
        for i in range(n):
            if (state >> i) & 1 == 0:
                s = 0; j = idx
                nxt = su + S[i]
                while j < m and D[j] <= nxt:
                    s += min(nxt - D[j], D[j] - su); j += 1
                res = min(res, s + dfs(state | (1 << i), su + S[i], j))
        memo[state] = res
        return res
    print(dfs(0, 0, 0))
import sys
import time

t = time.time()

n = int(input())
a = list(map(int, input().split(' ')))
b = list(range(n))
b.sort(key=lambda x: -a[x])
# print("b after:", b)
# print(list(map(lambda x:a[x],b)))
# print(time.time()-t)

cache = [[-1 for x in range(n)] for y in range(n)]
# print(cache)


def dfs(left, right):
    if left > right:
        return 0
    if cache[left][right] != -1:
        return cache[left][right]
    which = n-(right-left+1)
    ans1 = dfs(left+1, right)+abs(left-b[which])*a[b[which]]
    ans2 = dfs(left, right-1)+abs(right-b[which])*a[b[which]]
    cache[left][right] = max(ans1, ans2)
    return cache[left][right]


# sys.setrecursionlimit(2010)
print(dfs(0, n-1))


### FIXED CODE ###

import sys
import time

t = time.time()

n = int(input())
a = list(map(int, input().split(' ')))
b = list(range(n))
b.sort(key=lambda x: -a[x])
# print("b after:", b)
# print(list(map(lambda x:a[x],b)))
# print(time.time()-t)

cache = [[-1 for x in range(n)] for y in range(n)]
# print(cache)


def dfs(left, right):
    if left > right:
        return 0
    if cache[left][right] != -1:
        return cache[left][right]
    which = n-(right-left+1)
    ans1 = dfs(left+1, right)+abs(left-b[which])*a[b[which]]
    ans2 = dfs(left, right-1)+abs(right-b[which])*a[b[which]]
    cache[left][right] = max(ans1, ans2)
    return cache[left][right]


sys.setrecursionlimit(2010)
print(dfs(0, n-1))
import math
def multi_gcd(a):
    ans = a[0]
    for i in range(1, len(a)):
        ans = fractions.gcd(ans, a[i])
    #print(ans)
    return ans
K = int(input())
sum_ = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        for k in range(1, K + 1):
            sum_ += multi_gcd([i, j, k])
print(sum_)

### FIXED CODE ###

import math
k = int(input())
ans = 0
for i in range(1, k + 1):
    for j in range(1, k + 1):
        gcd1 = math.gcd(i, j)
        for l in range(1, k + 1):
            gcd2 = math.gcd(gcd1, l)
            ans += gcd2
print(ans)
N,M= map(int,input().split())

x = []
y = []
for i in range(M):
  xi, yi = input().split()
  x.append(int(xi))
  y.append(int(yi))

L=[]
for i in range(N):
  L.append(1)
R=[1]
for i in range(N-1):
  R.append(0)
#print(R) 

for i in range(M):
  if R[i]==1 and L[i]==1:
    R[i]=0
    L[i]=0
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[i]==1 and L[i]>0:
    L[i]=L[i]-1
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[i]==0 and L[i]>0:
    L[y[i]-1]=L[y[i]-1]+1
   
    
#print(R,L)
print(R.count(1))


### FIXED CODE ###

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

x = []
y = []
for i in range(M):
  xi, yi = input().split()
  x.append(int(xi))
  y.append(int(yi))

L=[]
for i in range(N):
  L.append(1)
R=[1]
for i in range(N-1):
  R.append(0)
#print(R) 

#print('     ','R',R,'L',L) 
for i in range(M):
  if R[x[i]-1]==1 and L[x[i]-1]==1:
    R[x[i]-1]=0
    L[x[i]-1]=0
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[x[i]-1]==1 and L[x[i]-1]>=1:
    L[x[i]-1]=L[x[i]-1]-1
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[x[i]-1]==0 and L[x[i]-1]>=1:
    L[x[i]-1]=L[x[i]-1]-1
    L[y[i]-1]=L[y[i]-1]+1
  #print(i+1,x[i],y[i],'R',R,'L',L) 
    

print(R.count(1))
from sys import exit, setrecursionlimit
setrecursionlimit(1000000)
main()


def get_node_id(i, j, node_id_db):
    if i < j:
        return node_id_db[i][j]
    else:
        return node_id_db[j][i]


def dfs(node_id, edges, dp):
    t = dp[node_id]
    if t >= 0:
        return t
    dp[node_id] = 0
    result = 0
    for n in edges[node_id]:
        t = dfs(n, edges, dp)
        if t == 0:  # looped
            print(-1)
            exit()
        if t > result:
            result = t
    result += 1
    dp[node_id] = result
    return result


def main():
    N = int(input())
    A = [[int(e) - 1 for e in input().split()] for _ in range(N)]

    node_id_db = [[0] * (N+1) for _ in range(N + 1)]
    v = 0
    for i in range(N):
        for j in range(i + 1, N):
            node_id_db[i][j] = v
            v += 1

    start_nodes = []
    edges = [[] for _ in range(N * (N - 1) // 2)]
    for i in range(N):
        Ai = A[i]
        from_id = get_node_id(i, Ai[0], node_id_db)
        if i < Ai[0]:
            start_nodes.append(from_id)
        for j in range(1, N - 1):
            to_id = get_node_id(i, Ai[j], node_id_db)
            edges[from_id].append(to_id)
            from_id = to_id

    dp = [-1 for _ in range(N * (N - 1) // 2)]
    print(max(dfs(n, edges, dp) for n in start_nodes))


### FIXED CODE ###

from sys import exit, setrecursionlimit
setrecursionlimit(1000000)

def dfs(v, dp, to):
  t = dp[v]
  if t >= 0:
    return t
  dp[v] = 0
  t = 0
  for u in to[v]:
    res = dfs(u, dp, to)
    if res == 0:
      print('-1')
      exit()
    if res > t:
      t = res
  t += 1
  dp[v] = t
  return t

def toId(i, j, id_db):
  if i < j:
    return id_db[i][j]
  else:
    return id_db[j][i]

def main():
  N = int(input())
  a = [[int(e) - 1 for e in input().split()] for _ in range(N)]

  id_db = [[0] * N for _ in range(N)]

  dp = [-1] * (N * (N - 1) // 2)
  to = [[] for _ in range(N * (N - 1) // 2)]

  v = 0
  for i in range(N):
    for j in range(i + 1, N):
      id_db[i][j] = v
      v += 1

  for i in range(N):
    for j in range(N - 1):
      a[i][j] = toId(i, a[i][j], id_db)
    for j in range(N - 2):
      to[a[i][j + 1]].append(a[i][j])

  print(max(dfs(i, dp, to) for i in range(N * (N - 1) // 2)))

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

div=[]
for i in range(1,min(a,b)+1):
    if(a%i==0 and b%i==0):
        div.append(i)
if(div):
    div.reverse()
    print(div[k-1])
else:
    print(1)


### FIXED CODE ###

a, b, c = map(int, input().split())
if(b/a>=c):
    print(c)
else:
    print(b//a)
k,s=map(int,input(),split())
#k=2
#s=2
result=0
for x in range(k+1):
    for y in range(k+1):
        z=s-x-y
        if 0<=z and z<=k:
            result+=1
            
print(result)
            
        




### FIXED CODE ###

k,s=map(int,input().split())
#k=2
#s=2
result=0
for x in range(k+1):
    for y in range(k+1):
        z=s-x-y
        if 0<=z and z<=k:
            result+=1
            
print(result)
N = int(input())
A = sorted(map(int,input().split()),reverse = True)
answer = 0
i = 1
s = 0
answer = A[0]
while True:
    s = (i+1)//2
    answer += A[s]
    i += 1
    if i == N-1:
        break
    
print(answer)

### FIXED CODE ###

N = int(input())
A = sorted(map(int,input().split()),reverse = True)
answer = 0
i = 1
s = 0
answer = A[0]
if N == 2:
    anwer=A[0]
else:
    while True:
        s = (i+1)//2
        answer += A[s]
        i += 1
        if i == N-1:
            break
    
print(answer)
import heapq
X, Y, A, B, C = map(int, input().split())
Av = list(map(int, input().split()))
Bv = list(map(int, input().split()))
Cv = list(map(int, input().split()))
heapq.heapify(Av)
heapq.heapify(Bv)
heapq.heapify(Cv)
for i in range(A-X):
    heapq.heappop(Av)
for i in range(B-Y):
    heapq.heappop(Bv)
if C > X+Y:
    for i in range(C-(X+Y)):
        heapq.heappop(Cv)
    NotTake = X+Y
else:
    NotTake = C
C = NotTake
for _ in range(NotTake):
    Amin = heapq.heappop(Av)
    Bmin = heapq.heappop(Bv)
    Cmin = heapq.heappop(Cv)
    if X > 0 and Amin == min(Amin, Bmin, Cmin):
        heapq.heappush(Bv, Bmin)
        heapq.heappush(Cv, Cmin)
        X -= 1
    elif Y > 0 and Bmin == min(Bmin, Cmin):
        heapq.heappush(Av, Amin)
        heapq.heappush(Cv, Cmin)
        Y -= 1
    elif C > 0:
        heapq.heappush(Av, Amin)
        heapq.heappush(Bv, Bmin)
        C -= 1
    else:
        break
print(sum(Av)+sum(Bv)+sum(Cv))

### FIXED CODE ###

import heapq
import sys
X, Y, A, B, C = map(int, input().split())
Av = list(map(int, input().split()))
Bv = list(map(int, input().split()))
Cv = list(map(int, input().split()))
heapq.heapify(Av)
heapq.heapify(Bv)
heapq.heapify(Cv)
for i in range(A-X):
    heapq.heappop(Av)
for i in range(B-Y):
    heapq.heappop(Bv)
if C > X+Y:
    for i in range(C-(X+Y)):
        heapq.heappop(Cv)
    NotTake = X+Y
else:
    NotTake = C
total = X+Y
C = NotTake
for _ in range(NotTake):
    Amin = heapq.heappop(Av)
    Bmin = heapq.heappop(Bv)
    Cmin = heapq.heappop(Cv)
    if X > 0 and Amin == min(Amin, Bmin, Cmin):
        heapq.heappush(Bv, Bmin)
        heapq.heappush(Cv, Cmin)
        X -= 1
    elif Y > 0 and Bmin == min(Bmin, Cmin):
        heapq.heappush(Av, Amin)
        heapq.heappush(Cv, Cmin)
        Y -= 1
    elif C > 0:
        heapq.heappush(Av, Amin)
        heapq.heappush(Bv, Bmin)
        C -= 1
    if X == 0 or Y == 0 or C == 0:
        break
NotTake = X+Y+C-total
if X == 0:
    Iv = Bv
    Jv = Cv
    I = Y
    J = C
elif Y == 0:
    Iv = Av
    Jv = Cv
    I = X
    J = C
else:
    print(sum(Av)+sum(Bv)+sum(Cv))
    sys.exit()

for _ in range(NotTake):
    Imin = heapq.heappop(Iv)
    Jmin = heapq.heappop(Jv)
    if I > 0 and Imin == min(Imin, Jmin):
        heapq.heappush(Jv, Jmin)
        I -= 1
    elif J > 0:
        heapq.heappush(Iv, Imin)
        J -= 1
    if J == 0 or I == 0:
        break

print(sum(Av)+sum(Bv)+sum(Cv))
import numpy as np
a = np.array([int(x) for x in input().split()])
count = 0
x = 0

while x == 0:
    if np.all(a%2 ==0):
        count+=1
        a = a/2
    else:
        break


print(count)

### FIXED CODE ###

a = input()
c = 0
if a[0]=='1':
    c=c+1
if a[1]=='1':
    c=c+1
if a[2]=='1':
    c=c+1
print(c)
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

def main():
  n, m = map(int, input().split())
  la, lb = [], []
  lc = []
  MAX = 10**9
  dp = numpy.zeros(2 ** 13).astype(numpy.int32)
  dp[1:] = MAX
  
  for _ in range(m):
    a, b = map(int, input().split())
    la.append(a)
    lb.append(b)
    lc.append(sum([1 << c for c in map(int, input().split())]))
    
  for a, c in zip(la, lc):
    for ic in range(dp.shape[0]):
      dp[c | ic] = min(a + dp[ic], dp[c | ic])
  if dp[2**(n+1)-2] != MAX:
    print(dp[2**(n+1)-2])
  else:
    print(-1)

if __name__=='__main__':
  main()



### FIXED CODE ###

#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n, m = map(int, input().split())
  la, lb = [], []
  lc = []
  MAX = 10**9
  dp = [MAX] * (2 ** 13)
  dp[0] = 0
  
  for _ in range(m):
    a, b = map(int, input().split())
    la.append(a)
    lb.append(b)
    lc.append(sum([1 << c for c in map(int, input().split())]))
    
  for a, c in zip(la, lc):
    for ic in range(len(dp)):
      dp[c | ic] = min(a + dp[ic], dp[c | ic])
  if dp[2**(n+1)-2] != MAX:
    print(dp[2**(n+1)-2])
  else:
    print(-1)

if __name__=='__main__':
  main()
N=int(input())
ab=[[int(i) for i in input().split()] for j in range(N)]
total = sum([sum(row) for row in ab])//2
diff = [row[1] for row in ab if row[0]>row[1]]
if len(diff)==0:
    print(0)
else:
    print(total-diff)


### FIXED CODE ###

N=int(input())
ab=[[int(i) for i in input().split()] for j in range(N)]
total = sum([sum(row) for row in ab])//2
diff = [row[1] for row in ab if row[0]>row[1]]
if len(diff)==0:
    print(0)
else:
    print(total-min(diff))
N, A, B = map(int, input().split())
print(min(A * B, C))

### FIXED CODE ###

N, A, B = map(int, input().split())
print(min(A * N, B))
a, b, c = map(int, input().split())

if (a == 7 and b ==5 and c == 5)or(a == 5 and b == 7 and c == 5)
or(a==5 and b==5 and c==7):
  print("YES")
  
else:
  print("NO")

### FIXED CODE ###

  
  # 文節の入力(整数として扱う)
a, b, c = map(int, input().split())
# まず長さが7の文節があるか確認
if a == 7 and b == 5 and c == 5:
	print("YES")
elif a == 5 and b == 7 and c == 5:
	print("YES")
elif a == 5 and b == 5 and c == 7:
	print("YES")
else:
	print("NO")
x,y = list(map(decimal.Decimal,input().split()))
y*=100
print(math.floor(x*y/100))


### FIXED CODE ###

import math
import decimal
x,y = list(map(decimal.Decimal,input().split()))
print(math.floor(x*y))