Harryxun/stf_run huggingface dataset:
import re

S = input()
T = input()

start = time.time()

ans_list = []

a = '.'*len(T)

for i in range(len(T)):
    if i == 0:
        b = T[i] + a[i+1:]
    elif i == len(T)-1:
        b = a[:i] + T[i]
    else:
        b = a[:i] + T[i] + a[i+1:]
    s = re.findall(b, S)
    
    if len(s) >= 1:
        for j in range(len(s)):
            c = list(s[j])
            d = list(T)
            ans = 0
            for k in range(len(c)):
                if c[k] == d[k]:
                    ans += 1
            ans_list.append(ans)
    else:
        pass

print(len(T) - max(ans_list))

### FIXED CODE ###

S = input()
T = input()

ans = len(T)

for i in range(len(S) - len(T) + 1):
    diff = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            diff += 1
    ans = min(ans, diff)
    
print(ans)
a, b = map(int, raw_input().split())
if(a+b<11):
    print(a+b)
else:
    print("error")

### FIXED CODE ###

a, b = map(int, input().split())
if(a+b<10):
    print(a+b)
else:
    print("error")
a = []
A,B,K  = map(int, input().split())

if A > B:
	min = B
else:
  min = A

for i in B:
  if(A % i == 0 && B % i == 0):
    a.append(i)

print(a.get(K-1))

### FIXED CODE ###

a = []
A,B,K  = map(int, input().split())
min = 0
 
if A > B:
	min = B
else:
  min = A
for i in range(1, min + 1):
  if(A % i == 0 and B % i == 0):
    a.append(i)
    
print(a[len(a) - K])

#no 1 is a(len-1)
# no k is a(lent-K)
import sys
while 1:
    try:
        temp = input()
        if (temp==0):
            break
        N = temp
        a = []
        for i in range(N):
            a.append(map(int, raw_input().split())+[0])
        a.append([0 for i in range(0,temp+1)])	 
        for i in range(0,temp):#行に関して
            for j in range(0,temp):#列に関して
                a[i][temp] += a[i][j]
        for k in range(0,temp+1):#列に関して
            for l in range(0,temp):#行に関して
                a[temp][k] += a[l][k]
        for m in range(0,temp+1):
            for n in range(0,temp+1):
                sys.stdout.write(str(a[m][n]).rjust(5))
            print ""
    except(RuntimeError):
        pass

### FIXED CODE ###

import sys
try:
	while 1:
		temp = input()
		if (temp==0):
			break
		N = temp
		a = []
		for i in range(N):
			a.append(map(int, raw_input().split())+[0])
		a.append([0 for i in range(0,temp+1)])
		for i in range(0,temp):
			for j in range(0,temp):
				a[i][temp] += a[i][j]
		for k in range(0,temp+1):
			for l in range(0,temp):
				a[temp][k] += a[l][k]
		for m in range(0,temp+1):
			for n in range(0,temp+1):
				sys.stdout.write(str(a[m][n]).rjust(5))
			print ""
except(RuntimeError):
	pass
N=int(input())
i=int(input())
j=o

j=N-i+1

print(j)



### FIXED CODE ###

k=list(map(int , input().split()))
N=k[0]
i=k[1]
print(N-i+1)
,m = map(int,input().split())
a = [0]*m
b = [0]*m
for i in range(m):
  a[i], b[i] = map(int,input().split())

d = [0]*(n+1)
for i in range(1,n+1):
  d[i] = i
  
s = [0] + [1]*n

g=[ [0] ]*(n+1)
for i in range(1,n+1):
  g[i] = [i]
g[0] = []
#print(g)
#quit()

c = n*(n-1)//2
ans = []
ans.append(c)

for i in range(1,m)[::-1]:
  x = d[a[i]]
  y = d[b[i]]
  if x == y:
    ans.append(c)
    continue
  c -= s[x]*s[y]
  #print(c, "x")
  ans.append(c)
  s[x] += s[y]
  s[y] = 0
  for i in g[y]:
    d[i] = x
  g[x] = g[x] + g[y]
  g[y] = []
for t in ans[::-1]:
  print(t)
  

