Harryxun/stf_run huggingface dataset:
n,k = map(int,input().split())
a = list(map(int,input().split()))
MOD = 10**9 + 7

ze = []
pl,mi = [],[]
for i in range(n):
    if a[i] < 0:
        ze.append((-a[i],1))
        mi.append(a[i])
    else:
        ze.append((a[i],0))
        pl.append(a[i])
        
ze.sort(reverse = True)
pl.sort(reverse = True)
mi.sort()

one = 0
for i in range(k):
    one += ze[i][1]
    
ans = 1
zero = k-one

if one % 2 == 0:
    for i in range(k):
        ans = ans * ze[i][0] % MOD
    print(ans)
        
elif len(pl) == 0:
    for i in range(k):
        ans = ans * mi[n-1-i] % MOD
    print(ans)
        
else:
    if (zero == len(pl) and one == len(mi)) or one == 0 or zero == 0:
        ak = [zero,one]
    elif (zero != len(pl) and one == len(mi)):
        ak = [zero+1,one-1]
    elif zero == len(pl) and one != len(mi):
        ak = [zero-1,one+1]
    else:
        if abs(mi[zero])/pl[one-1] >= pl[one]/abs(mi[zero-1]):
            ak = [zero+1,one-1]
        else:
            ak = [zero-1,one+1]
            
    ans = 1
    for i in range(ak[0]):
        ans = ans * pl[i] % MOD
    for i in range(ak[1]):
        ans = ans * mi[i] % MOD
        
    print(ans)

### FIXED CODE ###

from decimal import *

n,k = map(int,input().split())
a = list(map(int,input().split()))
MOD = 10**9 + 7

ze = []
pl,mi = [],[]
for i in range(n):
    if a[i] < 0:
        ze.append((-a[i],1))
        mi.append(a[i])
    else:
        ze.append((a[i],0))
        pl.append(a[i])
        
ze.sort(reverse = True)
pl.sort(reverse = True)
mi.sort()

one = 0
for i in range(k):
    one += ze[i][1]
    
ans = 1
zero = k-one

if one % 2 == 0:
    for i in range(k):
        ans = ans * ze[i][0] % MOD
    print(ans)
        
elif len(pl) == 0:
    for i in range(k):
        ans = ans * mi[n-1-i] % MOD
    print(ans)
        
else:
    if (zero == len(pl) and one == len(mi)) or len(pl) == 0 or len(mi) == 0:
        ak = [zero,one]
    elif (zero != len(pl) and one == len(mi)) or zero == 0:
        ak = [zero+1,one-1]
    elif zero == len(pl) and one != len(mi) or one == 0:
        ak = [zero-1,one+1]
    else:
        if Decimal(abs(mi[one]))/Decimal(pl[zero-1]) >= Decimal(pl[zero])/Decimal(abs(mi[one-1])):
            ak = [zero-1,one+1]
        else:
            ak = [zero+1,one-1]
            
    ans = 1
    for i in range(ak[0]):
        ans = ans * pl[i] % MOD
    for i in range(ak[1]):
        ans = ans * mi[i] % MOD
        
    print(ans)
