Harryxun/stf_run huggingface dataset:
m=int((input().count("o"))
print(str(700+m*100))

### FIXED CODE ###

m=input().count("o")
print(700+m*100)
N = int(input())
A = list(map(int,input().split()))

check = True
for i in range(A):
  if A.count(A[i]) > 1:
    check = False
    
print("Yes" if check else "No")

### FIXED CODE ###

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

check = True
for i in range(N-1):
  if A[i] == A[i+1]:
    check = False
    
print("YES" if check else "NO")
N=input()
lenN=len(N)
N=int(N)

else:
    count=0
    loop=0
    while(1):
        if N<(10*5**loop) or N%(10*5**loop)!=0:
            break
        else:
            count+=N//(10*5**loop)
            loop+=1
            print(count)

### FIXED CODE ###

N=input()
lenN=len(N)
N=int(N)




if N%2==1 or N<10:
    print(0)
else:
    count=0
    loop=0
    while(1):
        if N<(10*5**loop):
            break
        else:
            count+=N//(10*5**loop)
            loop+=1
    print(count)
ls = list(map(int,input().split()))
n = ls[0]
a = ls[1]
b = ls[2]
c = 0

for i in n:
  s = sum(list(str(i)))
  c ++ 1 if s >= a and s <= b
  
print(c)

### FIXED CODE ###

ls = list(map(int,input().split()))
n = ls[0]
a = ls[1]
b = ls[2]
r = 0

for i in range(1, n+1):
  s = sum(list(map(int, list(str(i)))))
  if s >= a and s <= b:
    r += i
  
print(r)
import numpy as np

def is_prime(n):
    nmax = np.sqrt(n)
    nmax = nmax.astype(np.int64) + 1
    for i in range(2, nmax):
        if(n%i)==0:
            return False
    return True

def pf(n):
    sn = np.sqrt(n).astype(np.int64) + 1
    ps = []
    for i in range(1, sn):
        if (n%i)==0:
            ps.append(i)
            ps.append(int(n/i))
    del ps[0]
    return ps        

n = int(input())
ps = []
num = pf(n)
for i in num:
    if is_prime(i):
        ps.append(i)
        
zs = []        
for p in ps:
    z = p
    while(z<=n):
        zs.append(z)
        z *= p
zs.sort()
cnt = 0
for z in zs:
    if(n>1):
        if(n%z==0):
            n /= z
            cnt += 1
print(cnt)

### FIXED CODE ###

import math

def is_prime(n):
    if n==1:
        return False
    nmax = int(math.sqrt(n)) + 1
    for i in range(2, nmax):
        if(n%i)==0:
            return False
    return True

def pf(n):
    sn = int(math.sqrt(n)) + 1
    ps = []
    for i in range(1, sn):
        if (n%i)==0:
            ps.append(i)
            ps.append(int(n/i))
    del ps[0]
    return ps        

n = int(input())
ps = []
num = pf(n)
for i in num:
    if is_prime(i):
        ps.append(i)
        
zs = []        
for p in ps:
    z = p
    while(z<=n):
        zs.append(z)
        z *= p
zs.sort()

cnt = 0
for z in zs:
    if(n>1):
        if(n%z==0):
            n /= z
            cnt += 1
print(cnt)
s=input()
k=int(input())
X=[]
for i in range(len(s)-4):
    X.append(s[i:i+5])
X.append(s[len(s)-4:len(s)])
X.append(s[len(s)-3:len(s)])
X.append(s[len(s)-2:len(s)])
X.append(s[len(s)-1:len(s)])
    
X.sort()
C=[]
for x in X[:k]:
    for j in range(len(x)):
        C.append(x[:j+1])
        
C=list(set(C))

C.sort()

print(C[k-1])

### FIXED CODE ###

s=input()
k=int(input())
X=[]
for i in range(len(s)):
    for j in range(k):
        X.append(s[i:i+j+1])
X=list(set(X))

X.sort()

print(X[k-1])
# -*- coding: utf-8 -*-
a,b = map(int,input().split())

"""
if b < 10:
    number = 10 * a + b
if 10 <= b < 100:
    number = 100 * a + b
if b == 100:
    number = 1000 * a + b
"""

number = 10 ** len(b) * a + b

ans = "No"
for i in range(101):
    if i * i == number:
        ans = "Yes"

print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-
a,b = map(int,input().split())

"""
if b < 10:
    number = 10 * a + b
if 10 <= b < 100:
    number = 100 * a + b
if b == 100:
    number = 1000 * a + b
"""

number = 10 ** len(str(b)) * a + b

ans = "No"
"""
for i in range(4, 101):
    if i ** 2 == number:
        ans = "Yes"
"""

if number ** 0.5 == int(number ** 0.5):
    ans = "Yes"

print(ans)
s=list(map(int,list(input())))
# s[0]=1,s[-1]=0,s[k]=s[n-k-1]は必要
def main(s):
  n=len(s)
  if s[0]!=1 or s[-1]!=0:return [-1]
  for k in range(n//2-1):
    if s[k]!=s[n-k-2]:return [-1]
  uv=[(1,2)]
  t=2
  i=3
  for x in s[1:-1]:
    uv.append((t,i))
    if x==1:
      t=i
    i+=1
  return uv
for x in main(s):
  print(*x,sep=' ')


### FIXED CODE ###

s=list(input())
n=len(s)
if s[0]=='0' or s[-1]=='1':
  print(-1)
else:
  s.pop()
  sr=s.copy()
  sr.reverse()
  if s!=sr:
    print(-1)
  else:
    ans=[]
    now=1
    cnt=1
    for x in s:
      if x=='1':
        ans.append([now,now+cnt])
        now+=cnt
        cnt=1
      else:
        ans.append([now,now+cnt])
        cnt+=1
    for x in ans:
      print(x[0],x[1])
al = list(map(int, raw_input().split())).sort()
print(al[0],al[1],al[2])

### FIXED CODE ###

al = list(map(int, input().split()))
al = sorted(al)
print(al[0],al[1],al[2])
N = int(input())

ans = N
for A in range(1,N):
    B = N - A
    A_str = str(A)
    B_str = str(B)
    A_li = [int(A_str[i]) for i in len(A_str)]
    B_li = [int(B_str[i]) for i in len(B_str)]
    s = sum(A_li) + sum(B_li)
    if s < ans:
        ans = s

print(ans)

### FIXED CODE ###

N = int(input())

ans = N
for A in range(1,N):
    B = N - A
    A_str = str(A)
    B_str = str(B)
    A_li = [int(A_str[i]) for i in range(len(A_str))]
    B_li = [int(B_str[i]) for i in range(len(B_str))]
    s = sum(A_li) + sum(B_li)
    if s < ans:
        ans = s

print(ans)
A, B, K = map(int, input().split())
while K > 0:
  if A > 0:
    A = A - 1
    K = K - 1
  elif A == 0 and B > 0:
    B = B - 1
    K = K - 1

print(str(A) + " " + str(B))

### FIXED CODE ###

S, T = map(str, input().split())
print(T+S)
# A の合計/4での区切り±2を探索

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

S = sum(A)
M = S // 4
C = A.copy()

k   = 1
XYZ = []

for n in range(N):
    if n == 0:
        pass
    else:
        C[n] = C[n] + C[n-1]
    if C[n] > k * M:
        XYZ.append(n)
        k += 1

XYZ = XYZ[:3]

X = [XYZ[0]] + [XYZ[0] + i for i in [-2, -1, 1, 2] if 0 <= XYZ[0] + i and XYZ[0] + i <= N-1]
Y = [XYZ[1]] + [XYZ[1] + i for i in [-2, -1, 1, 2] if 0 <= XYZ[1] + i and XYZ[1] + i <= N-1]
Z = [XYZ[2]] + [XYZ[2] + i for i in [-2, -1, 1, 2] if 0 <= XYZ[2] + i and XYZ[2] + i <= N-1]
R = []

for x in X:
    for y in Y:
        for z in Z:
            if x < y and y < z:
                PQRS = [C[x], C[y] - C[x], C[z] - C[y], S - C[z]]
                R.append(max(PQRS) - min(PQRS))
            else:
                pass

print(min(R))


### FIXED CODE ###

# 解説みて実装
import numpy as np


N = int(input())
A = list(map(int, input().split()))
C = np.cumsum(A).tolist()

LL = [np.inf] * N
LR = [np.inf] * N

l = 0

for m in range(N-1):
    if l < m:
        LL[m] = C[l]
        LR[m] = C[m] - C[l]
        while l < m:
            LL_tmp = C[l+1]
            LR_tmp = C[m] - C[l+1]
            if abs(LL[m] - LR[m]) >= abs(LL_tmp - LR_tmp):
                l    += 1
                LL[m] = C[l]
                LR[m] = C[m] - C[l]
            else:
                break

B = A[::-1]
D = np.cumsum(B).tolist()

RL = [np.inf] * N
RR = [np.inf] * N

r = 0

for m in range(N-1):
    if r < m:
        RR[m] = D[r]
        RL[m] = D[m] - D[r]
        while r < m:
            RR_tmp = D[r+1]
            RL_tmp = D[m] - D[r+1]
            if abs(RR[m] - RL[m]) >= abs(RR_tmp - RL_tmp):
                r    += 1
                RR[m] = D[r]
                RL[m] = D[m] - D[r]
            else:
                break

RR = RR[::-1]
RL = RL[::-1]

X = np.array([LL[:-1], LR[:-1], RL[1:], RR[1:]])[:, 1:-1]

print(int(np.min(np.abs(np.max(X, axis=0) - np.min(X, axis=0)))))
def f10():
    N, M, X=map(int, input().split())
    A=[int(i)-1 for i in input().split()]
    X = X-1
    s=sum(A[i]<X for i in A)
    print(min(s, M-s))

def main():
    f10()

main()

### FIXED CODE ###

def f10():
    N, M, X=map(int, input().split())
    A=[int(i)-1 for i in input().split()]
    X = X-1
    s=sum(A[i]<X for i in range(len(A)))
    print(min(s, M-s))

def main():
    f10()

main()
n=int(input())
for i in range(n):
   n[1]=n[i]
   s=sum(n)
   m=min(n)
   ma=max(n)
   print(m,ma,s)


### FIXED CODE ###

n=int(input())
r=input().split()
for i in range(len(r)):
    r[i]=int(r[i])
s=sum(r)
m=min(r)
ma=max(r)
print(m,ma,s)
while 1:
 n, x = map(int, input().split())
 if n == 0 and x == 0:
  break
 counter = 0
 for a in range(3, n+1):
  for b in range(2, n-1):
   if b > a:
    break
   for c in range(1, n-2):
    if c > b:
     break
    if a+b+c == x
     counter += 1
 print(counter)
  

### FIXED CODE ###

while 1:
 n, x = map(int, input().split())
 counter = 0
 if n == 0 and x == 0:
  break
 # y + (y-1) + (y-2) = x 
 y = (x+3) // 3
 for a in range(y, n+1):
  for b in range(2, a):
   if (x-a-b) > 0 and (x-a-b) < b:
    counter += 1
 print(counter)
n=input()
k=input()
sum=0
for i in range(1,k+1):
    a=list(str(i))
    if list.count(0)=k:
        sum+=1
print(sum)   

### FIXED CODE ###

n=input()
k=int(input())
m=len(n)
dp=[[[0]*(k+1) for _ in range(2)] for _ in range(m+1)]
dp[0][0][0]=1
for i in range(1,m+1):
    l = int(n[i-1])
    for j in range(k+1):
        dp[i][1][j]+=dp[i-1][1][j] 
        if l!=0:
            dp[i][1][j]+=dp[i-1][0][j]  
        else:
            dp[i][0][j]+=dp[i-1][0][j]      
        if j-1>=0:
            dp[i][1][j]+=9*dp[i-1][1][j-1]
            if l!=0:
                dp[i][0][j]+=dp[i-1][0][j-1]
                dp[i][1][j]+=(l-1)*dp[i-1][0][j-1]
print(dp[m][0][k]+dp[m][1][k])
N,K=map(int,input().split())
h=list(map(int,input().split()))
s=0
for i in h:
  s+=1 if i => K else 0
print(s)

### FIXED CODE ###

N,K=map(int,input().split())
h=list(map(int,input().split()))
s=0
for i in h:
  s+=1 if i >= K else 0
print(s)
n = int(input())
a_list = [int(x) for x in input().split()]

node = 1
flg = False
node_list = [node]

for i in range(len(a_list)-1):
  num = a_list[i]
  next = node-num
  if next < 0:
    flg = True
    break
  node = next*2
  node_list.append(node)

if node - a_list[-1] < 0:
  flg = True

diff = a_list[-1]
res_list = [a_list[-1]]
for i in range(len(a_list)-2,-1,-1):
  v = node_list[i] - a_list[i] # 枝の数
  diff = min(diff,v) + a_list[i]
  res_list.append(diff)

if flg:
  print(-1)
else:
  print(sum(res_list))

### FIXED CODE ###

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

node = 1
flg = False
node_list = [node]

for i in range(len(a_list)-1):
  num = a_list[i]
  next = node-num
  if next < 0:
    flg = True
    break
  node = next*2
  node_list.append(node)

if node - a_list[-1] < 0:
  flg = True
else:
  diff = a_list[-1]
  res_list = [a_list[-1]]
  for i in range(len(a_list)-2,-1,-1):
    v = node_list[i] - a_list[i] # 枝の数
    diff = min(diff,v) + a_list[i]
    res_list.append(diff)

if flg:
  print(-1)
else:
  print(sum(res_list))
L, N = map(int, input().split())
S = [input() for _ in range(N)]
S.sort()
print("".join(S))


### FIXED CODE ###

N, L = map(int, input().split())
S = [input() for _ in range(N)]
S.sort()
print("".join(S))
n = int(input())
for i in range(1,n+1):
    if len(str(i)) % 2 == 1:
        ans += 1
print(ans)


### FIXED CODE ###

n = int(input())
ans = 0
for i in range(1,n+1):
    if len(str(i)) % 2 == 1:
        ans += 1
print(ans)
s = int(input())
is s == 3 or s == 5 or s == 7:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

s = int(input())
if s == 3 or s == 5 or s == 7:
    print("YES")
else:
    print("NO")
S = str(input())
T = str(input())

count = 0
for _, s, t in enumerate(zip(S,T)):
    if s == t:
        count += 1

print(count)

### FIXED CODE ###

S = str(input())
T = str(input())

count = 0
for _, (s, t) in enumerate(zip(S,T)):
    if s == t:
        count += 1

print(count)
N=list(input())
s=set(N)
ans=''.join(sorted(s))
all=[chr(i) for i in range(97,97+26)]
for i in range(27):
  if ans[i]!=all[i]:
    print(all[i])
    exit()
print('None')

### FIXED CODE ###

N=list(input())
s=set(N)
ans=''.join(sorted(s))
all=[chr(i) for i in range(97,97+26)]
if ans=='abcdefghijklmnopqrstuvwxyz':
  print('None')
  exit()
for i in range(len(ans)):
  if ans[i]!=all[i]:
    print(all[i])
    exit()
  elif i==len(ans)-1 :
    print(all[len(ans)])
    exit()
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A,B,C,D = map(int,input().split())
#A = list(map(int,input().split()))

c_b  = B//C
d_b  = B//D
cd_b = B//lcm(C,D)

c_a  = (A-1)//C
d_a  = (A-1)//D
cd_a = (A-1)//lcm(C,D)

ans = (B - c_b - d_b + cd_b) - (A - 1 - c_a - d_a + cd_a)



print(str(ans))

### FIXED CODE ###

def gcd(x, y):
    if x < y:
        x, y = y, x
    while x % y != 0:
        x, y = y, x % y
    return y
        
def lcm(x, y):
    return (x * y) // gcd(x, y)

A,B,C,D = map(int,input().split())
#A = list(map(int,input().split()))

c_b  = B//C
d_b  = B//D
cd_b = B//lcm(C,D)

c_a  = (A-1)//C
d_a  = (A-1)//D
cd_a = (A-1)//lcm(C,D)

ans = (B - c_b - d_b + cd_b) - (A - 1 - c_a - d_a + cd_a)



print(str(ans))
N,Q = map(int,input().split())
K = [[] for _ in range(N+1)]
ans = [0] * (N+1)
nums = [0] * (N+1)

def dfs(now,parent):
    for i in K[now]:
        if i != parent:
            nums[i] += nums[now]
            dfs(i,now)

for _ in range(N-1):
    a,b = map(int,input().split())
    K[a].append(b)
    K[b].append(a)

for _ in range(Q):
    p, x = map(int, input().split())
    nums[p] += x
dfs(1,0)

print(' '.join(str(i) for i in nums[1:]))

### FIXED CODE ###

import sys
 
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline().strip()
def main():
    N,Q = map(int,input().split())
    K = [[] for _ in range(N+1)]
    nums = [0 for _ in range(N+1)]

    for _ in range(N-1):
        a,b = map(int,input().split())
        K[a].append(b)
        K[b].append(a)

    for _ in range(Q):
        p, x = map(int, input().split())
        nums[p] += x

    def dfs(now,parent):
        for i in K[now]:
            if i != parent:
                nums[i] += nums[now]
                dfs(i,now)

    dfs(1,0)
    print(*nums[1:])

if __name__ == '__main__':
    main()
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A,B = map( int ,input().split())
#print(math.gcd(A,B))
print(lcm(A,B))

### FIXED CODE ###

def gcd(m,n):
    x = max(m,n)
    y = min(m,n)
    while x%y != 0:
        z = x%y
        x = y
        y = z
    else:
        return y
def lcm(m,n):
    return int(m * n /gcd(m,n))

A,B = map( int ,input().split())
print(lcm(A,B))
A, B = map(int, input())
 
print(max([0, A - 2 * B]))

### FIXED CODE ###

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

print(max(0, A - 2 * B))
H, W = [int(x) for x in input().split()]
C = []
for i in range(H):
  C.append(input())
  
for i in range(2 * H):
  print(C[(i + 2) // 2])

### FIXED CODE ###

H, W = [int(x) for x in input().split()]
C = []
for i in range(H):
  C.append(input())
  
for i in range(2 * H):
  print(C[i // 2])
# -*- coding: utf-8 -*-
# https://atcoder.jp/contests/abc138/tasks/abc138_d

# It's a Python porting of ki.cpp
# Mainly to understand the algorithm by myself

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

tree_link = [None] * 100000
answer = [0] * N


def dfs(v, p=-1):
    for link in tree_link[v]:
        if link == p:  # 親ノードであれば continue
            continue
        answer[link] += answer[v]
        dfs(link, v)


# 双方向の辺を作る
for i in range(N - 1):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1

    if tree_link[a]:
        tree_link[a].append(b)
    else:
        tree_link[a] = [b]

    if tree_link[b]:
        tree_link[b].append(a)
    else:
        tree_link[b] = [a]

# 頂点に値を足し込む
for i in range(Q):
    p, x = list(map(int, input().split()))
    answer[p - 1] += x

# 計算
dfs(0)

# 出力
print(" ".join([str(answer[i]) for i in range(N)]))


### FIXED CODE ###

# -*- coding: utf-8 -*-
# https://atcoder.jp/contests/abc138/tasks/abc138_d


def main():
    n, q = map(int, input().split())
    values = [0] * n
    links = [[] for _ in range(n)]

    for _ in range(n - 1):
        a, b = map(int, input().split())
        links[a - 1].append(b - 1)
        links[b - 1].append(a - 1)

    for _ in range(q):
        p, x = map(int, input().split())
        values[p - 1] += x

    s = [(0, -1)]
    while s:
        i, p = s.pop()
        for j in links[i]:
            if j == p:
                continue
            values[j] += values[i]
            s.append((j, i))

    print(*values)


main()
n = int(input())
s = input()
numlist = [str(i) for i in range(10)]
numlist *= 3

numcombi = list(itertools.combinations(numlist, 3))

print(numcombi)

### FIXED CODE ###

n = int(input())
s = input()

count = 0
for i in range(1000):
  pin = "00" + str(i)
  pin = pin[-3:]
  
  idx = 0
  for j in range(n):
    if s[j] == pin[idx]:
      idx += 1
      
    if idx == 3:
      break

  if idx == 3:
    count += 1
      
print(count)
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.append(0)
a.sort(reverse=True)
b = [a[0], a[1]]


def hikaku(i, tempb):
    b[i - 1] = b[i]
    b[i] = tempb
    if len(b) == i + 1:
        b.append(a[i + 1])
    if b[i] < b[i + 1]:
        hikaku(i + 1, tempb)


while m > 0:
    b[0] = b[0] // 2
    if b[0] < b[1]:
        hikaku(1, b[0])
    if b[0] < 1:
        break
    m -= 1


if b[0] < 1:
    print(0)
else:
    for i in range(len(b), len(a)):
        b.append(a[i])
    print(sum(b))



### FIXED CODE ###

import heapq

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

for _ in range(m):
    tmax = heapq.heappop(a)
    tmax = -(-tmax //2)
    heapq.heappush(a,tmax)

print(-1*sum(a))
import bisect
x, n = map(int, input().split())
pN = list(map(int, input().split()))
plus_flag = 1
minus_flag = 1
pN.sort()
key_index = bisect.bisect(pN, x) - 1
plus_index = key_index
minus_index = key_index
if n == 0:
    print(x)
else:
    while(1):
        if minus_flag == 1:
            if pN[minus_index] - 1 != pN[minus_index-1]:
                print(pN[minus_index] - 1)
                break
            else:
                minus_index = minus_index + 1

        if minus_index == 0:
            minus_flag = 0



        if plus_flag == 1:
            if pN[plus_index] + 1 != pN[plus_index+1]:
                print(pN[plus_index] + 1)
                break
            else:
                plus_index = plus_index + 1

        if plus_index == n:
            plus_flag = 0

### FIXED CODE ###

import bisect
x, n = map(int, input().split())
pN = list(map(int, input().split()))

pN.sort()

diff = 0

if n == 0:
    print(x)
else:
    while(1):
        if x-diff not in pN:
            print(x-diff)
            exit()
        elif x+diff not in pN:
            print(x+diff)
            exit()
        diff+=1
from functools import reduce
n = (int)(input())
a = (list)(map(int, input().split()))


def calcMod(a, m):
  return sum([m % v for v in a])


def mul(a, b):
  return a*b


#print(calcMod(a, reduce(mul, a)-1))
print(sum(a)-n)


### FIXED CODE ###

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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

l = sorted(l, reverse=True)
print(sum(a-b for a, b in zip(l, l[1:])))
n = int(input())
w = list(map(int, input().split()))

s = sum(w)
ans = 0
for i in range(n):
    ans += w[i]
    if ans > s / 2:
        j = i
        break

aa = abs(sum[:j] - sum[j:])
bb = abs(sum[:j+1] - sum[j+1:])

print(min(aa, bb))

### FIXED CODE ###

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

mini = float('inf')

for i in range(n):
    s1 = sum(w[0:i+1])
    s2 = sum(w[i+1:n])
    
    mini = min(abs(s2-s1),mini)
        
print(mini)
n,k = map(int,input().split())
x = list(map(int,input().split()))

m = []
p = []
for i in range(n):
    if x[i] < 0:
        m.append(x[i])
    elif x[i] > 0:
        p.append(x[i])

if m and p:
    if k-len(m) >= 0:
        s = 0
    else:
        s = abs(k-len(m))+1
    
    i = 0
    ans = float('inf')
    while s+i <= len(m) and z+s+i <= n:
        ans = min(ans, min(abs(x[s+i])*2 + abs(x[k-1+s+i]), abs(x[s+i]) + abs(x[k-1+s+i])*2))
        
        if s+i == len(m):
            ans = min(ans, x[k-1+s+i])
        if z+s+i == len(m)-1:
            ans = min(ans, abs(x[s+i]))
        i += 1
    
    print(ans)
elif m:
    print(abs(x[-k]))
elif p:
    print(x[k-1])
else:
    print(0)

### FIXED CODE ###

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

if len(x) == 1 and x[0] == 0:
    print(0)
    exit()

m = []
p = []
for i in range(n):
    if x[i] < 0:
        m.append(x[i])
    elif x[i] > 0:
        p.append(x[i])

ans = float('inf')
if len(m) >= k:
    ans = min(ans,abs(m[-k]))
    m = m[-k+1:]
if len(p) >= k:
    ans = min(ans,p[k-1])
    p = p[:k-1]

x = m+p
i = 0
for i in range(len(x)-k+1):
    ans = min(ans, min(abs(x[i])*2+abs(x[i+k-1]), abs(x[i])+abs(x[i+k-1])*2))

print(ans)
A = input().split()
count = 0
for a in range(3)
    if A[a] == 'R':
      count++
      
if count == 2 A[1] == 'S':
      count = 1
print(count)
        

### FIXED CODE ###

A = input()
count = 0
for a in range(3):
    if A[a] == 'R':
      count+=1
      
if count == 2 and A[1] == 'S':
      count = 1
print(count)
# 3個のパックにそれぞれ、a,b,c個のキャンディーが入っている
# キャンディーを2人に分ける際、個数が等しくなるか判定

# 入力
a = int(input())
b = int(input())
c = int(input())

# 処理
if a == b + c or b == a + c or c == a + b:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

# 3個のパックにそれぞれ、a,b,c個のキャンディーが入っている
# キャンディーを2人に分ける際、個数が等しくなるか判定

# 入力
a, b, c = map(int, input().split())

# 処理
if a == b + c or b == a + c or c == a + b:
    print("Yes")
else:
    print("No")
N = int(input())
A = list(map(int,input().split()))

if 0 in A:
  print(0)
  return

count = 1
for i in A:
  count *= a
  if count > 10000000000000000000:
    print(-1)
    return

print(count)

### FIXED CODE ###

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

def main():
  if 0 in A:
    print(0)
    return
 
  count = 1
  for i in A:
    count *= i
    if count > 1000000000000000000:
      print(-1)
      return
 
  print(count)

main()
a,b = map(int,input().split())
if(a*b<=0)
    print(Zero)
elif(a<0 and (b-a)%2==0)
    print(Positive)
else
    print(Negative)

### FIXED CODE ###

a,b = map(int,input().split())
if a*b<=0:
    print("Zero")
elif a<0 and (b-a)%2==0:
    print("Negative")
else:
    print("Positive")
N = int(input())
S = input()
count = 0
for i in range(1, N+1:
    for j in range(i + 1, N+1):
        for k in range(j + 1, N+1):
            if S[i-1] != S[j-1] and S[j-1] != S[k-1] and S[i-1] != S[k-1] and j - i != k - j:
                count += 1
print(count)

### FIXED CODE ###

N = int(input())
if "7" in str(N):
    print("Yes")
else:
    print("No")
def resolve():
    import sys

    input = lambda: sys.stdin.readline().rstrip()

    a, b, c, k = map(int,input().split())
    
    if a + b >= k:
      print(k)
      sys.exit()

    arr = [1] * a + [0] * b + [-1] * c

    print(sum(arr[0:k]))

resolve()

### FIXED CODE ###

def resolve():
    import sys

    input = lambda: sys.stdin.readline().rstrip()

    a, b, c, k = map(int,input().split())
    
    if a >= k:
      print(k)
    elif a + b >= k:
      print(a)
    else:
      print(a-(k-(a+b)))
      
resolve()
import math

N=int(input())
HP=list(map(int,input().split()))
 
tmp=HP[0]
 
for i in range(0,N):
    tmp=math.gcd(tmp,HP[i])
    
print(tmp)

### FIXED CODE ###

def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    gcd=a
    return gcd

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

tmp=egcd(HP[0],HP[1])

for i in range(1,N-1):
    tmp=egcd(tmp,HP[i+1])
    
print(tmp)