### FIXED CODE ###

n,m = map(int,input().split())
a = [0]*m
b = [0]*m
for i in range(m):
  a[i], b[i] = map(int,input().split())

d = [0]*(n+1)
for i in range(1,n+1):
  d[i] = i
  
s = [0] + [1]*n

g=[ [0] ]*(n+1)
for i in range(1,n+1):
  g[i] = [i]
g[0] = []
#print(g)
#quit()

c = n*(n-1)//2
ans = []
ans.append(c)

for i in range(1,m)[::-1]:
  x = d[a[i]]
  y = d[b[i]]
  x,y = max(x,y),min(x,y)
  if x == y:
    ans.append(c)
    continue
  c -= s[x]*s[y]
  #print(c, "x")
  ans.append(c)
  s[x] += s[y]
  #s[y] = 0
  for i in g[y]:
    d[i] = x
  g[x] += g[y]
  #g[y] = []
for t in ans[::-1]:
  print(t)
N = int(input())
NR = int(N**0.5)
count = 0
if int(N/2)-N/2 == 0:
    for i in range(1,int(N/2)):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)
else:
    for i in range(1,int(N/2)+1):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)
 
count += int(N/2)
print(count)
N = int(input())
NR = int(N**0.5)
count = 0
if int(N/2)-N/2 == 0:
    for i in range(1,int(N/2)):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)
else:
    for i in range(1,int(N/2)+1):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)

count += int(N/2)
print(count)


### FIXED CODE ###

N = int(input())
NR = int(N**0.5)
count = 0
if int(N/2)-N/2 == 0:
    for i in range(1,int(N/2)):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)
else:
    for i in range(1,int(N/2)+1):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)

count += int(N/2)
print(count)
s = row_input()
print(s.count('+') - s.count('-'))

### FIXED CODE ###

s = input()
print(s.count('+') - s.count('-'))
N=int(input())
S=input()
s=S.index('.')
k=S[s::]
a=k.count('.')
b=k.count('#')
if a>b: print(b)
else: print(a)

### FIXED CODE ###

N=int(input())
S=input()
b,w,ans=0,0,0
w=S.count('.')
ans=w
for i in S:
	if i=='#':b+=1
	else:w-=1
	ans=min(b+w,ans)
print(ans)
a,b=map(int,input().split())
fac=[0]*200001#iの階乗mod(1000000007)
inv=[0]*200001#iの逆元mod(1000000007)
fac[0]=1
ans=0
for i in range(1,200001):
    fac[i]=fac[i-1]*i%1000000007
inv[200000]=pow(fac[200000],1000000005,1000000007)
for i in range(199999,0,-1):
    inv[i]=(inv[i+1]*(i+1))%1000000007
    inv[0]=1
for i in range(h-a):
    if i==0:
        if h==1:
            x=1
        else:
            x=(fac[w-b+h-2
                   -i]*inv[w-1-b]*inv[h-1-i])%1000000007
    elif w==b+1:
        x=(fac[b-1+i]*inv[b-1]*inv[i])%1000000007
    else:
        x=((fac[b-1+i]*inv[b-1]*inv[i])%1000000007)*((fac[w-b+h-2-i]*inv[w-b-1]*inv[h-1-i])%1000000007)
    ans=(ans+x)%1000000007
print(ans)

### FIXED CODE ###

h,w,a,b=map(int,input().split())
fac=[0]*200001#iの階乗mod(1000000007)
inv=[0]*200001#iの逆元mod(1000000007)
fac[0]=1
ans=0
for i in range(1,200001):
    fac[i]=fac[i-1]*i%1000000007
inv[200000]=pow(fac[200000],1000000005,1000000007)
for i in range(199999,0,-1):
    inv[i]=(inv[i+1]*(i+1))%1000000007
    inv[0]=1
for i in range(h-a):
    if i==0:
        if h==1:
            x=1
        else:
            x=(fac[w-b+h-2
                   -i]*inv[w-1-b]*inv[h-1-i])%1000000007
    else:
        x=((fac[b-1+i]*inv[b-1]*inv[i])%1000000007)*((fac[w-b+h-2-i]*inv[w-b-1]*inv[h-1-i])%1000000007)
    ans=(ans+x)%1000000007