print((int(input())**3)

### FIXED CODE ###

print((int(input())/3)**3)
import numpy as np

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

p_list = [int(n) for n in input().split()]

X_near = np.array(list(range(int(np.ceil(X - N/2)), int(np.floor(X + N/2)) + 1)))

remain_list = []

for i in X_near:
    if i not in p_list:
        remain_list.append(i)
        
remain_array = np.array(remain_list)
min_bool = np.abs(X - remain_array).min() == np.abs(X - remain_array)
print(remain_array[min_bool][0])

### FIXED CODE ###

import numpy as np
 
X,N = map(int,input().split())
p = input()
 
if N != 0:
    
    p_list = [int(n) for n in p.split()]
    
    X_near = np.array(list(range(int(np.ceil(X - N/2 - 1)), int(np.floor(X + N/2)) + 2)))
 
    remain_list = []
 
    for i in X_near:
        if i not in p_list:
            remain_list.append(i)
        
 
    remain_array = np.array(remain_list)
    min_bool = np.abs(X - remain_array).min() == np.abs(X - remain_array)
    print(remain_array[min_bool].min())
    
if N == 0:
    print(X)
a,b=map(int,input().split())
s=a*b*100
print(s//100)

### FIXED CODE ###

import decimal
a, b = input().split()
x=decimal.Decimal(a)
y=decimal.Decimal(b)
ans = int(x * y) 
print(ans)
mojiretsu = input()
lett = list(mojiretsu)
numlist = []
for i in lett:
    num = lett.count(i)
    numlist += [num]
jud = []
for i in numlist:
    if i%2 == 0:
        jud += ['Yes']
    else:
        jud += ['No']

anslist = [x for x in set(jud) if jud.count(x) > 1]

ans = anslist[0]

print(ans)



### FIXED CODE ###

mojiretsu = input()
lett = list(mojiretsu)
numlist = []
for i in lett:
    num = lett.count(i)
    numlist += [num]
jud = []
for i in numlist:
    if i%2 == 0:
        jud += ['Yes']
    else:
        jud += ['No']

anslist = [x for x in set(jud) if jud.count(x) > 1]
anslisT = [x for x in jud if jud.count(x) == 1]

if anslist == ['Yes']:
    print('Yes')
elif anslisT == ['Yes']:
    print('Yes')
else:
    print('No')
import math
N = int(input())
A = [chr(ord('a') + i) for i in range(26)]

if N <= 26:
    print(A[N-1])
    exit()

B = math.log(N, 26)
B = math.ceil(B)
#print(B)

C = [26]
for i in range(2, B):
        D = 26**i
        C.append(D)

#print(C[::-1])

ans = []
for i in C[::-1]:
    D = int(N // i)
    if D == 0:
        ans.append(A[N-1])
        print(''.join(ans))
    else:
#        print(D)
        ans.append(A[D-1])
        N %= i
#        print(N)


### FIXED CODE ###

N = int(input())

ans = ''
while N > 0:
    N -= 1#この行の意味が分からずに失敗した。今も分からない
    ans += chr(ord('a') + N % 26)
    N //= 26
print(ans[::-1])
A, B, C, D, E, F=map(int, input().split())
a=[]
for i in range(101):
    for j in range(101):
        for k in range(101):
            for l in range(101):
                x=100*A*i+100*B*j
                y=C*k+D*l
                if x+y>F or x==0 or y==0:
                    break
                if 100*y/(x+y)<=(E*100)/(100+E):
                    a.append([str(x+y),str(y)])
print(' '.join(sorted(a, key=lambda x: (100*int(x[1]))/int(x[0]) if int(x[0])!=0 else 0)[-1]))


### FIXED CODE ###

A, B, C, D, E, F=map(int, input().split())
a=[[str(100*A),'0']]
for i in range(101):
    for j in range(101):
        for k in range(101):
            for l in range(101):
                x=100*A*i+100*B*j
                y=C*k+D*l
                if x+y>F or x==0:
                    break
                if 100*y/(x+y)<=(E*100)/(100+E):
                    a.append([str(x+y),str(y)])
print(' '.join(sorted(a, key=lambda x: (100*int(x[1]))/int(x[0]) if int(x[0])!=0 else 0)[-1]))
import numpy as np
N = int(input())
S = [None]*5
for i in range(N):
    S[i] = input()

S_M = [S[i] for i in range(N) if S[i][0] == 'M']
S_A = [S[i] for i in range(N) if S[i][0] == 'A']
S_R = [S[i] for i in range(N) if S[i][0] == 'R']
S_C = [S[i] for i in range(N) if S[i][0] == 'C']
S_H = [S[i] for i in range(N) if S[i][0] == 'H']

souwa = 0
kahi = [0]*5
kahi[0] = len(S_M)
kahi[1] = len(S_A)
kahi[2] = len(S_R)
kahi[3] = len(S_C)
kahi[4] = len(S_H)

kahi_not0 = kahi[kahi != 0]
if len(kahi_not0) <= 2:
    print(0)
else:
    for i in range(len(kahi_not0)-2):
        for j in range(i+1, len(kahi_not0)-1):
            for k in range(j+1, len(kahi_not0)):
                souwa += kahi_not0[i]*kahi_not0[j]*kahi_not0[k]

    print(souwa)

### FIXED CODE ###

import numpy as np
N = int(input())
S = [None]*N
for i in range(N):
    S[i] = input()

S_M = [S[i] for i in range(N) if S[i][0] == 'M']
S_A = [S[i] for i in range(N) if S[i][0] == 'A']
S_R = [S[i] for i in range(N) if S[i][0] == 'R']
S_C = [S[i] for i in range(N) if S[i][0] == 'C']
S_H = [S[i] for i in range(N) if S[i][0] == 'H']

souwa = 0
kahi = [0]*5
kahi[0] = len(S_M)
kahi[1] = len(S_A)
kahi[2] = len(S_R)
kahi[3] = len(S_C)
kahi[4] = len(S_H)

for i in range(len(kahi)-2):
    for j in range(i+1, len(kahi)-1):
        for k in range(j+1, len(kahi)):
            souwa += kahi[i]*kahi[j]*kahi[k]
print(souwa)
t,x = map(int, input().split())
print(flost(t/x))

### FIXED CODE ###

t,x = map(int, input().split())
print(float(t/x))
a,b,c=map(int,input().split())
print(b*(t//a))

### FIXED CODE ###

a,b,c=map(int,input().split())
print(b*(c//a))
N=int(input())
list=[]
for i in range(1,10):
  for j in range(1,10):
    list.append(i*j)
if N in list:
   print("Yes")
 else:
   print("No")
    

### FIXED CODE ###

N=int(input())
list=[]
for i in range(1,10):
  for j in range(1,10):
    list.append(i*j)
if N in list:
   print("Yes")
else:
   print("No")
N = input()
numN = int(N)
S =0
for i in range(len(N)):
    S += int(N[i])
 
if nunN % S == 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N = input()
numN = int(N)
S =0
for i in range(len(N)):
    S += int(N[i])
 
if numN % S == 0:
    print('Yes')
else:
    print('No')
#

import sys
input=sys.stdin.readline

MOD=10**9+7
            
def main():
    N=int(input())
    A=list(map(int,input().split()))
    if N==1:
        print(1)
        exit()
    kl={}
    for j in range(N):
        n=A[j]
        for i in range(2,int((n)**0.5)+1):
            if n%i==0:
                cnt=0
                while(n%i==0):
                    n/=i
                    cnt+=1
                if kl.get(i,"a")=="a" or kl[i]<cnt:
                    kl[i]=cnt
        if n!=1:
            if kl.get(n,"a")=="a" or kl[n]<cnt:
                kl[n]=cnt
                
    lcm=1
    for a,b in kl.items():
        lcm*=a**b
        lcm%=MOD
    ans=0
    for i in range(N):
        ans+=lcm*pow(A[i],MOD-2,MOD)
        ans%=MOD
    print(ans)
    
    
    
if __name__=="__main__":
    main()


### FIXED CODE ###

#

import sys
from fractions import gcd
input=sys.stdin.readline

def main():
    MOD=10**9+7
    N=int(input())
    A=list(map(int,input().split()))
    if N==1:
        print(1)
        exit()
    l=(A[0]*A[1])//gcd(A[0],A[1])
    for i in range(2,N):
        l=(l*A[i])//gcd(A[i],l-A[i])
    l%=MOD
    ans=0
    for i in range(N):
        ans+=l*pow(A[i],MOD-2,MOD)
        ans%=MOD
    print(ans)
    
    
    
if __name__=="__main__":
    main()
n = int( input())
a = list ( map( int, input().split()))

a.sort()
    
print(a[int(n/2)+1]-a[int(n/2)])



  

### FIXED CODE ###

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

a.sort()
k = int(n/2)    
print(a[k]-a[k-1])
import sys

def answer():
    input = sys.stdin.readline
    M = int(input())

    part = ''
    for i in range(M):
        d, c = input().split()
        part += d * int(c)

    _round = 0
    while len(part) > 1:
        _round += 1
        # 和10以上を探索
        mt10 = 0
        for i in range(1, len(part)):
            s1 = part[-i]
            s2 = part[-i-1]
            if int(s1) + int(s2) >= 10:
                mt10 = - i - 1
                break

        if mt10 == 0:
            s1 = part[0]
            s2 = part[1]
            s3 = part[2:]
            part = str(int(s1) + int(s2)) + s3
        else:
            s1 = part[:mt10]
            s2 = part[mt10]
            s3 = part[mt10+1]
            s4 = ''
            if mt10 < -2:
                s4 = part[mt10+2:]
            part = s1 + str(int(s2)+int(s3)) + s4

    print(_round)


if __name__ == '__main__':
    answer()


### FIXED CODE ###

import sys

def answer():
    input = sys.stdin.readline
    M = int(input())

    Ds = [0] * M
    Cs = [0] * M
    total = 0

    for i in range(M):
        c, d = map(int, input().split())
        Cs[i] = c
        Ds[i] = d
        total += d * c

    digits = sum(Ds)

    ans = (digits-1) + (total-1) // 9

    print(ans)


if __name__ == '__main__':
    answer()
n,k=map(int,input().split())
s=input()
s = s[:k-1]+str(s[k]).lower()+s[k+1:]
print(s)

### FIXED CODE ###


n,k=map(int,input().split())
s=input()
k=k-1
s = s[:k]+str(s[k]).lower()+s[k+1:]
print(s)
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
  if l[i-1]<l[i]<l[i+1] or l[i+1]<l[i]<l[i-1]
   ans+=1 
 print(ans)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
  if l[i-1]<l[i]<l[i+1] or l[i+1]<l[i]<l[i-1]:
   ans+=1 
print(ans)
a, b, c = map(int, raw_input().split())
print int(b/c)-int(a/c+0.999)+1

### FIXED CODE ###

a, b, c = map(int, input().split())
print(int(b/c)-int(a/c+0.999)+1)
def isBingo(a):
    for i in range(3)
        if a[i][0] == a[i][1] and a[i][0] == a[i][2]:
            return 'Yes'
        elif a[0][i] == a[1][i] and a[i][0] == a[2][i]:
            return 'Yes'
    if a[0][0] == a[1][1] and a[0][0] == a[2][2]:
        return 'Yes'
    elif a[0][2] == a[1][1] and a[0][2] == a[2][0]:
        return 'Yes'
    else:
        return 'No'
    
a = []
for i in range(3):
    a.append(list(map(int, input().split())))
n = int(input())
b = []
for i in range(n):
    b.append(int(input()))

for i in range(n):
    for j in range(3):
        if b[i] in a[j]:
            a[j][a[j].index(b[i])] = -1

print(isBingo(a))

### FIXED CODE ###

def isBingo(a):
    for i in range(3):
        if a[i][0] == a[i][1] and a[i][0] == a[i][2] and a[i][0] == -1:
            return 'Yes'
        elif a[0][i] == a[1][i] and a[0][i] == a[2][i] and a[0][i] == -1:
            return 'Yes'
    if a[0][0] == a[1][1] and a[0][0] == a[2][2] and a[0][0] == -1:
        return 'Yes'
    elif a[0][2] == a[1][1] and a[0][2] == a[2][0] and a[0][2] == -1:
        return 'Yes'
    else:
        return 'No'
    
a = []
for i in range(3):
    a.append(list(map(int, input().split())))
n = int(input())
b = []
for i in range(n):
    b.append(int(input()))

for i in range(n):
    for j in range(3):
        if b[i] in a[j]:
            a[j][a[j].index(b[i])] = -1

print(isBingo(a))
#C
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))


result = [[1 for _ in range(n)] for _ in range(m)]
for i in range(m):
    a, b = list(map(int, input().split()))
    if h[a-1] < h[b-1]:
        result[i][b-1] = 1
        result[i][a-1] = 0
    elif h[a-1] > h[b-1]:
        result[i][b-1] = 0
        result[i][a-1] = 1
    else:
        result[i][b-1] = 0
        result[i][a-1] = 0

ans = [1 for _ in range(n)]
for i in range(m):
    for j in result:
        if 0 in j:
            ans[result.index(j)] = 0

print(ans.count(1))


### FIXED CODE ###

#C
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))


result = [1 for _ in range(n)]
for i in range(m):
    a, b = list(map(int, input().split()))
    if h[a-1] < h[b-1]:
        result[a-1] = 0
    elif h[a-1] > h[b-1]:
        result[b-1] = 0
    else:
        result[b-1] = 0
        result[a-1] = 0

print(result.count(1))
n = int(input())
abc = []
ans = 0

for i in range(5) :
    abc.append(int(input()))

minabc = min(abc)
ans += n//minabc

if x >= n :
    print(5)
else :
    print(5 + ans)

### FIXED CODE ###

n = int(input())
abc = []
ans = 0

for i in range(5) :
    abc.append(int(input()))

minabc = min(abc)
ans += n//minabc
if n % minabc != 0:
    ans += 1

if minabc >= n :
    print(5)
else :
    print(4 + ans)
n=int(input())
c=[int(input()) for _ in [0]*n]
l=[-1]*n
dp=[1]*n
l[c[0]]=0
mod=10**+9+7
for i in range(1,n):
	ci=c[i]
	if l[ci] not in [-1,i-1]:
		dp[i]=(dp[i-1]+dp[l[ci]])%mod
	else:
		dp[i]=dp[i-1]
	l[ci]=i
print(dp[n-1])

### FIXED CODE ###

n=int(input())
c=[int(input()) for _ in [0]*n]
l=[-1]*200001
dp=[1]*n
l[c[0]]=0
mod=10**+9+7
for i in range(1,n):
	ci=c[i]
	if l[ci] not in [-1,i-1]:
		dp[i]=(dp[i-1]+dp[l[ci]])%mod
	else:
		dp[i]=dp[i-1]
	l[ci]=i
print(dp[n-1])
a, b = input().split();
a = int(a);
b = int(b);

for x in range(1,101):
  tax_8 = int(x * 0.08);
  tax_10= int(x * 0.1);
  if tax_8 == a and tax_10 == b:
  	ans = x;
    break;
  elif x == 101:
    ans = -1;
  else:
    pass;
  
print(ans);
  

### FIXED CODE ###

a, b = input().split();
a = int(a);
b = int(b);

for x in range(1,1001):
  tax_8 = int(x * 0.08);
  tax_10= int(x * 0.1);
  if tax_8 == a and tax_10 == b:
    ans = x;
    break;
  elif x == 100:
    ans = -1;
  else:
    pass;
  
print(ans);
import collections
a = list(str(input()))
b = list(str(input()))
A = collections.Counter(a)
B = collections.Counter(b)
Asort = sorted(A.values())
Bsort = sorted(B.values())
if Asort.values() == Bsort.values():
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import collections
a = list(input())
b = list(input())
A = collections.Counter(a)
B = collections.Counter(b)
Alist = list(A.values())
Blist = list(B.values())
Asort = sorted(Alist)
Bsort = sorted(Blist)
if Asort == Bsort:
  print("Yes")
else:
  print("No")
import math
n = input()
a = list(map(int, input().split()))
flag = 0


for t in range(1000):

    for i,j in enumerate(a):
        if j%2 == 0:
            a[i] = j/2

        else:
            flag = 1
            break

    if flag == 1:
        break

print(t)


### FIXED CODE ###

print(input().count("1"))
n = int(input())

sayTable = []
for i in range(n):
	a = int(input())
	
	sayArray = []
	for j in range(a):
		x, y = [int(v) for v in input().split()]
		sayArray.append((x-1, y+1))
	sayTable.append(sayArray)

def count(honest):
	count = 0
	for v in honest:
		if v == 2:
			count += 1
	return count

def checkHonest(sayArray, honest):
	for x, y in sayArray:
		if y == 2 and honest[x] != 2:
			return False
	return True

def checkHonestAll(sayTable, honest):
	for i in range(n):
		h = honest[i]
		if h != 2:
			continue
        sayArray = sayTable[i]
		for x, y in sayArray:
			if y != honest[x]:
				return False
	return True

def setHonest(sayArray, honest):
	for x, y in sayArray:
		honest[x] = y

def search(sayTable, honest, i):
	if i >= n;
		if checkHonestAll(sayTable, honest):
			return count(honest)
		else:
			return 0

	count = 0
	h = honest[i]
    sayArray = sayTable[i]
	if (h == 0 or h == 2) and checkHonest(sayArray, honest):
		copyHonest = honest[:]
		setHonest(sayArray, copyHonest)
		copyHonest[i] = 2
		c = search(sayTable, copyHonest, i+1)
		if count < c:
			count = c

	honest[i] = 1
	c = search(sayTable, honest, i+1)
	if count < c:
		count = c
	return count

print(search(sayTable, [0] * n, 0));


### FIXED CODE ###

n = int(input())

sayTable = []
for i in range(n):
	a = int(input())
	
	sayArray = []
	for j in range(a):
		x, y = [int(v) for v in input().split()]
		sayArray.append((x-1, y+1))
	sayTable.append(sayArray)

def countHonest(honest):
	count = 0
	for v in honest:
		if v == 2:
			count += 1
	return count

def checkHonest(sayArray, honest):
	for x, y in sayArray:
		if honest[x] == 0:
				continue
		if y == 2 and honest[x] != 2:
			return False
	return True

def checkHonestAll(sayTable, honest):
	for i in range(n):
		h = honest[i]
		if h != 2:
			continue
		sayArray = sayTable[i]
		for x, y in sayArray:
			if y != honest[x]:
				return False
	return True

def setHonest(sayArray, honest):
	for x, y in sayArray:
		honest[x] = y

def search(sayTable, honest, i):
	if i >= n:
		if checkHonestAll(sayTable, honest):
			return countHonest(honest)
		else:
			return 0

	count = 0
	h = honest[i]
	sayArray = sayTable[i]
	if (h == 0 or h == 2) and checkHonest(sayArray, honest):
		copyHonest = honest[:]
		setHonest(sayArray, copyHonest)
		copyHonest[i] = 2
		c = search(sayTable, copyHonest, i+1)
		if count < c:
			count = c

	honest[i] = 1
	c = search(sayTable, honest, i+1)
	if count < c:
		count = c
	return count

print(search(sayTable, [0] * n, 0))
mod = 1000000007
n,m = map(int,input().split())

a = []
for _ in range(m):
    tmp = int(input())
    a.append(tmp)
a = set(a)

dp = [0] * 10**5
dp[0] = 1

for i in range(1,n+1):
    if i in a:
        continue
    dp[i] = dp[i-1]
    if i > 1:
        dp[i] = (dp[i-1] + dp[i-2])%mod

print(dp[n]%mod)

### FIXED CODE ###

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

a = []
for _ in range(m):
    tmp = int(input())
    a.append(tmp)
a = set(a)

dp = [0] * (10**5 + 7)
dp[0] = 1

for i in range(1,n+1):
    if i in a:
        continue
    dp[i] = dp[i-1]
    if i > 1:
        dp[i] = (dp[i-1] + dp[i-2])%mod

print(dp[n]%mod)
# -*- coding: utf-8 -*-
from heapq import heapify, heappop, heappush
from collections import defaultdict
from itertools import accumulate
import sys
input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

H, W = inpl()
A = [inpl() for _ in range(H)]
B = [inpl() for _ in range(W)]

DP = [[[0]*25601 for _ in range(W+1)] for _ in range(H+1)]
DP[0][0][12800] = 1

for h in range(H):
    for w in range(W):
        d = A[h][w] - B[h][w]
        for i in range(25601):
            if DP[h][w][i] == 1:
                DP[h+1][w][i+d] = 1
                DP[h+1][w][i-d] = 1
                DP[h][w+1][i+d] = 1
                DP[h][w+1][i-d] = 1
for i in range(12800):
    if DP[-1][-2][12800+i] | DP[-1][-2][12800-i]:
        print(i)
        break

### FIXED CODE ###

def inpl(): return list(map(int, input().split()))

H, W = inpl()
A = [inpl() for _ in range(H)]
B = [inpl() for _ in range(H)]

DP = [[0 for _ in range(W+1)] for _ in range(H+1)]
DP[0][0] = 1 << 12800

for h in range(H):
    for w in range(W):
        d = abs(A[h][w] - B[h][w])
        DP[h+1][w] |= DP[h][w] >> d
        DP[h+1][w] |= DP[h][w] << d
        DP[h][w+1] |= DP[h][w] >> d
        DP[h][w+1] |= DP[h][w] << d
l = 1 << 12800
r = 1 << 12800
for i in range(12801):
    if (DP[-1][-2]& l) | (DP[-1][-2] & r):
        print(i)
        break
    l = l << 1
    r = r >> 1
x,y=map(int,input().split())
print(2*y-x)

### FIXED CODE ###

x=int(input())
y=int(input())
print(2*y-x)
N, A, B = map(int,input().split())
re = ''
while len(re)<N:
    re+='b'*A
    re+='r'*B

print(re[:N].count('b'))

### FIXED CODE ###

N, A, B = map(int,input().split())
a = N//(A+B)
b = N%(A+B)
if b>A:
    print(A*a+A)
else:
    print(A*a+b)
n=int(input())
d=[]
if n>=4:
  for i in range(4):
    d.append(list(map(int,input().split())))
else:
  d=[list(map(int,input().split())) for i in range(n)]
  
for Cx in range(101):
  for Cy in range(101):
    k=0
    if n>=2:
      for i in range(n-1):
        if d[i][2]+abs(d[i][0]-Cx)+abs(d[i][1]-Cy) != d[i+1][2]+abs(d[i+1][0]-Cx)+abs(d[i+1][1]-Cy):
          k=1
      if k==0:
        print(Cx,Cy,d[i][2]+abs(d[i][0]-Cx)+abs(d[i][1]-Cy))
      
        

### FIXED CODE ###

n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
xyh.sort(key=lambda x:x[2], reverse=True)

ansh=-1
ans=[[]]
flag=True
for cx in range(0,101):
  if flag==False:
    break
    
  for cy in range(0,101):
    ansh = 0
    for pira in xyh:
      if ansh==0:
        ansh=pira[2]+(abs(cx-pira[0])+abs(cy-pira[1]))
        ans[0]=[cx,cy,ansh]
        
      elif len(ans[0])>0 and max(ansh -(abs(cx-pira[0])+abs(cy-pira[1])), 0) != pira[2]:
        ans[0]=[]
    if len(ans[0])>0:
      flag=False
      break
print(*ans[0])
a=int(input().split(" "))
print(a[0]*a[1])

### FIXED CODE ###

a=input().split(" ")
print(int(a[0])*int(a[1]),2*int(a[0])+2*int(a[1]))
N=int(input())
t=[0]*N
r=set(range(N))
for _ in[0]*N:
 x,y,z=list(map(int,input().split()))
 t[x]=[y,z]+[0]*2+[(l!=-1)+(r!=-1)]+[0]*2
 r-={y,z}
def f(i,p,s,d):
 if i<0:return-1
 l,r=t[i][:2]
 t[i][2:]=[p,s,t[i][4],d,max(f(l,i,r,d+1),f(r,i,l,d+1))+1]
 return t[i][-1]
f(r.pop(),-1,-1,0)
for i in range(N):
 print('node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, {}'.format(i,*t[i][2:],'root'if not t[i][5]else'internal node'if t[i][4]else'leaf'))


### FIXED CODE ###

N=int(input())
t=[0]*N
r=set(range(N))
for _ in[0]*N:
 x,y,z=map(int,input().split())
 t[x]=[y,z]+[0]*5
 r-={y,z}
def f(i,p,s,d):
 if i<0:return-1
 k=t[i]
 l,r=k[:2]
 k[2:]=[p,s,(l!=-1)+(r!=-1),d,max(f(l,i,r,d+1),f(r,i,l,d+1))+1]
 return t[i][-1]
f(r.pop(),-1,-1,0)
for i in range(N):
 print('node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, {}'.format(i,*t[i][2:],'root'if not t[i][5]else'internal node'if t[i][4]else'leaf'))
import math
#N=int(input())
#考えるべき範囲
ans=11
#絶対ありえない数を定義しておく
for i in range(1,int(math.sqrt(N))+1):
    if N%i !=0:
        continue
    else:
        A=N//i
        A=str(A)
        i=str(i)
        F=max(len(A),len(i))
        if F<ans:
            ans=F

print(ans)
        

### FIXED CODE ###

import math
N=int(input())
#考えるべき範囲
ans=11
#絶対ありえない数を定義しておく
for i in range(1,int(math.sqrt(N))+1):
    if N%i !=0:
        continue
    else:
        A=N//i
        A=str(A)
        i=str(i)
        F=max(len(A),len(i))
        if F<ans:
            ans=F

print(ans)
x = list(map(int,input().split()))
for i in range(len(x)):
  if x[i] == 0:
    print(i+!)
    break

### FIXED CODE ###

x = list(map(int,input().split()))
for i in range(len(x)):
  if x[i] == 0:
    print(i+1)
    break
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

ans = 0
min_diff = 10*5
for i in range(N):
  if abs((T - H*0.006) - A) < min_diff:
    ans = i+1
print(ans)

### FIXED CODE ###

N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

ans = 0
min_diff = 10**5
for i in range(N):
  if abs((T - H[i]*0.006) - A) < min_diff:
    ans = i+1
    min_diff = abs((T - H[i]*0.006) - A)
print(ans)