Harryxun/stf_run huggingface dataset:
import itertools
n=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
def bitsum(BIT,i):
  s=0
  while i>0:
    s+=BIT[i]
    i-=i&(-i)
  return s

def bitadd(BIT,i,x):
  while i<=2**n:
    BIT[i]+=x
    i+=i&(-i)
  return BIT

def tentou(X):
  ret=0
  BIT=[0]*256
  BIT.insert(0,0)
  for i1 in range(n):
    x=X[i1]+1
    ret+=i1-bitsum(BIT,x)
    bitadd(BIT,x,1)
  return ret
N=[int(i) for i in range(n)]
nn=2**n
ans=float("inf")
for _ in range(n//2+1):
  for com in itertools.combinations(N,2*_):
    i=0
    for ura in com:
      i+=2**ura
    E,O=[],[]
    for j in range(n):
      if i&(1<<j)==0:
        if j%2==0:
          E.append(A[j]*100+j)
        else:
          O.append(A[j]*100+j)
      else:
        if j%2==0:
          O.append(B[j]*100+j)
        else:
          E.append(B[j]*100+j)
    if len(E)!=(n+1)//2:
      continue
    else:
      E.sort()
      O.sort()

      chk=True
      C=[E[0]%100]
      prev=E[0]//100
      for i in range(1,n):
        ii=i//2
        if i%2==0:
          C.append(E[ii]%100)
          if E[ii]//100<prev:
            chk=False
            break
          else:
            prev=E[ii]//100
        else:
          C.append(O[ii]%100)
          if O[ii]//100<prev:
            chk=False
            break
          else:
            prev=O[ii]//100
    
    if chk:
      ans=min(ans,tentou(C))
print(-1 if ans==float("inf") else ans)



### FIXED CODE ###

import itertools
n=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
def bitsum(BIT,i):
  s=0
  while i>0:
    s+=BIT[i]
    i-=i&(-i)
  return s

def bitadd(BIT,i,x):
  while i<=64:
    BIT[i]+=x
    i+=i&(-i)
  return BIT

def tentou(X):
  ret=0
  BIT=[0]*64
  BIT.insert(0,0)
  for i1 in range(n):
    x=X[i1]+1
    ret+=i1-bitsum(BIT,x)
    bitadd(BIT,x,1)
  return ret
N=[int(i) for i in range(n)]
nn=2**n
ans=float("inf")
for _ in range(n//2+1):
  for com in itertools.combinations(N,2*_):
    i=0
    for ura in com:
      i+=2**ura
    E,O=[],[]
    for j in range(n):
      if i&(1<<j)==0:
        if j%2==0:
          E.append(A[j]*100+j)
        else:
          O.append(A[j]*100+j)
      else:
        if j%2==0:
          O.append(B[j]*100+j)
        else:
          E.append(B[j]*100+j)
    if len(E)!=(n+1)//2:
      continue
    else:
      E.sort()
      O.sort()

      chk=True
      C=[E[0]%100]
      prev=E[0]//100
      for i in range(1,n):
        ii=i//2
        if i%2==0:
          C.append(E[ii]%100)
          if E[ii]//100<prev:
            chk=False
            break
          else:
            prev=E[ii]//100
        else:
          C.append(O[ii]%100)
          if O[ii]//100<prev:
            chk=False
            break
          else:
            prev=O[ii]//100
    
    if chk:
      ans=min(ans,tentou(C))
print(-1 if ans==float("inf") else ans)
#!/snap/bin/pypy3

MEMO = dict()

def search(n, data):
    global MEMO

    if n in MEMO:
        return MEMO[n]
    else:
        if not n in data:
            MEMO[n] = 0
            return 0

        MEMO[n] = max(search(i, data) for i in data[n]) + 1
        return MEMO[n]


def main():
    N, M = map(int, input().split())
    data = dict()
    for _ in range(M):
        x, y = map(int, input().split())
        if x not in data:
            data[x] = [y]
        else:
            data[x].append(y)

    print(max(search(n, data) for n in range(1, N+1)))



if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/python3
import sys

MEMO = dict()

def search(n, data):
    global MEMO

    if n in MEMO:
        return MEMO[n]
    else:
        if not n in data:
            MEMO[n] = 0
            return 0

        MEMO[n] = max(search(i, data) for i in data[n]) + 1
        return MEMO[n]


def main():
    # sys.setrecursionlimit(65535)
    sys.setrecursionlimit(10**9)
    N, M = map(int, input().split())
    data = dict()
    for _ in range(M):
        x, y = map(int, input().split())
        if x not in data:
            data[x] = [y]
        else:
            data[x].append(y)

    print(max(search(n, data) for n in range(1, N+1)))



if __name__ == '__main__':
    main()
def p_c():
    N, M = map(int, input().split())
    switch = [0] * N
    light = [0] * (1 << M)
    light[0] = 1
    for i in range(M):
        for s in list(map(int, input().split()))[1:]:
            switch[s - 1] += (1 << i)

    all_value = 0
    for i, p in enumerate(map(int, input().split())):
        all_value += p << (M - i - 1)

    for i in range(N):
        next_light = light.copy()
        for j in range(len(light)):
            next_light[j ^ switch[i]] += light[j]
        light = next_light

    print(light[all_value])

p_c()

### FIXED CODE ###

def p_c():
    n, m = map(int, input().split())
    s = [list(map(int, input().split()))[1:] for _ in range(m)]
    *p, = map(int, input().split())
    b = []
    for _s in s:
        bit = 0
        for i in _s:
            bit += (1 << (i - 1))
        b.append(bit)
    ans = 0
    for i in range(1 << n):
        for j, k in enumerate(b):
            if bin(i & k).count("1") & 1 != p[j]:
                break
        else:
            ans += 1
    print(ans)
    
p_c()
def calc(c1,c2,c3,c4):
    return c1*10 + c2*50 + c3*100 + c4*500

def coindiff(p,c1,c2,c3,c4):
    n = c1+c2+c3+c4
    over = calc(c1,c2,c3,c4) - p
    n -= (over%50) // 10
    n -= (over%100) // 50
    n -= (over%500) // 100
    n -= over // 500
    return n

first = True
while True:
    N = int(input())
    if N == 0: break
    if first:
        first = False
    else:
        print('')
    c1,c2,c3,c4 = map(int,input().split())
    s1 = (N//10) % 5
    maxdiff = -9999999
    ans = None
    for n1 in range(s1,c1+1,5):
        for n2 in range(c2+1):
            rem2 = N - n1*10 - n2*50
            s3 = ((rem2-1)//100 + 1) % 5
            for n3 in range(s3,c3+1,5):
                rem3 = rem2 - n3*100
                n4 = max(0, (rem3-1)//500 + 1)
                d = coindiff(N,n1,n2,n3,n4)
                if d > maxdiff:
                    maxdiff = d
                    ans = {10:n1,50:n2,100:n3,500:n4}
    for k,v in sorted(ans.items()):
        if v == 0: continue
        print('{0} {1}'.format(k, v))

### FIXED CODE ###

first = True
while True:
    P = int(input())
    if P== 0: break
    if first:
        first = False
    else:
        print('')
    c1,c2,c3,c4 = map(int,input().split())
    v = c1*10 + c2*50 + c3*100 + c4*500
    n = c1 + c2 + c3 + c4
    ans = {}
    rem = v - P
    ans[10] = c1 - (rem//10) % 5
    ans[50] = c2 - (rem//50) % 2
    ans[100] = c3 - (rem//100) % 5
    ans[500] = c4 - rem//500
    for k,v in sorted(ans.items()):
        if v <= 0: continue
        print('{0} {1}'.format(k,v))
sum = 0

num = int(input())

for i in range(num) :
    money, currency = input().split()
    money = int(money)
    if currency == 'JPY' :
        sum += money
    else :
        sum += money * 380000

print(sum)

### FIXED CODE ###

sum = 0

num = int(input())

for i in range(num) :
    money, currency = input().split()
    money = float(money)
    if currency == 'JPY' :
        sum += money
    else :
        sum += money * 380000

print(sum)
def main():
    import sys
    input = sys.stdin.readline
    #n = int(input())
    #l = list(map(int, input().split()))
    '''
    A=[]
    B=[]
    for i in range():
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)'''

    #import bisect
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort()
    #print(a)

    bc=[]
    for i in range(m):
        B = list(map(int, input().split()))
        bc.append(B)
    bc.sort(key=lambda x: x[1])
    #print(bc)

    clis=[]
    for i in range(m)[::-1]:
        clis+=[bc[i][1]] for i in range(bc[i][0])
    #print(clis)
    ans=0
    le=len(clis)
    for i in range(n):
        #print(clis[i],a[i])
        if i<le and clis[i]>a[i]:
            ans+=clis[i]
        else:
            ans+=a[i]
        #print(ans)
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
bc=[list(map(int,input().split())) for _ in range(m)]
bc.sort(key=lambda x: x[1],reverse=True)
#print(bc)
cnt=0
for i in range(n):
    if bc[cnt][0]>0:
        if bc[cnt][1]>a[i]:
            a[i]=bc[cnt][1]
        bc[cnt][0]-=1
    else:
        cnt+=1
        if cnt==len(bc):
            break
        if bc[cnt][1]>a[i]:
            a[i]=bc[cnt][1]
        bc[cnt][0]-=1
    #print(cnt,bc,a)
print(sum(a))
t=input()
    print(t.replace("?","D"))

### FIXED CODE ###

t = input()
print(t.replace('?', 'D'))
#n:shinamono no kazu
#m:waribiki maisuu
import heapq

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

a=heaqp.heapify(list(map(lambda x : int(x)*(-1),input().split())))

for _ in range(m):
  minA=heapq.heappop(a)
  heapq.heappush(a,minA/2.0)
#print(a)
result=0
for item in a:
  result+=item*(-1)//1
  
print(int(result))


### FIXED CODE ###

#n:shinamono no kazu
#m:waribiki maisuu
import heapq

n,m=map(int,input().split())
a=list(map(lambda x:int(x)*(-1),input().split()))
#print(temp)
heapq.heapify(a)
for _ in range(m):
  minA=heapq.heappop(a)
  #print(minA)
  heapq.heappush(a,minA/2.0)
  #print(a)
#print(a)
result=0
for item in a:
  result+=item*(-1)//1
  
print(int(result))
import collections as col
from functools import reduce
from operator import add
n = int(input())

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

if len(set(v)) == 1:
    print(int(n / 2))
    exit()

odd = v[1::2]
even = v[0::2]

co = col.Counter(odd).most_common()
coli = list(co.values())
ce = col.Counter(even).most_common()
celi = list(ce.values())

cov = list(co.keys())
cev = list(ce.keys())

if cov[0] != cev[0]:
    a = reduce(add, coli[1:], 0)
    b = reduce(add, celi[1:], 0)
    print(n - coli[0] - coli[0])
else:
    # a1 = reduce(add, coli[1:], 0)
    # b1 = reduce(add, celi[2:], 0)
    # b1 = celi[0] + b1

    # a2 = reduce(add, coli[2:], 0)
    # b2 = reduce(add, celi[1:], 0)
    # a2 = a2 + coli[0]
    if len(coli) <= 1:
        coli.append(0)
    if len(celi) <= 1:
        celi.append(0)

    ans1 = n - coli[1] - celi[0]
    ans2 = n - coli[0] - celi[1]

    print(min(ans1, ans2))

### FIXED CODE ###

import collections as col
from functools import reduce
from operator import add
n = int(input())

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

if len(set(v)) == 1:
    print(int(n / 2))
    exit()

odd = v[1::2]
even = v[0::2]

co = col.Counter(odd).most_common()
ce = col.Counter(even).most_common()

if co[0][0] != ce[0][0]:
    print(n - co[0][1] - ce[0][1])
else:
    # a1 = reduce(add, coli[1:], 0)
    # b1 = reduce(add, celi[2:], 0)
    # b1 = celi[0] + b1

    # a2 = reduce(add, coli[2:], 0)
    # b2 = reduce(add, celi[1:], 0)
    # a2 = a2 + coli[0]
    if len(co) <= 1:
        co.append((0, 0))
    if len(ce) <= 1:
        ce.append((0, 0))

    ans1 = n - co[1][1] - ce[0][1]
    ans2 = n - co[0][1] - ce[1][1]

    print(min(ans1, ans2))
ｖa,b = [int(x) for x in input().split()]

if (a*b) % 2 == 0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a,b = [int(x) for x in input().split()]

if (a*b) % 2 == 0:
  print("Even")
else:
  print("Odd")
import sys
read=sys.stdin.read

n,a=map(int,read().spliitlines())

print(n**2-a)

### FIXED CODE ###

import sys
read=sys.stdin.read

n,a=map(int,read().splitlines())

print(n**2-a)
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit(0)
p = list(map(int, input().split()))
a = [i for i in range(1,101)]
b = list(set(a) - set(p))
for i in range(len(b)):
  if x <= b[i]:
    if abs(b[i-1]-x) <= abs(b[i]-x):
      print(b[i-1])
      exit(0)
    else:
      print(b[i])
      exit(0)
print(b[-1])

### FIXED CODE ###

x, n = map(int, input().split())
if n == 0:
  print(x)
  exit(0)
p = list(map(int, input().split()))
a = [i for i in range(201)]
b = sorted(list(set(a) - set(p)))
min_v = 1000
min_id = 0
for i in range(len(b)):
  if abs(x - b[i]) < min_v:
    min_v = abs(x - b[i])
    min_id = i
print(b[min_id])
S, T =input().split()
print(T+S)

### FIXED CODE ###

S, T =input().split()
print(T+S)
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
plus = np.array([A.count(n+1) for n in range(N)])
scores = plus+K-Q
result = [print('Yes') if score>0 else print('No') for score in scores]

### FIXED CODE ###

import collections
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
cs = collections.Counter(A)
for n in range(N):
    if cs[n+1] > Q-K:
        print('Yes')
    else:
        print('No')
A, B, T = map(int, input().split())
print((T//A)*B)20

### FIXED CODE ###

A, B, T = map(int, input().split())
print((T//A)*B)
N,M=map(int,input().split())
ac=[0]*N
wa=[0]*N

for i in range(M):
  p,s=input().split()
  if s=="WA" and ac[int(p)-1]==0:
    wa[int(p)-1]+=1
  elif s=="AC" and ac[int(p)-1]==0:
    ac[int(p)-1]+=1

penalty=[w(k) for k in [i for i,j in enumerate(ac) if j!=0]]    
print("%d %d" %())


### FIXED CODE ###

N,M=map(int,input().split())
ac=[0]*N
wa=[0]*N

for i in range(M):
  p,s=input().split()
  if s=="WA" and ac[int(p)-1]==0:
    wa[int(p)-1]+=1
  elif s=="AC" and ac[int(p)-1]==0:
    ac[int(p)-1]+=1

penalty=[wa[k] for k in [i for i,j in enumerate(ac) if j!=0]]    
print("%d %d" % (sum(ac),sum(penalty)))
while True:
    m, f, r = [int(i) for i in input().split()]

    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')

    elif total < 50 and r < 50:
        print('D')

    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

### FIXED CODE ###

while True:
    m, f, r = [int(i) for i in input().split()]
 
    if m == f == r == -1:
        break
 
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
 
    elif total < 50 and r < 50:
        print('D')
 
    elif total < 65:
        print('C')
 
    elif total < 80:
        print('B')
         
    else:
        print('A')
import itertools

import numpy as np

H, W, M = map(int, input().split())
HW = [list(map(int, input().split())) for _ in range(M)]
F = np.zeros([H, W], dtype=np.int64)

print("h")
"""
for h, w in HW:
    F[h - 1, w - 1] = 1

# 各方向の和を計算
A = np.sum(F, axis=0)
B = np.sum(F, axis=1)

maxA = np.max(A)
maxB = np.max(B)

# 最大値を取るindex
ind_A = np.arange(W)[A == maxA]
ind_B = np.arange(H)[B == maxB]

cnt = 0
ans = maxA + maxB
for h, w in itertools.product(ind_B, ind_A):
    if F[h, w] == 0:
        break

    cnt += 1
    if cnt == M:
        ans -= 1
        break
else:
    ans -= 1
print(ans)
"""


### FIXED CODE ###

import itertools

import numpy as np


def main():
    H, W, M = map(int, input().split())
    HW = [list(map(int, input().split())) for _ in range(M)]

    A = np.zeros(H, dtype=np.int64)
    B = np.zeros(W, dtype=np.int64)

    for h, w in HW:
        A[h - 1] += 1
        B[w - 1] += 1

    maxA = np.max(A)
    maxB = np.max(B)

    # 最大値を取るindex
    ind_A = np.arange(H)[A == maxA]
    ind_B = np.arange(W)[B == maxB]

    # 解の候補の数
    nn = len(ind_A) * len(ind_B)

    # Mより候補の数のほうが多いとok
    # 少ないときはM以下なので可算
    ans = maxA + maxB

    if nn <= M:
        for h, w in HW:
            if A[h - 1] == maxA and B[w - 1] == maxB:
                nn -= 1

    print(ans if nn else ans - 1)


main()
X,Y,Z,K=map(int,input().split())
A=sorted(list(map(int,input().split())),reverse=True)
B=sorted(list(map(int,input().split())),reverse=True)
C=sorted(list(map(int,input().split())),reverse=True)
import heapq
h=[]
chk=[0]*(X*Y*Z)
heapq.heappush(h,(-(A[0]+B[0]+C[0]),0,0,0))
for _ in range(K):
  ans,i,j,k=heapq.heappop(h)
  print(-ans)
  if i+1<X and chk[(i+1)*(Y*Z)+j*Z+k]==0:
    chk[(i+1)*(Y*Z)+j*Z+k]=1
    heapq.heappush(h,(-(A[i+1]+B[j]+C[k]),i+1,j,k))
  if j+1<Y and chk[i*(Y*Z)+(j+1)*Z+k]==0:
    chk[i*(Y*Z)+(j+1)*Z+k]=1
    heapq.heappush(h,(-(A[i]+B[j+1]+C[k]),i,j+1,k))
  if k+1<Z and chk[i*(Y*Z)+j*Z+k+1]==0:
    chk[i*(Y*Z)+j*Z+k+1]=1
    heapq.heappush(h,(-(A[i]+B[j]+C[k+1]),i,j,k+1))
  #print(h,chk)

### FIXED CODE ###

X,Y,Z,K=map(int,input().split())
A=sorted(list(map(int,input().split())),reverse=True)
B=sorted(list(map(int,input().split())),reverse=True)
C=sorted(list(map(int,input().split())),reverse=True)
ans=[]
for i in range(X):
  if i+1>K:
    break
  for j in range(Y):
    if (i+1)*(j+1)>K:
      break
    for k in range(Z):
      if (i+1)*(j+1)*(k+1)>K:
        break
      ans.append(A[i]+B[j]+C[k])
ans=sorted(ans,reverse=True)
for a in ans[:K]:
  print(a)
N = input()
if int(N[2])=7:
    print("Yes")
elif int(N[1])=7:
    print("Yes")
elif int(N[0])=7:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N = input()
if int(N[2])==7:
    print("Yes")
elif int(N[1])==7:
    print("Yes")
elif int(N[0])==7:
    print("Yes")
else:
    print("No")
s = input()
from collections import Counter
c = Counter(s)

flag = True
for v in c.values():
    if v%2!=0: flag = False
    
print('Yes' if bl else 'No')

### FIXED CODE ###

s = input()
from collections import Counter
c = Counter(s)

flag = True
for v in c.values():
    if v%2!=0: flag = False
    
print('Yes' if flag else 'No')
a,b,c=map(int,input())
k=int(input())
for i in range(1,k+1):
  if a>=b>=c or a>=c>=b:
    c=c*2
  elif b>=a>=c or b>=c>=a:
    c=c*2
  elif c>=b>a:
    c=c*2
  elif c>b==a:
    b=b*2
  elif c>a>=b:
    b=b*2
if c>b>a:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a,b,c=map(int,input().split())
k=int(input())
for i in range(1,k+1):
  if a>=b>=c or a>=c>=b:
    c=c*2
  elif b>=a>=c or b>=c>=a:
    c=c*2
  elif c>=b>a:
    c=c*2
  elif c>b==a:
    b=b*2
  elif c>a>=b:
    b=b*2
if c>b>a:
  print('Yes')
else:
  print('No')
SS = int(input())
S = (list(SS))
if "a" not in S:
    print("No")
else:
    if "b" not in S:
        print("No")
    else:
        if "c" not in S:
            print("No")
        else:
            print("Yes")

### FIXED CODE ###

SS = input()
S = (list(SS))
if "a" not in S:
    print("No")
else:
    if "b" not in S:
        print("No")
    else:
        if "c" not in S:
            print("No")
        else:
            print("Yes")
S = input()
K = int(input())

l = len(S)

MOD = 1000000007

dp = [[[0] * (l + 1) for _ in range(2)] for _ in range(l + 1)]

dp[0][False][0] = 1

for i in range(l):
    cur = int(S[i])

    for j in range(i + 1):
        for k in range(10):
            if k == 0:
                dp[i + 1][True][j] += dp[i][True][j]
            else:
                dp[i + 1][True][j + 1] += dp[i][True][j]
                
        for k in range(cur):
            if k == 0:
                dp[i + 1][True][j] += dp[i][False][j]
            else:
                dp[i + 1][True][j + 1] += dp[i][False][j]

        if cur == 0:
            dp[i + 1][False][j] += dp[i][False][j]
        else:
            dp[i + 1][False][j + 1] += dp[i][False][j]


print(dp[l][True][K] + dp[l][False][K])


### FIXED CODE ###

S = input()
K = int(input())

l = len(S)

MOD = 1000000007

# [桁数][未満][0でない数の合計数]
dp = [[[0] * (l + 1) for _ in range(2)] for _ in range(l + 1)]


# 初期化
dp[0][False][0] = 1

for i in range(l):
    cur = int(S[i])

    for j in range(i + 1):
        # true -> true
        for k in range(10):
            if k == 0:
                dp[i + 1][True][j] += dp[i][True][j]
            else:
                dp[i + 1][True][j + 1] += dp[i][True][j]

        # false -> true
        for k in range(cur):
            if k == 0:
                dp[i + 1][True][j] += dp[i][False][j]
            else:
                dp[i + 1][True][j + 1] += dp[i][False][j]

        # false -> false
        if cur == 0:
            dp[i + 1][False][j] += dp[i][False][j]
        else:
            dp[i + 1][False][j + 1] += dp[i][False][j]

if K > l:
    print(0)
else:
    print(dp[l][True][K] + dp[l][False][K])
a,b=map(int,input(),split())
print((a+b+1)//2)
        
        

### FIXED CODE ###

a,b=map(int,input().split())
print((a+b+1)//2)
t=list(input())
import math
n=int(math.ceil((len(t)+1)/2))
p=0
for i in range(1,n):
    for j in range(1,i):
        if t[2*i]==t[2*j]:
            p+=1
if p>0:
    print("NO")
else:
    print("YES")


### FIXED CODE ###

n=int(input())
t=input().split()
if len(set(t))==n:
    print("YES")
else:
    print("NO")
# -*- coding: utf-8 -*-

from sys import stdin

def load():
    n = int(stdin.readline())
    s = stdin.readline()
    q = int(stdin.readline())
    k = [int(x) for x in stdin.readline().split()]
    
    return (s, k)

def calc(s, ks):
    dmcmap = dmc(s)
    ans = [sum(dmcmap[:k]) for k in ks]
    print(*ans, sep='\n', flush=True)

def dmc(src):
    ret = [0 for _ in range(len(src))]

    dmap = [i for i, x in enumerate(src) if x == 'D']
    mmap = [i for i, x in enumerate(src) if x == 'M']
    cmap = [i for i, x in enumerate(src) if x == 'C']

    for d in dmap:
        for m in filter(lambda x: x > d, mmap):
            for c in filter(lambda x: x > m, cmap):
                ret[c-d] += 1
    return ret

stdin = open('data.txt')
s, ks = load()
calc(s,ks)

### FIXED CODE ###

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

import numpy as np
from sys import stdin

def load():
    n = stdin.readline()
    data = [int(x) for x in stdin.readline().split()]
    return (n,data)

def calc(n, data):
    d = np.asarray(data)
    m = d.mean()
    diff = np.abs(d - m)
    return diff.argmin()

n, data = load()
print(calc(n, data))
N = int(input())
D,X= list(map(int,input().split()))
A = [int(input()) for i  in range(N)]
nums = [ (D-1)//a + 1 for a in A]

print(sum(nums) + X)


### FIXED CODE ###

#a b = map(int,input().split())
a = [ int(input()) for i in range(4)]
#print(a)
print(min(a[:2]) + min(a[2:]))
S = input()
b = []
for i in range(len(S) - 1):
    if S[i:i + 2] == "01" or S[i:i + 2] == "10":
        b.append(len(S) - (i + 1) if i < len(S) // 2 else i + 1)

print(min(b))


### FIXED CODE ###

S = input()
b = []
for i in range(len(S) - 1):
    if S[i:i + 2] == "01" or S[i:i + 2] == "10":
        b.append(len(S) - (i + 1) if i < len(S) // 2 else i + 1)

print(min(b) if len(b) != 0 else len(S))
A, B, K = map(int, input().split())
S = list(range(A, B + 1))

ans = sorted(set(S[:K] + S[-K:]))
for a in ans:
    print(a)


### FIXED CODE ###

A, B, K = map(int, input().split())
SA = list(range(A, min(B, A + K)))
SB = list(range(max(A, B - K + 1), B + 1))

ans = sorted(set(SA + SB))
for a in ans:
    print(a)
n=int(input())
if n==1:
    print(n):
    exit()
i=2
for _ in range(9):
    i**=2
    if i==n:
        print(i)
        exit()
    elif i>n:
        print(i//2)
        exit()

### FIXED CODE ###

n=int(input())
for i in range(9):
    if n==2**i:
        print(n)
        exit()
    elif n<2**i:
        print(2**(i-1))
        exit()
n,m=map(int,input().split())
A=[[0,0] for i in range(m)] #ACしたか、WA数
AC=0
pen=0
for i in range(m):
    a,b=map(str,input().split())
    a=int(a)
    if b=="AC":
        A[a-1][0]=1
    elif b=="WA" and A[a-1]==0:
        A[a-1][1]+=1
for i in range(n):
    if A[i][0]==1:
        AC+=1
        pen+=A[i][1]
print(AC,pen)

### FIXED CODE ###

n,m=map(int,input().split())
A=[[0,0] for i in range(n)] #ACしたか、WA数
AC=0
pen=0
for i in range(m):
    a,b=map(str,input().split())
    a=int(a)
    if b=="AC":
        A[a-1][0]=1
    elif b=="WA" and A[a-1][0]==0:
        A[a-1][1]+=1
for i in range(n):
    if A[i][0]==1:
        AC+=1
        pen+=A[i][1]
print(AC,pen)
N = int(input())
A = []
XY = []
honest_count = []

for i in range(N):
    a = int(input())
    A.append(a)
    inter = []
    for x in range(a):
        xy = list(map(int,input().split()))
        inter.append(xy)
    XY.append(inter)

for i in range(2**N):
    pt = [0]*N
    ck = 1
    for j in range(N):
        if (i>>j)&1:
            pt[N-j-1]=1
    for k in range(N):
        if pt[k] ==1:
            for l in range(A[k]):
                if XY[k][l][1] != pt[XY[k][l][0] -1]:
    if ck == 1:
        honest_count.append(sum(pt))
print(max(honest_count))


### FIXED CODE ###

A, B, C = map(int, input().split())
if A+B+C > 21:
    print('bust')
else:
    print('win')