Harryxun/stf_run huggingface dataset:
def input(): return sys.stdin.readline().strip()
n,m = map(int,input().split())
s = [input().split() for i in range(m)]
li = [[s[0][0],s[0][1]]]
del s[0]
for item in s:
  num_1 = item[0]
  num_2 = item[1]
  for group in li:
    if num_1 in group and num_2 in group:
      flag=0
      pass
      break
    elif num_1 in group:
      group.append(num_2)
      flag=0
      break
    elif num_2 in group:
      group.append(num_1)
      flag=0
      break
    else:
      flag = 1
  if flag:
    li.append([num_1,num_2])
count = 0
for j in li:
  count += len(j)-1
print(n-count)

### FIXED CODE ###

class UnionFind():
	def __init__(self, n):
		self.n = n
		self.root = [-1]*(n+1)
		self.rank = [0]*(n+1)

	def find(self, x):
		if(self.root[x] < 0):
			return x
		else:
			self.root[x] = self.find(self.root[x])
			return self.root[x]
			
	def unite(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if(x == y):
			return 0
		elif(self.rank[x] > self.rank[y]):
			self.root[x] += self.root[y]
			self.root[y] = x
		else:
			self.root[y] += self.root[x]
			self.root[x] = y
			if(self.rank[x] == self.rank[y]):
				self.rank[y] += 1
	
	def f(self, x):
		return self.root[x] < 0
		
n,m,*l=map(int,open(0).read().split())
uf=UnionFind(n)
for i,j in zip(l[::3],l[1::3]):
	uf.unite(i,j)
print(sum(uf.f(i) for i in range(1,n+1)))
A,B,C,D,E,F=map(int,input().split())
E=(100*E)/(100+E)
M=[]
S=[]
for i in range(F//100*A+1):
    for j in range(F//100*B+1):
        t=i*100*A+j*100*B
        if t<=F and t!=0:
            M.append(t)
for i in range(F//C+1):
    for j in range(F//D+1):
        ta=i*C+j*D
        if ta<=F and ta!=0:
            S.append(ta)
tmp=0
for x in M:
    for y in S:
        f=x+y
        e=(100*y)/f
        if f<=F and e<=E:
            if e>tmp:
                tmp=e
                ans1,ans2=f,y
print(ans1,ans2)

### FIXED CODE ###

a,b,c,d,e,f=map(int,input().split())
a=100*a
b=100*b
dp1=[0]*(f+1)
dp2=[0]*(f+1)
for i in range(f+1):
    if i%a==0:
        if i+a<=f:
            dp1[i+a]=1
for i in range(f+1):
    if i==0 or dp1[i]==1:
        if i+b<=f:
            dp1[i+b]=1
for i in range(f+1):
    if i%c==0:
        if i+c<=f:
            dp2[i+c]=1
for i in range(f+1):
    if i==0 or dp2[i]==1:
        if i+d<=f:
            dp2[i+d]=1

ans=[-1,-1,-1]
for i in range(f+1):
    if dp1[i]==1:
        x=min(f-i,(i//100)*e)
        k=-1
        for j in range(x,-1,-1):
            if dp2[j]==1 or j==0:
                k=j
                if ans[0]<100*k/(i+k):
                    ans=[100*k/(i+k),i+k,k]
                break
print(str(ans[1])+" "+str(ans[2]))
n = int(input())
list = []
for i in range(n):
    list += [int(input())]

max = max(list)
for i in range(n):
    a = list[i]
    if a == max:
        del list[i]
        print(max(list))
        list.insert(i,a)
    else:
        print(max)

### FIXED CODE ###

n = int(input())
list = []
for i in range(n):
    list += [int(input())]

max_ = max(list)
for i in range(n):
    a = list[i]
    if a == max_:
        del list[i]
        ans = max(list)
        print(ans)
        list.insert(i,a)
        if ans == max_:
            for j in range(n-i-1):
                print(max_)
            break
    else:
        print(max_)
n, y = map(int, input().split())
ans = 0
for i in range(n+1):
    for j in range(n-i+1):
        if (10000*i + 5000*j +1000(n-i-j)) ==y:
            print(i, j, n-i-j)
            exit()
        else:
            print('-1 -1 -1')

### FIXED CODE ###

n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n-i+1):
        if 10000 * i + 5000 * j + 1000 * (n-i-j)==y:
            print(i, j, n-i-j)
            exit()
print("-1 -1 -1")
while 1:
	n,m=map(int, raw_input().split())
	if n==0:break
#	c=sorted(map(int,raw_input().split()))[::-1]
#	if m > n:
#		print sum(c)
#	else:
#		c[m-1::m] = [0 for i in range(m-1,n,m)]
#		print sum(c)
	

### FIXED CODE ###

# try-except is necessary for avoiding Runtime Error 
while 1:
	try:
		n,m=map(int,raw_input().split())
		if n==0:break
		v=sorted(map(int,raw_input().split()))[::-1]
		for i in range(m-1,n,m):
			v[i]=0
		print sum(v)
	except:
		pass
A,B,K=map(int,input().split());print[i for i in range(A,0,-1)if1>A%i+B%i][K-1]

### FIXED CODE ###

#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18

A, B, K = map(int, raw_input().split())

cnt = 0

for i in range(1, max(A, B) + 1)[::-1]:
    if A % i == 0 and B % i == 0:
        cnt += 1
    if cnt == K:
        print i
        exit()
def input_from_console():
    a, b, c, k = map(int, input().split())
    return a, b, c, k


def solve(a, b, c, k):
    all_list = [1] * a + [0] * b + [-1] * c
    return sum(all_list[0:k])


def main():
    a, b, c, k = input_from_console()
    print(solve(a, b, c, k))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()


### FIXED CODE ###


def input_from_console():
    a, b, c, k = map(int, input().split())
    return a, b, c, k


def solve(a, b, c, k):
    sum = 0
    if k < a:
        return k
    else:
        k = k - a
        sum = a
    if k < b:
        return sum
    else:
        k = k - b
    sum -= k
    return sum

def main():
    a, b, c, k = input_from_console()
    print(solve(a, b, c, k))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()
N=int(input())
V=list(map(input().split()))

V_sorted=sorted(V)

now_value=(V_sorted[0]+V_sorted[1])/2
for i in range(2,N):
    now_value=(now_value+V_sorted[i])/2

print(now_value)


    

    


### FIXED CODE ###

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

V_sorted=sorted(V)

now_value=(V_sorted[0]+V_sorted[1])/2
for i in range(2,N):
    now_value=(now_value+V_sorted[i])/2

print(now_value)
N=int(input())
if N==N[::-1]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N=str(input())
if N==N[::-1]:
    print("Yes")
else:
    print("No")
L,R = map(int,input().split())

# L <= i,j <== R の中で、i*j mod 2019の最小値を求めよ

# L,R は 0 ~ 2*10^9

# (i*j) mod 2019 = (i mod 2019) * (j mod 2019)

if(R <= 2019):
    ans = (R%2019)* ((R-1)%2019)

if(L >= 2019):
    ans = (L%2019)* ((L+1)%2019)
print(ans)

### FIXED CODE ###

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

# L <= i,j <== R の中で、i*j mod 2019の最小値を求めよ

# L,R は 0 ~ 2*10^9

# (i*j) mod 2019 = (i mod 2019) * (j mod 2019) %2019

# =============================================================================
# for i in range(2019):
#     for j in range(i,2019):
#         a = (i*j) % 2019
#         b = (i % 2019)*(j % 2019) % 2019
#         if a != b:
#             print(i,a,b)
# =============================================================================

# 全探索: 2019*2019が最大

dist = (R - L)
if dist >= 2019:
    print("0")
else:
    ans = 999999
    for i in range(L,R):
        for j in range(i+1,R+1):
            ans = min(ans,(i*j) % 2019)
    print(ans)
import math
length,target = (int(n) for n in input().split(" "))
ball = [int(n) for n in input().split(" ")]
gcd = ball[0]
for i in range(1,length):
    gcd = math.gcd(gcd,ball[i])
if target % gcd == 0 and target <= max(ball):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

import fractions 
length,target = (int(n) for n in raw_input().split(" "))
ball = [int(n) for n in raw_input().split(" ")]
gcd = ball[0]
for i in range(1,length):
    gcd = fractions.gcd(gcd,ball[i])
if target % gcd == 0 and target <= max(ball):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
import copy
n = int(input())
inputs = input().split(" ")
l = [int(s) for s in inputs]

def calc(rl, ns, skip):
    v = rl[len(rl)-1]
    # print(rl,v,ns)
    lrl = len(rl)
    
    if lrl == 1:
        return ns
    if lrl == 2:
        v1 = rl[len(rl)-2]
        return ns+abs(v-v1)
    if lrl == 3:
        v1 = rl[len(rl)-2]
        v2 = rl[len(rl)-3]
        ns1 = ns + abs(v-v2)
        ns2 = ns + abs(v-v1) + abs(v1-v2)
        return min(ns1,ns2)
    else:
        v1 = rl[len(rl)-2]
        v2 = rl[len(rl)-3]
        return min(calc(rl[:len(rl)-1],ns+abs(v-v1),True),calc(rl[:len(rl)-2],ns+abs(v-v2),False))

print(calc(l,0,False))


### FIXED CODE ###

N = int(input())
h = list(map(int, input().split()))
 
suml = [1e5 for i in range(N)]
suml[0] = 0
suml[1] = abs(h[1] - h[0])
 
for e in range(2, N):
    suml[e] = min(
        abs(h[e]-h[e-1]) + suml[e-1],
        abs(h[e]-h[e-2]) + suml[e-2],
    )
 
# print(suml)
print(suml[N-1])
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s,t = input().split()
    a,b = LI()
    d = {}
    d[s] = a
    d[t] = b
    u = input()
    d[u] -= 1
    print(d[s],d[t])
    return

#Solve
if __name__ == "__main__":
    solve()


### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s,t = LS()
    a,b = LI()
    u = S()
    d = defaultdict(lambda : 0)
    d[0] = a
    d[1] = b
    if s == u:
        d[0] -= 1
    else:
        d[1] -= 1
    print(d[0],d[1])
    return

#Solve
if __name__ == "__main__":
    solve()
while True :
      s= raw_input
      a, op, b = s.split()
      if op == ? : break
      print eval(s)


### FIXED CODE ###

while True:
  s = raw_input()
  a, op, b = s.split()
  if op == '?': break
  print eval(s)
s = input()

a = s[:2]
b = s[2:]

ans = 0

if a <= 12 and a >= 1:
    ans += 2

if b <= 12 and b >= 1:
  ans += 3
  
if ans == 0:
  print("NA")
elif ans == 2:
  print("MMYY")
elif ans == 3:
  print("MMYY")
elif ans == 5:
  print("AMBIGUOUS")


### FIXED CODE ###

s = input()
x = 0

sf = s[:2]
sl = s[2:]

if (int(sf[0]) == 0 and int(sf[1]) != 0):
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 0:
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 1:
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 2:
    x += 1


if (int(sl[0]) == 0 and int(sl[1]) != 0):
    x += 2

if int(sl[0]) == 1 and int(sl[1]) == 0:
    x += 2
if int(sl[0]) == 1 and int(sl[1]) == 1:
    x += 2
if int(sl[0]) == 1 and int(sl[1]) == 2:
    x += 2

b = x

if b == 0:
  print('NA')
elif b == 3:
  print('AMBIGUOUS')
elif b == 1:
  print('MMYY')
elif b == 2:
  print('YYMM')
a = input()
n, mod = divmod(a, 2)
print(n if mod == 0 else n + 1)

### FIXED CODE ###

a = input()
n, mod = divmod(int(a), 2)
print(n if mod == 0 else n + 1)
(n, x) = map(int, input().split())
l = list(map(int, input().split()))

count = 0
for i in range(n):
    if count > x:
        ans = i
        break
    elif i = n - 1:
        ans = n
        break
    else:
        count += l[i]
print(ans)

### FIXED CODE ###

n, x = map(int, input().split())
l = list(map(int, input().split()))

d = 0
ans = 0
for i in l:
    if d > x:
        break
    else:
        d += i
        ans += 1

if x >= sum(l):
    ans += 1

print(ans)
n,m=list(map(int,input().split()))
f=[set() for i in range(n)]

from collections import defaultdict

g=[set() for i in range(n)]

par=[i for i in range(n)]

def root(i):
    if par[i]==i:
        return i
    else:
        return root(par[i])

def unite(x,y):
    rx=root(x)
    ry=root(y)
    if rx!=ry:
        par[rx]=ry

def same(x,y):
    return root(x)==root(y)

for i in range(m):
    a,b=list(map(int,input().split()))
    # f[a-1].add(b-1)
    # f[b-1].add(a-1)
    a-=1
    b-=1
    unite(a,b)

ans=0
ro=defaultdict(int)
for i in range(n):
    ro[root(i)]+=1

print(max(ro.values()))

### FIXED CODE ###

n,m=list(map(int,input().split()))
par=[i for i in range(n)]
ro=dict()

for i in range(n):
    ro[i]=1
def root(i):
    if par[i]==i:
        return i
    else:
        a=root(par[i])
        par[i]=a
        return a

def unite(x,y):
    rx=root(x)
    ry=root(y)
    if rx!=ry:
        par[rx]=ry
        ro[ry]+=ro[rx]
        ro[rx]=0

for i in range(m):
    a,b=list(map(int,input().split()))
    a-=1
    b-=1
    unite(a,b)

print(max(ro.values()))
from numba import njit
import numpy as np
@njit
def main(n,a):
  k=60
  mp=np.zeros((k,k),np.int32)
  o=k//2
  ary=[]
  for i in range(n):
    b=list(a[i].split('.'))
    b.append('0')
    x=int(b[0])
    y=int((b[1]+'0'*9)[:9])
    x=x*pow(10,9)+y
    # x10^9
    cnt5=-9
    xx=x
    while xx>1:
      if xx%5==0:
        cnt5+=1
        xx//=5
      else:
        break
    cnt2=-9
    xx=x
    while xx>1:
      if xx%2==0:
        cnt2+=1
        xx//=2
      else:
        break
    #if 0<=cnt5+o<23 and 0<=cnt2+o<23:
    mp[cnt5+o,cnt2+o]+=1
    ary.append([cnt5+o,cnt2+o])

  ans=0
  for i in range(k-1,0,-1):
    for j in range(k):
      mp[j][i-1]+=mp[j][i]
  for i in range(k-1,0,-1):
    for j in range(k):
      mp[i-1][j]+=mp[i][j]
  for x,y in ary:
    if x>=o and y>=o:
      i=1
    else:
      i=0
    x-=o
    x*=-1
    x+=o
    y-=o
    y*=-1
    y+=o
    ans+=mp[x,y]-i
  print(ans//2)
  #mp[o,o]+=10
  #print(mp)

n=int(input())
a=np.array([input() for _ in range(n)])
main(n,a)



### FIXED CODE ###

def main(n,a):
  k=60
  mp=[[0]*k for _ in range(k)]
  o=k//2
  ary=[]
  for i in range(n):
    b=list(a[i].split('.'))
    b.append('0')
    x=int(b[0])
    y=int((b[1]+'0'*9)[:9])
    x=x*pow(10,9)+y
    # x10^9
    cnt5=-9
    xx=x
    while xx>1:
      if xx%5==0:
        cnt5+=1
        xx//=5
      else:
        break
    cnt2=-9
    xx=x
    while xx>1:
      if xx%2==0:
        cnt2+=1
        xx//=2
      else:
        break
    #if 0<=cnt5+o<23 and 0<=cnt2+o<23:
    mp[cnt5+o][cnt2+o]+=1
    ary.append([cnt5+o,cnt2+o])

  ans=0
  for i in range(k-1,0,-1):
    for j in range(k):
      mp[j][i-1]+=mp[j][i]
  for i in range(k-1,0,-1):
    for j in range(k):
      mp[i-1][j]+=mp[i][j]
  for x,y in ary:
    if x>=o and y>=o:
      i=1
    else:
      i=0
    x-=o
    x*=-1
    x+=o
    y-=o
    y*=-1
    y+=o
    ans+=mp[x][y]-i
  print(ans//2)
  #mp[o,o]+=10
  #print(mp)

n=int(input())
a=[input() for _ in range(n)]
main(n,a)
N, A, B = map(int, input().split())

res = 0

for n in range(N+1):
  if A <= sum([int(s) for s in str(n)]) <= B:
  res += n
  
print(res)

### FIXED CODE ###

N, A, B = map(int, input().split())
res = 0
for i in range(N+1):
    if A <= sum([int(s) for s in str(i)]) <= B:
        res += i
print(res)
ref = set[i for i in range(1,31)]
for i in range(28):
    ls.append(i)
print "".join(map(str, sorted(list(ref-set(ls)))))

### FIXED CODE ###

ref = [i for i in range(1,31)]
for i in range(28):
    ref.remove(int(raw_input()))
for i in ref:
    print i
N = int(input())
K = int(input())
print(N-K)

### FIXED CODE ###

N,K = map(int, input().split())
print(N-K+1)
from scipy.special import comb
from collections import defaultdict

n, p = map(int, input().split())
S = input().strip()

if p == 2 or p == 5:
    count = 0
    digits = '02468' if p == 2 else '05'
    for i, x in enumerate(S, 1):
        if x in digits:
            count += i
    print(count)
else:
    counter = [0]*p
    for i in range(n-1, -1, -1):
        counter[int(S[i:]) % p] += 1
    print(counter[0] + sum(int(comb(i, 2)) for i in counter))

### FIXED CODE ###

n, p = map(int, input().split())
if p in (2, 5):
  c = 0
  for i, x in enumerate(map(int, input()[::-1])):
    if x % p == 0:
      c += n-i
  print(c)
else:
  c = [0] * p
  y = 0
  t = 1
  for x in map(int, input()[::-1]):
    y = (y + t*x) % p
    c[y] += 1
    t = (10 * t) % p
  print(sum(i * (i-1) // 2 for i in c) + c[0])
from sys import stdin
from queue import PriorityQueue

PREFEC, CITIES = list(map(int, stdin.readline().split()))
pref = {str(key): PriorityQueue() for key in range(1, PREFEC+1)}
city = dict()
out = [0] * CITIES
for i in range(CITIES):
    p, c = stdin.readline().split()
    pref[p].put(c)
    dic = p + '0' + c
    city[dic] = i

for j in range(1, PREFEC+1):
    i = str(j)
    pref_index = 1
    while not pref[i].empty():
        si = pref[i].get()
        temp = i + '0' + si
        index = city[temp]
        sy = str(pref_index)
        p = i

        while len(p) != 6:
            p = '0' + p
        while len(sy) != 6:
            sy = '0' + sy

        out[index] = p + sy

        pref_index += 1

for o in out:
    print(o)

### FIXED CODE ###

from sys import stdin

x, y = list(map(int, stdin.readline().split()))
print(x + y//2)
n = int(input())
g = [[] for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    g[a].append([b,i])
ans = [None] * (n-1)

def dfs(now, color):
    cnt = 1
    for to, num in g[now]:
        if cnt == color:
            cnt += 1
        ans[num] = cnt
        dfs(to, cnt)
        cnt += 1
dfs(0, 0)
print(max(ans))
print(*ans, sep='\n')

### FIXED CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)

n = int(input())
g = [[] for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    g[a].append([b,i])
ans = [None] * (n-1)

def dfs(now, color):
    cnt = 1
    for to, num in g[now]:
        if cnt == color:
            cnt += 1
        ans[num] = cnt
        dfs(to, cnt)
        cnt += 1
dfs(0, 0)
print(max(ans))
print(*ans, sep='\n')
n = int(raw_input())
A = map(int, raw_input().split(" "))

c1 = collections.Counter(A[::2])
c2 = collections.Counter(A[1::2])

res = n
for i in c1:
    for j in c2:
        if i != j:
            res = min(res, n - c1[i] - c2[j])
print res


### FIXED CODE ###

import collections
n = int(raw_input())
A = map(int, raw_input().split(" "))

c1 = collections.Counter(A[::2]).most_common(2)
c2 = collections.Counter(A[1::2]).most_common(2)

res = n
for i, x in c1:
    for j, y in c2:
        if i != j:
            res = min(res, n - x - y)
        res = min(res, n - y)
        res = min(res, n - x)
print res
import copy
from statistics import mean, median,variance,stdev
N=int(input())
li = list(map(int,input().split()))

for i in range(0,N):
	li[i] = li[i] - i -1
a = []
d = copy.copy(li)
if len(li) %2 == 1:
    m = median(li)
    k = 0
    for j in range(0,N):
        k = k + abs(li[j]-m)
else:
    c = copy.copy(li)
    c.sort()
    o = []
    for i in range(c[len(c)//2],c[len(c)//2+1]):
        k = 0
        for j in range(N):
            k = k + abs(li[j]-i)
        o.append(k)
    k = min(o)
print(k)


### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
for i in range(0,len(a)):
    a[i] -= (i+1)
a.sort()
b = [ abs(x  - (a[n//2])) for x in a]
print(sum(b))
import math
while 1:
    e = int(input())
    if  e == 0 :break
    m = e
    for z in range(int(math.sqrt(e)) + 1):
        for y in range(int(math.sqrt(e))+ 1):
            if  e-y**2-z**3+y+z < 0 or e - y**2 -z**3 <0:break
            if m > e-y**2-z**3+y+z: m = e-y**2-z**3+y+z
    print(m)


### FIXED CODE ###

import math
while 1:
    e = int(input().strip())
    if e ==0:break
    m=e
    z =0
    while z**3 <= e:
        y = int(math.sqrt(e-z**3))
        x = e - y**2- z**3 
        if x < 0:break
        if m > x+y+z: m = x+y+z    
        z+=1
    print(m)
d,t,s = map(int,input().split())
if d/s<=t:
  print('Yes')
 else:
  print('No')


### FIXED CODE ###

d,t,s = map(int,input().split())
if d/s<=t:
  print('Yes')
else:
  print('No')
import sys
sys.setrecursionlimit(10**9)
Input = open('input.txt')
def input(): return Input.readline()
def mapint(): return map(int, input().split())

N, A, B, C = mapint()
Ls = [int(input()) for _ in range(N)]
ans = 10**18
def dfs(a, b, c, idx, magic):
    global ans
    if idx==N:
        if a==0 or b==0 or c==0:
            return
        magic -= 30
        magic += abs(A-a)
        magic += abs(B-b)
        magic += abs(C-c)
        ans = min(ans, magic)
        return
    nx = Ls[idx]
    dfs(a+nx, b, c, idx+1, magic+10)
    dfs(a, b+nx, c, idx+1, magic+10)
    dfs(a, b, c+nx, idx+1, magic+10)
    dfs(a, b, c, idx+1, magic)

dfs(0, 0, 0, 0, 0)
print(ans)

### FIXED CODE ###

N, A, B, C = map(int, input().split())

L = [int(input()) for _ in range(N)]

ans = []
def dfs(idx, a, b, c, mp10):
    if idx==N:
        if a and b and c:
            ans.append(abs(A-a)+abs(B-b)+abs(C-c)+mp10*10)
    else:
        dfs(idx+1, a, b, c, mp10)
        dfs(idx+1, a+L[idx], b, c, mp10+1)
        dfs(idx+1, a, b+L[idx], c, mp10+1)
        dfs(idx+1, a, b, c+L[idx], mp10+1)

dfs(0, 0, 0, 0, -3)

print(min(ans))
N=int(input())
ans=0
for i in range(N):
l,r=map(int,input().split())
ans+=r-l+1
print(ans)

### FIXED CODE ###

N=int(input())
ans=0
for i in range(N):
	l,r=map(int,input().split())
	ans+=r-l+1
print(ans)
# coding: utf-8
# Your code here!

import bisect
from collections import defaultdict
 
N, K = map(int, input().rstrip().split(' '))
X = sorted(list(map(int, input().rstrip().split(' '))))

i = bisect.bisect_left(X, 0)
X.insert(i, 0)

memo = defaultdict(lambda: defaultdict(lambda: -1))
 
def recursive(current_k, cost, i, left_i, right_i):
    if K == current_k:
        return cost
    if memo[current_k][i] != -1:
        return memo[current_k][i]
       
    left_cost = 1e10 
    if left_i >= 0:
        left_cost = recursive(current_k + 1, cost + X[i] - X[left_i], left_i, left_i - 1, right_i)
        
    right_cost = 1e10
    if right_i <= N:
        right_cost = recursive(current_k + 1, cost + X[right_i] - X[i], right_i, left_i, right_i + 1)
        
    min_cost = min(left_cost, right_cost)
    
    memo[current_k][i] = min_cost
    
    return min_cost
    
print(recursive(0, 0, i, i - 1, i + 1))


### FIXED CODE ###

# coding: utf-8
# Your code here!

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

min_cost = int(1e10)
for i in range(K, N+1):
    min_cost = min(min_cost, X[i-1] - X[i-K] + min(abs(X[i-1]), abs(X[i-K])))
    
print(min_cost)
d,t,s=map(int,input())
if(d/s<=t):
  print("YES")
else:
  print("NO")


### FIXED CODE ###

d,t,s=map(int,input().split())
if(d/s<=t):
  print("Yes")
else:
  print("No")