Harryxun/stf_run huggingface dataset:
import math
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

for p in range(1, 4):
 sum = 0
 for i in range(n):
  sum += math.fabs(x[i]-y[i])**p
 print(sum**(1/p))

sum = 0
for i in range(n):
 sum += math.fabs(x[[i]-y[i])**math.inf
print(sum**(1/math.inf))

### FIXED CODE ###

import math
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

for p in range(1, 4):
 sum = 0
 for i in range(n):
  sum += math.fabs(x[i]-y[i])**p
 print(sum**(1/p))

a = []
for i in range(n):
 a.append(math.fabs(x[i]-y[i]))
a.sort()
print(a[n-1])
N = input()
N = list(map(int,[i for i in N]))
lst = base_convert(N,10,26)
lst_converted = convertList(lst)
print(''.join([dict1[i] for i in lst]))

### FIXED CODE ###

def base_convert(nl, ibase, obase):
    o = []
    while any(nl):
        c = 0
        for i in range(len(nl)):
            c = c * ibase + nl[i]
            nl[i],c = divmod(c,obase)
        o.append(c)
    o.reverse()
    return o

def convertList(lst):
    rev_lst = list(reversed(lst))
    for i,num in enumerate(rev_lst):
        if i < len(rev_lst)-1:
            if num <= 0:
                rev_lst[i+1] = rev_lst[i+1]-1
                rev_lst[i] = rev_lst[i] + 26
    return list(reversed(rev_lst))

dict1 = {
    0: '',
    1: 'a',
    2: 'b',
    3: 'c',
    4: 'd',
    5: 'e',
    6: 'f',
    7: 'g',
    8: 'h',
    9: 'i',
    10: 'j',
    11: 'k',
    12: 'l',
    13: 'm',
    14: 'n',
    15: 'o',
    16: 'p',
    17: 'q',
    18: 'r',
    19: 's',
    20: 't',
    21: 'u',
    22: 'v',
    23: 'w',
    24: 'x',
    25: 'y',
    26: 'z'
}

N = input()
N = list(map(int,[i for i in N]))
lst = base_convert(N,10,26)
lst_converted = convertList(lst)
ans = ''.join([dict1[i] for i in lst_converted])
print(ans)
k = int(input())
s = input()
if(len(s) > k):
    print(s[0:k]+'...')
else:
    print(s) 

### FIXED CODE ###

import itertools
from collections import defaultdict
import collections
import math
import sys
import queue
sys.setrecursionlimit(200000)
mod = 1000000007

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

graph = {i: [] for i in range(1, n + 1)}
for _ in range(m):
    u, v = map(int, input().split())
    graph[u].append(v)
    graph[v].append(u)

tf = [False] * (n + 1)
sirube = [0] * (n + 1)
def bfs(v):
    q = queue.Queue()
    q.put([v,0])
    tf[v] = True
    while not q.empty():
        sub = q.get()
        now = sub[0]
        before = sub[1]
        for next in graph[now]:
            if tf[next]:
                continue
            tf[next] = True
            if sirube[next] == 0:
                sirube[next] = now
            q.put([next, now])

bfs(1)
for i in range(2, n + 1):
    if sirube[i] == 0:
        print("No")
        exit()

print("Yes")
for i in range(2, n + 1):
    print(sirube[i])
N = int(input())
A = list(map(int,input().split()))

for i in range(1,N+1):
    counter = 0
    prev_item = 1
    for item in A:
        if item == i:
            counter += 1
            prev_item = item
    print(counter)
    if i < N:
        A.remove(prev_item)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
count_list = [0] * N
for item in A:
    count_list[item-1] += 1
for countitem in count_list:
    print(countitem)
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n=int(input())
print(a[n+1])

### FIXED CODE ###

a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n=int(input())
print(a[n-1])
a,b=map(int,input().split())
if a+b<24:
  print(a+b)
else:
  print(a+b-24

### FIXED CODE ###

a,b=map(int,input().split())
if a+b<24:
  print(a+b)
else:
  print(a+b-24)
a, b, n = map(int, input().split())
print(n // a + 1 if a >= b else n // b + 1)

### FIXED CODE ###

a = int(input())
b = int(input())
n = int(input())
t = max(a, b)
print((n + t - 1) // t)
import math,functools
n,x = map(int, input().split())
list_x = list((map(int, input().split())))
list_x.append(x)
list_x.sort()
list_dist = []
for i in range(0,n):
    list_dist.append(list_x[i+1] - list_x[i])
print(functools.reduce(math.gcd,list_dist))


### FIXED CODE ###

def gcd(x,y):
    if x < y:
        (x,y) = (y,x)
    while y > 0:
        r = x % y
        x = y
        y = r
    return x

n,x = map(int, input().split())
list_x = list((map(int, input().split())))
list_x.append(x)
list_x.sort()
list_dist = []
for i in range(0,n):
    list_dist.append(list_x[i+1] - list_x[i])
gcd1 = list_dist[0]
for i in range(1,n):
    gcd1 = gcd(gcd1, list_dist[i])
print(gcd1)
import numpy as np

N = int(input())
p = [0] + list(input().split())

for i in range(1, N+1):
    item = p[i].replace('0.', '')
    p[i] = int(item)

#print(p)

dp = np.zeros((3100, 3100))
#dp[i, j] = i枚目までのコインを投げて，表の個数がj枚である確率 * (10**(2*i))
#pythonのlistだと遅いので，numpyにおけるベクトル漸化式としてdpを埋めていく

dp[1, 0] = 100-p[1]
dp[1, 1] = p[1]

for i in range(2, N + 1):
    dp[i] = (np.roll(dp[i-1], 1) * p[i] + dp[i-1] * (100-p[i]))
    #dp[i][j] = i-1枚目までで表がj-1かつi回目で表　＋　i-1回目までで表がj枚かつi回目で裏（MECE）
    #つまり，dp[i][j] = dp[i-1][j-1] * p[i] + dp[i-1][j] * (1 - p[i])
    #numpyを使ってベクトル漸化式と見ることで，for_loopを一層分解消。
    #print(i, j, dp[i][j])
    #プログラムの仕組み上，iが一つ進むと，100 * 100 = 10**4　ずつスケールが大きくなっていく。


ans = 0

for k in range(-(-N//2), N+1):
    ans += dp[N, k]

dig = min(2*N, 10)

print(ans/10**(2*N))

### FIXED CODE ###

import numpy as np

N = int(input())
p = [0] + list(map(float, input().split()))

dp = np.zeros((3100, 3100))
#dp[i, j] = i枚目までのコインを投げて，表の個数がj枚である確率
#pythonのlistだと遅いので，numpyにおけるベクトル漸化式としてdpを埋めていく

dp[1, 0] = 1-p[1]
dp[1, 1] = p[1]

for i in range(2, N + 1):
    dp[i] = np.roll(dp[i-1], 1) * p[i] + dp[i-1] * (1-p[i])
    #dp[i][j] = i-1枚目までで表がj-1かつi回目で表　＋　i-1回目までで表がj枚かつi回目で裏（MECE）
    #つまり，dp[i][j] = dp[i-1][j-1] * p[i] + dp[i-1][j] * (1 - p[i])
    #numpyを使ってベクトル漸化式と見ることで，for_loopを一層分解消。
    #print(i, j, dp[i][j])

ans = 0

for k in range(-(-N//2), N+1):
    ans += dp[N, k]

print(ans)
while 1:
    sum = input()
    sum_list = sum.split(" ")
    print(len(str(int(sum_list[0]) + int(sum_list[1]))))
    except EOFError:
        break


### FIXED CODE ###

while 1:
    try:
        sum = input()
        sum_list = sum.split()
        print(len(str(int(sum_list[0]) + int(sum_list[1]))))
    except EOFError:
        break
import collections

s=input()
n=len(s)
slen=collections.deque()
tlen=collections.deque()
cnt=0
ans=0
for i in range(n):
  if s[i]=='S':
    tpos=i
    break
else:
  tpos=n
for i in range(n-1,-1,-1):
  if s[i]=='T':
    spos=i
    break
else:
  spos=-1
s=s[tpos:spos+1]+'x'
for i in range(len(s)-1):
  cnt+=1
  if s[i]!=s[i+1]:
    if s[i]=='S':
      slen.append(cnt)
      cnt=0
    else:
      tlen.append(cnt)
      cnt=0
for i in range(len(slen)):
  stmp,ttmp=slen.popleft(),tlen.popleft()
  if stmp>ttmp:
    ans+=ttmp
    tmp=slen.popleft()+(stmp-ttmp)
    slen.appendleft(tmp)
  else:
    ans+=stmp
print(n-ans*2)

### FIXED CODE ###

import collections

s=input()
n=len(s)
slen=collections.deque()
tlen=collections.deque()
cnt=0
ans=0
for i in range(n):
  if s[i]=='S':
    tpos=i
    break
else:
  tpos=n
for i in range(n-1,-1,-1):
  if s[i]=='T':
    spos=i
    break
else:
  spos=-1
s=s[tpos:spos+1]+'x'
for i in range(len(s)-1):
  cnt+=1
  if s[i]!=s[i+1]:
    if s[i]=='S':
      slen.append(cnt)
      cnt=0
    else:
      tlen.append(cnt)
      cnt=0
for i in range(len(slen)):
  stmp,ttmp=slen.popleft(),tlen.popleft()
  if stmp>ttmp:
    ans+=ttmp
    if len(slen)>0:
      tmp=slen.popleft()+(stmp-ttmp)
      slen.appendleft(tmp)
  else:
    ans+=stmp
print(n-ans*2)
def bisearch(li,target):
    l=0
    r=len(li)-1
    if(target<li[0][0]):
        return li[m][0]-target+li[m][1]
    elif(li[-1][0]<target):
        return target-li[-1][0]+li[-1][1]
    while(l<=r):
        m=int((l+r)/2)
        if(li[m][0]<target and target<li[m+1][0]):
            return min(target-li[m][0]+li[m][1],li[m+1][0]-target+li[m+1][1])
        if(target<li[m][0]):
            r = m-1
        else:
            l = m+1


inf = 10**15
A,B,Q = [int(x) for x in input().split()]
s = [0]*(A+1)
t = [0]*(B+1)
x = [0]*Q


for i in range(A):
    s[i] = int(input())
for i in range(B):
    t[i] = int(input())
for i in range(Q):
    x[i] = int(input())
s[-1] = inf
t[-1] = inf

li = []
a = b = 0
while(a<A or b<B):
    if(s[a]<t[b]):
        li.append([s[a],min(abs(t[b]-s[a]),abs(t[b-1]-s[a]))])
        a+=1
    else:
        li.append([t[b],min(abs(t[b]-s[a]),abs(t[b]-s[a-1]))])
        b+=1

x.append(500)

for i in x:
    print(bisearch(li,i))


### FIXED CODE ###

def bisearch(li,target):
    l=0
    r=len(li)-1
    while(l<=r):        
        m=int((l+r)/2)
        if(m==len(li)-1):
            return target-li[m][0]+li[m][1]
        if(li[m][0]<target and target<li[m+1][0]):
            return min(target-li[m][0]+li[m][1],li[m+1][0]-target+li[m+1][1])
        if(m==0 and target<li[0][0]):
            return li[0][0]-target+li[0][1]
        if(target<li[m][0]):
            r = m-1
        else:
            l = m+1

inf = 10**15
A,B,Q = [int(x) for x in input().split()]
s = [0]*(A+1)
t = [0]*(B+1)
x = [0]*Q

for i in range(A):
    s[i] = int(input())
for i in range(B):
    t[i] = int(input())
for i in range(Q):
    x[i] = int(input())
s[-1] = inf
t[-1] = inf

li = []
a = b = 0
while(a<A or b<B):
    if(s[a]<t[b]):
        li.append([s[a],min(abs(t[b]-s[a]),abs(t[b-1]-s[a]))])
        a+=1
    else:
        li.append([t[b],min(abs(t[b]-s[a]),abs(t[b]-s[a-1]))])
        b+=1

for i in x:
    print(bisearch(li,i))
m = input().split()
N = int(m[0])
Y = int(m[1])
if Y > 10000*N:
  print(-1,-1,-1)
else:
  frag == 1
  for i in range(N+1):
    for j in range(N-i+1):
      if frag == 1 and 10000*i + 5000*j + 1000*(N-i-j) == Y:
        frag == 0
        print(i,j,k)
        break
  if frag == 1:
    print(-1,-1,-1)

### FIXED CODE ###

m = input().split()
N = int(m[0])
Y = int(m[1])
if Y > 10000*N:
  print(-1,-1,-1)
else:
  frag = 0
  for i in range(N+1):
    for j in range(N-i+1):
      if frag == 0 and 10000*i + 5000*j + 1000*(N-i-j) == Y:
        frag = 1
        print(i,j,N-i-j)
        break
  if frag == 0:
    print(-1,-1,-1)
n = input()
for i in range(1,n+1):
  m[i][i] = 0

  p[i-1], p[i] = map(int, input().split())

for m in range(2,n+1):
  for i in range(1,n-m+1+1):
    j = i + m - 1
    m[i][j] = 999999999999999
    for k in range(i,j-1+1):
      m[i][j] = min(m[i][j], m[i][k] + m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j])

print m[1][n]

### FIXED CODE ###

n = int(raw_input())
p = [0 for i in range(0, 101)]
m = [[0 for i in range(0, 101)] for j in range(0, 101)]
for i in range(1, n+1):
    p[i-1], p[i] = map(int, raw_input().split())
     
for l in range(2, n+1):
    for i in range(1, n-l+2):
        j = i+l-1
        m[i][j] = float("inf")
        for k in range(i, j):
            m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j])
 
print m[1][n]
K,A,B = list(map(int,input().split()))
if A>=B-2:
    answer = K+1
elif A+1>K:
    answer=K+1
else:
  # gutyoku
    first = A
    rest = K - (A-1) - 2
    if rest%2==0:
        answer = (rest/2+1)*B - (rest/2)*A
    else:
        #print('else')
        answer = ((rest-1)/2+1)*B - ((rest-1)/2)*A+1
    
print(int(answer))


### FIXED CODE ###

N,K = list(map(int,input().split()))
if N >= 2*K -1:
  print("YES")
else:
  print("NO")
#!/usr/bin/env python3
from collections import deque
import sys
try:
    from typing import Deque, List
except ImportError:
    pass


def dfs(G: "List[List[int]]", a: int, b: int, par: int = -1):
    for t in G[a]:
        if t == par:
            continue
        if t == b:
            return [t]
        path = dfs(G, t, b, a)
        if path:
            return [t] + path
    return None


def bfs(G: "List[List[int]]", a: int, par: int = -1):
    q = deque()  # type: Deque[int]
    q.append(a)
    visited = {par, a}
    while q:
        s = q.popleft()
        for t in G[s]:
            if t in visited:
                continue
            q.append(t)
            visited.add(t)
    return len(visited) - 1


def solve(N: int, a: "List[int]", b: "List[int]"):
    G = [[] for i in range(N)]
    for ai, bi in zip(a, b):
        ai -= 1
        bi -= 1
        G[ai].append(bi)
        G[bi].append(ai)
    path = dfs(G, 0, N - 1)
    assert path
    path = [0] + path
    bb = path[(len(path) - 1) // 2]
    wb = path[(len(path) + 1) // 2]
    bn = bfs(G, bb, wb)
    wn = bfs(G, wb, bb)
    if bn > wn:
        print("Fennec")
    else:
        print("Snuke")


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int()] * (N - 1)  # type: "List[int]"
    b = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, a, b)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
from collections import deque
import sys
try:
    from typing import Deque, List
except ImportError:
    pass


def bfs(G: "List[List[int]]", a: int):
    q = deque()  # type: Deque[int]
    q.append(a)
    dist = [-1] * len(G)
    dist[a] = 0
    while q:
        s = q.popleft()
        for t in G[s]:
            if dist[t] >= 0:
                continue
            q.append(t)
            dist[t] = dist[s] + 1
    return dist


def solve(N: int, a: "List[int]", b: "List[int]"):
    G = [[] for i in range(N)]
    for ai, bi in zip(a, b):
        ai -= 1
        bi -= 1
        G[ai].append(bi)
        G[bi].append(ai)
    db = bfs(G, 0)
    dw = bfs(G, N - 1)
    bn = sum((dbi <= dwi) for dbi, dwi in zip(db, dw))
    wn = N - bn
    if bn > wn:
        print("Fennec")
    else:
        print("Snuke")


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int()] * (N - 1)  # type: "List[int]"
    b = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, a, b)


if __name__ == '__main__':
    main()
n  = int(input())
a = list(map(int,input().split()))
ans = 0
mn = 0
for i in range(n):
    if a[i] < 0:
        mn += 1
        a[i] = abs(a[i])
    ans += a[i]
if 0 in a or mn%2 = 0:
    print(ans)
else:
    print(ans - 2*min(a))

### FIXED CODE ###

n  = int(input())
a = list(map(int,input().split()))
ans = 0
mn = 0
for i in range(n):
    if a[i] < 0:
        mn += 1
        a[i] = abs(a[i])
    ans += a[i]
if 0 in a or mn%2 == 0:
    print(ans)
else:
    print(ans - 2*min(a))
if w_count >= r_count:
    print(w_count)
else:
    print(w_count - right_w_count)


### FIXED CODE ###

n = int(input())

c = list(input())

w_count = c.count("W")
r_count = c.count("R")

right_center = c[r_count:]
right_w_count = right_center.count("W")

print(w_count - right_w_count)
# ABC132 D Blue and Red Balls

from scipy.special import comb

N, K = map(int, input().split())
MOD = int(1e9)+7

for i in range(1, K+1):
    temp = comb(N-K+1, i) * comb(K-1, i-1)
    print(int(temp % MOD))

### FIXED CODE ###

# ABC132 D Blue and Red Balls

def comb(n, r):
    if n == 0 or r == 0:
        return 1
    if n < r:
        return 0
    a = b = 1
    r = min(n-r, r)
    for i in range(n-r+1,n+1):
        a*=i
    for i in range(1,r+1):
        b*=i
    
    return a//b

N, K = map(int, input().split())
MOD = int(1e9)+7

for i in range(1, K+1):
    temp = comb(N-K+1, i) * comb(K-1, i-1)
    print(int(temp % MOD))
While True:
 a=map(int,raw_input().split())
 if a==[0,0]:
  break
 if a[0]>a[1]:print(str(a[1])+" "+str(a[0]))
 else: print(str(a[0])+" "+str(a[1]))

### FIXED CODE ###

while True:
 a=map(int,raw_input().split())
 if a==[0,0]:
  break
 if a[0]>a[1]:print(str(a[1])+" "+str(a[0]))
 else: print(str(a[0])+" "+str(a[1]))
a,b=map(int,input().split)
if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")

### FIXED CODE ###

a,b=map(int,input().split())
if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")
a,b,v,w,t = map(int,input().split())

d = abs(b-a)
p = v-w
i=0
for i in range(t+1):
  if v<=w:
    print('NO')
  elif p*i == d:
    print('YES')
    
  else:
    print('NO')


### FIXED CODE ###

a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if v <= w:
    print('NO')
else:
    if 1 <= (abs(b - a) / (v - w)) <= t:
        print('YES')
    else:
        print('NO')
N,K = map(int,input().split())
D = list(map(int,input().split()))
L = []
n = 0
l = 0
 
for p in range(N-K+1):
  for q in range(K):
    for r in range(D[p+q]+1):
      n = n + r
    f = n/D[p+q]
    l = l + f
    n = 0
  L.append(l)
  l = 0
 
print(max(L))

### FIXED CODE ###

S,T=input().split()
A,B=map(int,input().split())
U=input()
 
if S==U:
  print(A-1, B)
else:
  print(A, B-1)
N, M = [int(i) for i in input().split()]
X = [0] * (10 ** 5)
# X = [0] * (10)
for i in map(int, input().split()):
    X[i] += 1
Y = [sum(X[i::M]) for i in range(M)]
ans = Y[0] // 2
Y[0] = 0
for i in range(1, M//2+M%2):
    j = M - i
    tmp = min(Y[i], Y[j])
    ans += tmp
    Y[i] -= tmp
    Y[j] -= tmp
for i, n in enumerate(X):
    j = i % M
    if Y[j] < 2 or n < 2:
        continue
    tmp = min(Y[j]-Y[j]%2, n-n%2)
    ans += tmp // 2
    Y[j] -= tmp
print(ans)    
        
    


### FIXED CODE ###

from string import ascii_uppercase
H, W = [int(i) for i in input().split()]
S = [input().split() for _ in range(H)]
for h in range(H):
    for w in range(W):
        if S[h][w] == "snuke":
            print("{}{}".format(ascii_uppercase[w], h+1))
import numpy as np
import sys
sys.setrecursionlimit(10**7)

 
N, M, K = map(int, input().split())
A = [int(n) for n in input().split()]
B = [int(n) for n in input().split()]
 
A = np.array(A)
B = np.array(B)
 
A = np.cumsum(A)
B = np.cumsum(B)
 
A1 = np.zeros((len(A),2))
A1[:,0] = A
A1[:,1] = np.arange(1,len(A)+1)
 
B1 = np.zeros((len(B),2))
B1[:,0] = B
B1[:,1] = np.arange(1,len(B)+1)
 
C1 = np.zeros((len(A)*len(B),2))
lenB = len(B)
for i in range(len(A)):
    for j in range(len(B)):
        C1[lenB*i+j,:] = A1[i,:] + B1[j,:]
C2 = np.array([C[1] for C in C1 if C[0] <= K])
 
if len(C2):
    print(int(C2.max()))
else:
    print(0)

### FIXED CODE ###

import numpy as np

N, M, K = map(int, input().split())
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))

A = np.array(A).cumsum()
B = np.array(B).cumsum()

ans = 0
j = M
for i in range(N+1):
    if A[i] > K:
        break
    while B[j] > K - A[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)
N = int(input())
As = []
for i in range(N):
  As.append(int(input())

for j in range(N):
  instAs = As
  instAs.pop(j)
  print(max(instAs))

### FIXED CODE ###

import copy
N = int(input())
As = []
for i in range(N):
    As.append(int(input()))
maxA = max(As)
instA = As.copy()
instA.remove(maxA)
secA = max(instA)
for i in range(N):
    if As[i] == maxA:
        print(secA)
    else:
        print(maxA)
a,b,c = (int(_) for _ in input().split())

print(min(c, int(b/a))

### FIXED CODE ###

a,b,c = (int(_) for _ in input().split())

print(min(c, int(b/a)))
import math


# def calc(n, c, d):
#     return n-(math.floor(n / c) +
#               math.floor(n / d) - math.floor(n / (c * d / math.gcd(c, d))))
def calc(n, c, d):
    return n-(n / c +
              n / d - n / (c * d / gcd(c, d)))


def main():
    a, b, c, d = map(int, input().split())

    print(calc(b, c, d)-calc(a-1, c, d))


if __name__ == "__main__":
    main()


### FIXED CODE ###

a,b,c,d=map(int,input().split())
from math import gcd
ans=0
def main(n):
    e=n//c+n//d-n//((c*d)//gcd(c,d))
    return n-e

print(main(b)-main(a-1))
N,X=input().split()
n=int(N)
x=int(X)
i=list(map(int,input().split()))
D=0
k=0
while D<=x:
  while k<=n+1:
    D=D+i[k]
    k=k+1
print(k)

### FIXED CODE ###

X,A=input().split()
x=int(X)
a=int(A)
if x<a:
  print(0)
else:
  print(10)
N = int(input())
lst_A = list(map(int, input().split()))
lst_rod_num = [0] * (N + 1)
a, b = 0, 0
lst_ans = []


for a in lst_A:
    lst_rod_num[a] += 1


cnt = 0
for i in range(N, -1, -1):
    if cnt == 2:
        a = lst_ans[0]
        b = lst_ans[1]
        break
    if lst_rod_num[i] >= 2:
        lst_ans.append(i)
        cnt += 1
ans = a * b


print(ans)

### FIXED CODE ###

N = int(input())
lst_A = list(map(int, input().split()))
lst_A.sort(reverse=True)
cur_a = -1
lst_ans = []


for i, a in enumerate(lst_A):
    if cur_a == a:
        lst_ans.append(a)
        cur_a = -1
        if len(lst_ans) == 2:
            break
    else:
        cur_a = a


ans = lst_ans[0] * lst_ans[1] if len(lst_ans) else 0
print(ans)
import copy

N,M=map(int,input().split())
L=[list(map(int,input().split())) for i in range(M)]

S=[]
component=[0,0]
for j in range(N):
    S.append(copy.deepcopy(component)

for k in range(1,M+1):
    if L[k-1][1]=='AC':
        if S[L[k-1][0]][0]==0:
            S[L[k-1][0]][0]=1
    else:
        if S[L[k-1][0]][0]==0:
            S[L[k-1][0]][1]+=1

ansAC=0
ansWA=0

for l in range(N):
    ansAC+=S[l][0]
    ansWA+=S[l][1]

print(ansAC,ansWA)




### FIXED CODE ###

import copy

N,M=map(int,input().split())
L=[list(map(str,input().split())) for i in range(M)]

for x in range(M):
    L[x][0]=int(L[x][0])

#print(N,M)
#print(L)

S=[]
component=[0,0]
for j in range(N):
    S.append(copy.deepcopy(component))

#print(S)

for k in range(1,M+1):
    if L[k-1][1]=='AC':
        if S[L[k-1][0]-1][0]==0:
            S[L[k-1][0]-1][0]=1
    else:
        if S[L[k-1][0]-1][0]==0:
            S[L[k-1][0]-1][1]+=1
    #print(S)

ansAC=0
ansWA=0

for l in range(N):
    ansAC+=S[l][0]
    if S[l][0]==1:
        ansWA+=S[l][1]

print(ansAC,ansWA)
H, n = map(int, input().split())
List = [[0 for i in range(4)] for j in range(n)]
for i in range(n):
    a, b = map(int, input().split())
    List[i][0] = b / a
    List[i][1] = b / H
    List[i][2] = a
    List[i][3] = b

def recal():
    for i in range(n):
        b = List[i][3]
        List[i][1] = b / H

sList = sorted(List)
MP = 0
k = 0
while H > 0:
    if sList[k][2] <= H:
        H -= sList[k][2]
        MP += sList[k][3]
        recal()
    else:
        if sList[k + 1][2] <= H:
            if sList[k][1] <= sList[k + 1][0]:
                H -= sList[k][2]
                MP += sList[k][3]
                recal()
                break
            else:
                H -= sList[k + 1][2]
                MP += sList[k + 1][3]
                recal()
                k += 1
        else:
            if sList[k][1] <= sList[k + 1][1]:
                H -= sList[k][2]
                MP += sList[k][3]
                recal()
                break
            else:
                H -= sList[k + 1][2]
                MP += sList[k + 1][3]
                recal()
                k += 1
print(MP)

### FIXED CODE ###

n, k = map(int, input().split())
H = list(map(int, input().split()))
sH = sorted(H, reverse=True)
ans = sum(sH[k::])
print(ans)