print(ans)
import numpy as np
S = input()
N = len(S)
if N // 2 == 0:
  even = np.array([S[2*k] for k in range(N // 2)])
  odd = np.array([S[2*k + 1] for k in range(N // 2)])
  even_1 = even.sum()
  odd_1 = odd.sum()
  if even_1 > odd_1:
    print(N//2 - even_1 + odd_1)
  else:
    print(N//2 + even_1 - odd_1)
else:
  even = np.array([S[2*k] for k in range( (N+1) // 2)])
  odd = np.array([S[2*k + 1] for k in range(N // 2)])
  even_1 = even.sum()
  odd_1 = odd.sum()
  if even_1 <= odd_1:
    print(even_1 + N//2 - odd_1)
  else:
    print(odd_1 + (N+1)//2 - even_1)

### FIXED CODE ###

import numpy as np
S = input()
N = len(S)
if N // 2 == 0:
  even = np.array([int(S[2*k]) for k in range(N // 2)])
  odd = np.array([int(S[2*k + 1]) for k in range(N // 2)])
  even_1 = even.sum()
  odd_1 = odd.sum()
  if even_1 > odd_1:
    print(int(N//2 - even_1 + odd_1))
  else:
    print(int(N//2 + even_1 - odd_1))
else:
  even = np.array([int(S[2*k]) for k in range( (N+1) // 2)])
  odd = np.array([int(S[2*k + 1]) for k in range(N // 2)])
  even_1 = even.sum()
  odd_1 = odd.sum()
  if even_1 <= odd_1:
    print(int(even_1 + N//2 - odd_1))
  else:
    print(int(odd_1 + (N+1)//2 - even_1))
a,b = input().split()
ans = ''
for i, s in enumerate(a):
  ans+=s
  ans+=b[i]
print(ans)

### FIXED CODE ###

_ = input()
a,b = input().split()
ans = ''
for i, s in enumerate(a):
  ans+=s
  ans+=b[i]
print(ans)
import sys

n = sys.stdin.readline().rstrip()

sum = 0
for i in range(n):
  line = sys.stdin.readline().rstrip().split(" ")
  if(line[1] == "BTC"):
    sum += float(line[0]) * 380000.0
  else:
    sum += float(line[0])
print(sum)

### FIXED CODE ###

import sys

n = int(sys.stdin.readline().rstrip())

sum = 0
for i in range(n):
  line = sys.stdin.readline().rstrip().split(" ")
  if(line[1] == "BTC"):
    sum += float(line[0]) * 380000.0
  else:
    sum += float(line[0])
print(sum)
data = [[[0 for r in range(10)] for f range(3)] for b in range(4)]

n = int(input())
for nc in range(n):
    (b,f,r,v) = [int(i) for i in input().split()]
    data[b - 1][f -1][r -1] += v


for b in range(4):
    for f in range(3):
        for r in range(10):
            print(' {0}'.format(data[b][f][r]),end='')
        print()
    print('#' * 20) 

### FIXED CODE ###

data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())
for _ in range(n):
    (b, f, r, v) = [int(i) for i in input().split()]
    data[b - 1][f - 1][r - 1] += v
   
for b in range(4):
    for f in range(3):
        for r in range(10):
            print('', data[b][f][r], end='')
        print()
    if b != 3:
        print('#' * 20)
っっｊ

### FIXED CODE ###

A,B=map(int, input().split())
print(max(A+B,A-B,A*B))
# coding: utf-8

N = input()
array1 = input().split()
array = list(array1)
chk = 0

if (int(array[0])%2) != 0:
	print("0")
else:
	flg = 0
	mini1 = min(array)
	mini = int(mini1)
	while 1:
		if mini%2 != 0:
			break
		mini = mini/2
		flg +=1
		
		if mini == 0:
			break

	print(flg)

### FIXED CODE ###

# coding: utf-8

N = input()
N_list = list(N)
N_count = N_list.count("1")

if N_count == 0:
	print("0")
elif N_count == 1:
	print("1")
elif N_count == 2:
	print("2")
elif N_count == 3:
	print("3")
d = input().split()
print(float(d[0])/d[1])

### FIXED CODE ###

d = input().split()
print(float(int(d[0]))/int(d[1]))
import sys
heights = sort([ int(h) for h in sys.stdin],reverce)
for h in heights:
    print(h)

### FIXED CODE ###

import sys
heights = sorted([ int(h) for h in sys.stdin ], reverse=True)
print( heights[0] )
print( heights[1] )
print( heights[2] )
n,k=map(int,input().split())
list=[]
for i in range(n):
    a,b=map(int,input().split())
    list.append(str(a)*b)
list.sort
print(list[k])

### FIXED CODE ###

n,k=map(int,input().split())
list=[]
for i in range(n):
    a,b=map(int,input().split())
    list.append([a,b])
list.sort()
sum=0
for x in list:
    sum+=x[1]
    if sum >=k:
        print(x[0])
        break
import math
A,B = map(int, input().split())
print(math.ceil((a+b)/2))

### FIXED CODE ###

import math
A,B = map(int, input().split())
print(math.ceil((A+B)/2))
N, D = map(int, input().split())
arX = [list(map(int, input().split()))[:D] for n in range(N)]

import math

count = 0
for x in range(len(arX)):
    xp = arX[x]
    for y in range(x, len(arX)):
        if x == y:
            continue
        
        yp = arX[y]
        
        powSum = 0
        for d in range(D):
            powSum += (xp[d] - yp[d]) ** 2
        
        if debug:
            print(x, y, sqPowSum)
            
        sqPowSum = math.sqrt(powSum)
        if sqPowSum == int(sqPowSum):
            count += 1

print(count)

### FIXED CODE ###

N, D = map(int, input().split())
arX = [list(map(int, input().split()))[:D] for n in range(N)]

import math

count = 0
for x in range(len(arX)):
    xp = arX[x]
    for y in range(x, len(arX)):
        if x == y:
            continue
        
        yp = arX[y]
        
        powSum = 0
        for d in range(D):
            powSum += (xp[d] - yp[d]) ** 2
        
        #print(x, y, sqPowSum)
            
        sqPowSum = math.sqrt(powSum)
        if sqPowSum == int(sqPowSum):
            count += 1

print(count)
while 1:
    i = input()
    if i == None:
        break
    else:
        a, b, c, d, e, f = map(float, i.split())
        x = (e*c - b*f)/(e*a - b*d)
        y = (c*d - f*a)/(d*b - e *a)

        print(x,y) 

### FIXED CODE ###

while(True):
        try:
            a,b,c,d,e,f=map(float,input().split(" "))
            z=a*e-b*d
            if(z!=0):
                x=(c*e-b*f)/z
                y=(a*f-c*d)/z
            print("{:.3f} {:.3f}".format(x+0,y+0))
        except:
            break
N,M = (int(x) for x in input().split())
A_arr = [int(x) for x in input().split()]
BC_arr = [[0,0] for _ in range(M)]
for i in range(M):
    b,c = (int(x) for x in input().split())
    BC_arr[i][0] = b
    BC_arr[i][1] = c

A_arr.sort()
BC_arr.sort(key=lambda x:x[1], reverse=True)

break_th = False
j_count = 0
for BC in BC_arr:
    Bi = BC[0]
    Ci = BC[1]
    for j in range(Bi):
        if A_arr[j_count] >= Ci:
            break_th = True
            break
        A_arr[j_count] = Ci
        j_count += 1
    if break_th:
        break
print(sum(A_arr))


### FIXED CODE ###

N,M = (int(x) for x in input().split())
A_arr = [int(x) for x in input().split()]
BC_arr = [[0,0] for _ in range(M)]
for i in range(M):
    b,c = (int(x) for x in input().split())
    BC_arr[i][0] = b
    BC_arr[i][1] = c

A_arr.sort()
BC_arr.sort(key=lambda x:x[1], reverse=True)

break_th = False
j_count = 0
for BC in BC_arr:
    Bi = BC[0]
    Ci = BC[1]
    for j in range(Bi):
        if A_arr[j_count] >= Ci:
            break_th = True
            break
        A_arr[j_count] = Ci
        j_count += 1
        if j_count == N:
            break_th = True
            break
    if break_th:
        break
print(sum(A_arr))
import math
r = int(input())
print("{0} {1}".format(r**2*math.pi,2*math.pi*r))

### FIXED CODE ###

import math
r = float(input())
print("{0} {1}".format(r**2*math.pi,2*math.pi*r))
# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())
# 割り算の商
a = N // 2
# 割り算のあまり
b = N % 2
# 余りが計算
if b = 0 :
  #出力
  print(a)
else:
  print(a + 1)

### FIXED CODE ###

# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())
# 割り算の商
a = N // 2
# 割り算のあまり
b = N % 2
# 余りが計算
if b == 0 :
  #出力
  print(a)
else:
  print(a + 1)
n=int(input())
s=list(input() for _ in range(n))
m,i,f,both=0,0,0,0

for i in range(n):
    m +=s[i].count("AB")
   

if both!=0:
    if i!=0 and f!=0:
        print(m+both+min(i,f)-1)
    else:
        print(m+both+min(i,f))

else:
    print(min(i,f))


### FIXED CODE ###

n,k=list(map(int,input().split()))
print(n-k+1)
try:
  a = int(input('A'))
  b = int(input('B'))
  k = int(input('K'))
except EOFError:
  a = 8
  b = 12
  k = 2 
count = 0
kcount = 0
while True:
    count += 1
    if a % count == 0 and b % count == 0:
        kcount += 1
    if k == kcount:
        break

print(count)




### FIXED CODE ###

A,B,K = map(int,input().split())
l = []
for i in range(1,min(A,B)+1):
    if A % i == 0 and B % i == 0:
        l.append(i)
l.reverse()
print(l[K - 1])
H,W=map(int, input().split())
masu_list = []
for i in range(H):
  S=str(input())
  if S.count('#') != 0:
    masu_list.append(S)

yet = True
while yet:
  for i in range(len(masu_list[0])):
    if masu_list[i].count('#') == 0:
      masu_list.delete(i,1)

### FIXED CODE ###

def rotate(mat):
  mat2 = []
  for i in range(len(mat[0])):
    s = ""
    for k in range(len(mat)):
      s = s + mat[k][i]
    mat2.append(s)
  return mat2

H,W=map(int, input().split())
mat = []
for i in range(H):
  a = input()
  if "#" in a:
    mat.append(a)

for count in range(H+W):
  for i in range(len(mat)-1, -1, -1):
    if not "#" in mat[i]:
      del mat[i]
  mat = rotate(mat)
  for i in range(len(mat)-1, -1, -1):
    if not "#" in mat[i]:
      del mat[i]
  mat = rotate(mat)
  
for i in range(len(mat)):
  print(mat[i])
a = int(input())

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

b.sorted()

su = 0

for i in range(a):
  su += b[2*i]

### FIXED CODE ###

a = int(input())

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

b.sort()

su = 0

for i in range(a):
  su += b[2*i]
print(su)
class Dice(object):
    def __init__(self):
        self.upside = 1
	self.frontside = 2
	self.rightside = 3
	self.backside = 4
	self.leftside = 5
	self.downside = 6
		
    def throwDice(self,dir):
	up = self.upside
	front = self.frontside
	left = self.leftside
	if dir == "S":
	    self.frontside = up
	    self.backside = 7-up
	    self.downside = front
            self.upside = 7-front
			
	elif dir == "N":
	    self.frontside = 7-up
	    self.backside = up
	    self.downside = 7-front
	    self.upside = front
			
	elif dir == "E":
	    self.rightside = up
	    self.leftside = 7-up
	    self.upside = left
	    self.downside = 7-left
		
	elif dir == "W":
	    self.rightside = 7-up
	    self.leftside = up
	    self.upside = 7-left
	    self.downside = left
	
    def getUpside(self):
	    return self.upside
		
n = list(map(int,input().split()))
com = list(input())

dice = Dice()
for i in range(len(com)):
	dice.throwDice(com[i])

print(n[dice.getUpside()-1])

	
	
	

### FIXED CODE ###

def move(up,bottom,right,left,front,back,direction):
    if direction == "N":
        return (front,back,right,left,bottom,up)
    elif direction == "S":
        return (back,front,right,left,up,bottom)
    elif direction == "E":
        return (left,right,up,bottom,front,back)
    elif direction == "W":
        return (right,left,bottom,up,front,back)
    
up,front,right,left,back,bottom = input().split()
direction = list(input())

for i in range(len(direction)):
    up,bottom,right,left,front,back = move(up,bottom,right,left,front,back,direction[i])
    
print(up)
import math
nums=[int(i) for i in input().split()]
print(int(nums[0]*nums[1]/math.gcd(nums[0],nums[1])))

### FIXED CODE ###

import fractions
nums=[int(i) for i in input().split()]
print(nums[0]*nums[1]//fractions.gcd(nums[0],nums[1]))
x = input()
s = list(x)
x = int(x)

xx = int(s[-2]+s[-1])
num_item = xx//5
if xx%5 != 0:
    num_item += 1

hun = int(''.join(s[0:-2]))
if hun < num_item:
    print(0)
else:
    print(1)

### FIXED CODE ###

x = input()
s = list(x)
x = int(x)

if len(s) < 3:
    print(0)
else:
    xx = int(s[-2]+s[-1])
    num_item = xx//5
    if xx%5 != 0:
        num_item += 1
    
    hun = int(''.join(s[0:-2]))
    if hun < num_item:
        print(0)
    else:
        print(1)
l = raw_input().split()
if int(l[0])+int(l[1])==15:
    print('+')
elif int(l[0])*int(l[1]) ==15:
    print('*')
else:
    print('x')

### FIXED CODE ###

l = input().split()
if int(l[0])+int(l[1])==15:
    print('+')
elif int(l[0])*int(l[1]) ==15:
    print('*')
else:
    print('x')
a = int(input())
b = int(input())
if a < b:
 print("a < b")
elif a > b:
 print("a > b")
else
 print("a = b")

### FIXED CODE ###

a, b = map(int, input().split())
if a < b:
 print("a < b")
elif a > b:
 print("a > b")
else:
 print("a == b")
def _comb(N,M):
    if not N:return(0)
    count=1
    for i in range(0,M):
        count*=N-i
    for i in range(1,M+1):
        count/=i
    return(int(count))

N,M=list(map(int,input().split()))
A=[int(input()) for i in range(M)]
A.append(N+1)
count=1
if 1 in A:pre=-1
else:pre=0
for a in A:
    count*=sum([_comb(a-1-pre-i,i) for i in range((a-1)-pre)])
    pre=a+1
print(count%1000000007)


### FIXED CODE ###

N,M=map(int,input().split())
mod=10**9+7
A=set([int(input()) for i in range(M)])

data=[0 for i in range(N)]
if 1 not in A:
    data[0]=1
if N>=2:
    if 2 not in A:
        data[1]=1+data[0]


for i in range(2,N):
    if i+1 not in A:
        data[i]=data[i-1]+data[i-2]
        data[i]%=mod

#print(data)

print(data[-1])
a=set(input.split())
print(len(a))

### FIXED CODE ###

a=list(input().split())
print(len(set(a)))
N = int(input())
result = []
for i in tqdm(range(1, N+1)):
    if N % i == 0:
        result.append(i+int(N/i)-2)
print(min(result))

### FIXED CODE ###

import numpy as np
N = int(input())
result = []
for i in range(1, np.sqrt(N).astype(int)+1):
    if N % i == 0:
        result.append(i+int(N/i)-2)
print(min(result))
x, y, a, b, c = map(int, input().split())
p = sorted(map(int, input().split()))
q = sorted(map(int, input().split()))
r = sorted(map(int, input().split()), reverse=True)
pi = len(p) - x
qi = len(q) - y
ri = 0
for _ in range(len(r)):
    if r[ri] <= min(p[pi], q[qi]):
        break
    else:
        if pi >= len(p) and qi >= len(q):
            break
        else:
            if pi < len(p) and qi < len(q):
                if p[pi] < q[qi]:
                    p[pi] = r[ri]
                    pi += 1
                else:
                    q[qi] = r[ri]
                    qi += 1
            elif pi >= len(p) and qi < len(q):
                if q[qi] < r[ri]:
                    q[qi] = r[ri]
                    qi += 1
            elif pi < len(p) and qi >= len(q):
                if p[pi] < r[ri]:
                    p[pi] = r[ri]
                    pi += 1
            ri += 1
            continue
print(sum(p[-x:]) + sum(q[-y:]))


### FIXED CODE ###

x, y, a, b, c = map(int, input().split())
p = sorted(map(int, input().split()))
q = sorted(map(int, input().split()))
r = sorted(map(int, input().split()), reverse=True)
pi = len(p) - x
qi = len(q) - y
ri = 0
for _ in range(len(r)):
    if r[ri] <= min(p[min(pi, len(p)-1)], q[min(qi, len(q)-1)]):
        break
    else:
        if pi >= len(p) and qi >= len(q):
            break
        else:
            if pi < len(p) and qi < len(q):
                if p[pi] < q[qi]:
                    p[pi] = r[ri]
                    pi += 1
                else:
                    q[qi] = r[ri]
                    qi += 1
            elif pi < len(p) and qi >= len(q):
                p[pi] = r[ri]
                pi += 1
            else:
                q[qi] = r[ri]
                qi += 1
            ri += 1
print(sum(p[-x:]) + sum(q[-y:]))
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
A = iil()

l = [0]*9
for i in A:
    l[max(i//400,8)] += 1

lf = l[:-1]
ans = 8-lf.count(0)
print(ans,ans+l[8])


### FIXED CODE ###

def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
A = iil()

l = [0]*9
for i in A:
    l[min(i//400,8)] += 1

lf = l[:-1]
ans = 8-lf.count(0)
print(max(1,ans),ans+l[8])
N,K=list(map(int,input().split()))

node=(N-1)*(N-2)//2

if K>node:
    print(-1)
    exit(0)

g=[[] for _ in range(N+1)]
M=0

for i in range(2,node+2):
    g[1].append(i)
    M+=1

for i in range(node-K):
    g[i+2].append(i+3)
    M+=1
print(M)
for i in range(1,N+1):
    for j in g[i]:
        print('{} {}'.format(i,j))

### FIXED CODE ###

from itertools import combinations

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

node=(N-1)*(N-2)//2

if K>node:
    print(-1)
    exit(0)

g=[[] for _ in range(N+1)]
M=0

for i in range(2,N+1):
    g[1].append(i)
    M+=1

cnt=node-K

for u,v in combinations(range(2,N+1),2):
    if cnt==0:
        break
    g[u].append(v)
    
    M+=1
    cnt-=1


print(M)
for i in range(1,N+1):
    for j in g[i]:
        print('{} {}'.format(i,j))
n = input()

s = sum((int(i) for i in n))

if int(n)%s==0:
    print('Yes')
else:
    print('No')





### FIXED CODE ###

s = input()
ans = 0
for n in s:
    if n == '+': ans += 1
    else: ans -= 1
print(ans)
print(-int(input())+sum(map(input().split(),int)))

### FIXED CODE ###

N = int(input())
A = [int(_) for _ in input().split()]

def gcd(a, b):
    if a < b:
        a, b = b, a
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

#l = 1
#for a in A:
#    l = lcm(l, a)

#r = sum((l - 1) % a for a in A)
r = sum(a - 1 for a in A)

print(r)
a,b,c,d = map(int, input().split())
if c >= b or a >= d:
    print(0)
else:
    if a <= c:
        print(min(b-c,d-c))
    else:
        print(min(d-a,b-a)
    

### FIXED CODE ###

a,b,c,d = map(int, input().split())
if c >= b or a >= d:
    print(0)
else:
    if a <= c:
        print(min(b-c,d-c))
    else:
        print(min(d-a,b-a))