Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

from fractions import Fraction
from decimal import Decimal

n, k = map(int, input().split())
p = list(map(int, input().split()))
p = list(map(lambda x: Fraction(x+1)/2, p))

cur = sum(p[:k])
res = cur

for i in range(k, n):
    cur += p[i] - p[i-k]
    res = max(res, cur)

d = Decimal(res.numerator) / Decimal(res.denominator)
print(d)

### FIXED CODE ###

from decimal import Decimal

n, k = map(int, input().split())
p = list(map(int, input().split()))
p = list(map(lambda x: x+1, p))

cur = sum(p[:k])
res = cur

for i in range(k, n):
    cur += p[i] - p[i-k]
    res = max(res, cur)

d = Decimal(res.numerator) / Decimal(2*res.denominator)
print(d)
### BUGGY CODE ###

a,b,k = map(int,input().split())

for p in range(k):
  if a >= 1:
    a -= 1
  else:
    if b >= 1:
      b -= 1
    
print(str(a) + ' ' + str(b))

### FIXED CODE ###

a,b,k = map(int,input().split())

a -= k
if a <= -1:
  p = abs(a)
  a = 0
  b -= p
  if b <= -1:
    b = 0
    
print(str(a) + ' ' + str(b))
### BUGGY CODE ###

temp = input()
temp2 = temp.split(" ")
temp = []
for i in temp2:
    temp.append(int(i))

for i in range(1,100000000):
    ans1 = temp[0]*i
    if ans1 % temp[1] != 0:
        break
    if ans1 <= 10^18:
        ans1 = -1
        break
print(ans1)
    

### FIXED CODE ###

temp = input()
temp2 = temp.split(" ")
temp = []
for i in temp2:
    temp.append(int(i))

for i in range(1,100000000):
    ans1 = temp[0]*i
    if ans1 % temp[1] != 0:
        break
    if ans1 >= 10^18:
        ans1 = -1
        break
print(ans1)
### BUGGY CODE ###

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

ans=[]

for i in range(n):

    ans.append(s[0:i].count("W")+s[i+1:n].count("E"))
    
print(min(ans))


### FIXED CODE ###

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

a=0
b=0
e=[]
w=[0]
ans=[]

for i in s:
    if i==("E"):
        a+=1
    else:
        b+=1
    e.append(a)
    w.append(b)
        
for i in range(n):
    ans.append(e[n-1]-e[i]+w[i])

print(min(ans))
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
bit = [0] * 20

count = 0
l, r = 0, 0
isOk = True

while r < n:
    temp = a[r]
    r += 1

    bitCheck = 1
    for i in range(20):
        if (temp & bitCheck) > 0:
            bit[i] += 1

        if bit[i] >= 2:
            isOk = False
        
        bitCheck <<= 1
    
    if not isOk:
        while not isOk:
            isOk = True
            temp = a[l]
            l += 1
            bitCheck = 1
            for i in range(20):
                if (temp & bitCheck) > 0:
                    bit[i] -= 1

                if bit[i] >= 2:
                    isOk = False

                bitCheck <<= 1

    count += (r - l)

print(count)

### FIXED CODE ###

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

r = 0
tempSum = 0
xor = 0
count = 0

for l in range(n):
    while r < n and (tempSum + a[r]) == (xor ^ a[r]):
        tempSum += a[r]
        xor ^= a[r]
        r += 1
    
    count += (r - l)

    tempSum -= a[l]
    xor ^= a[l]

print(count)
### BUGGY CODE ###

n=int(input())
list=[]
for _ in range(n):
    s=input()
    if s not in list:
        list.append(s)
print(str(len(list)))


### FIXED CODE ###

n=int(input())
set=set()
for _ in range(n):
    s=input()
    if s not in set:
        set.add(s)
print(str(len(set)))
### BUGGY CODE ###

from collections import Counter
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n=int(input())
a=list(map(int,input().split()))
c=Counter(a)
com=0
for i in range(1,n+1):
    if(c[i]<=1):
        continue
    com+=combinations_count(c[i],2)
for k in range(1,n+1):
    ans=com
    if(c[a[k-1]]>=2):
        ans-=combinations_count(c[a[k-1]],2)
        if((c[a[k-1]]-1)>=2):
            ans+=combinations_count(c[a[k-1]]-1,2)
    print(ans)

### FIXED CODE ###

from collections import Counter
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n=int(input())
a=list(map(int,input().split()))
c=Counter(a)
com=0
for i in range(1,n+1):
    if(c[i]<=1):
        continue
    com+=combinations_count(c[i],2)
for k in range(1,n+1):
    ans=com
    ans-=c[a[k-1]]-1
    print(ans)
### BUGGY CODE ###

import math
denom = int(1e9+7)

def power_func(a,b,p):
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p


def combi2(n,k,p,f,pow_fun):
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=fact_mod[n]
  b=fact_mod[k]
  c=fact_mod[n-k]
  return (a*pow_fun[b]*pow_fun[c])%p


N, K = map(int, input().split())
A = [int(i) for i in input().split()]
A.sort(reverse = True)

fact_mod = [1]
current = 1
for i in range(1,N+1):
    current = (current * i) % denom
    fact_mod.append(current)

pow_fun = []
for i in range(denom):
    pow_fun.append(power_func(i,denom-2,denom))

max_tot = 0
min_tot = 0
for i in range(N-K+1):
    max_tot += (A[i] * combi2(N-i-1, K-1, denom, fact_mod,pow_fun)) % denom
    min_tot += (A[N-i-1] * combi2(N-i-1, K-1, denom, fact_mod,pow_fun)) % denom
    
print((max_tot - min_tot)%denom)

### FIXED CODE ###

import math
denom = int(1e9+7)

def power_func(a,b,p):
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p


def combi2(n,k,p,f,pow_fun):
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=fact_mod[n]
  b=fact_mod[k]
  c=fact_mod[n-k]
  return (a*pow_fun[b]*pow_fun[c])%p


N, K = map(int, input().split())
A = [int(i) for i in input().split()]
A.sort(reverse = True)

fact_mod = [1]
current = 1
for i in range(1,N+1):
    current = (current * i) % denom
    fact_mod.append(current)

pow_fun = {}
for i in fact_mod:
    pow_fun[i]=power_func(i,denom-2,denom)

max_tot = 0
min_tot = 0
for i in range(N-K+1):
    max_tot += (A[i] * combi2(N-i-1, K-1, denom, fact_mod,pow_fun)) % denom
    min_tot += (A[N-i-1] * combi2(N-i-1, K-1, denom, fact_mod,pow_fun)) % denom
    
print((max_tot - min_tot)%denom)
### BUGGY CODE ###

n=int(input())
d=list(map(int,input().split()))
if n>=24:
    print(0)
    exit()
op=[[0],[1]]
for i in range(n-1):
    tmp=[]
    for j in op:
        tmp.append(j+[0])
        tmp.append(j+[1])
    op=tmp
ans=0
for i in op:
    t=[0]
    for j in range(n):
        if i[j]==0:
            t.append(d[j])
        else:
            t.append(24-d[j])
    a=10000
    for p in range(1+n):
        for q in range(1+n):
            if p>q:
                b=abs(t[p]-t[q])
                a=min(a,min(b,24-b))
    ans=max(ans,a)
print(ans)


### FIXED CODE ###

n=int(input())
d=list(map(int,input().split()))
if n>=24:
    print(0)
    exit()
if n>=22:
    t=[]
    d.append(0)
    d.sort()
    f=1
    for i in range(n):
        if d[i]==d[i+1]:
            f+=1
        else:
            if f>2:
                print(0)
                exit()
            f=1
    print(1)
    exit()

op=2**n-1
ans=0
for i in range(op):
    t=[0]
    for j in range(n):
        if i&(2**j)>0:
            t.append(d[j])
        else:
            t.append(24-d[j])
    a=10000
    for p in range(1,1+n):
        for q in range(p):
            b=abs(t[p]-t[q])
            a=min(a,min(b,24-b))
    ans=max(ans,a)
print(ans)
### BUGGY CODE ###

input()
S = input()
cnt = 0
for i in range(0, 1000):
  c = (i//100, (i//10)%10, i%10)
  f = 0
  for s in S:
    if int(s) == c[f]:
      f += 1 
      if f==3:break 
  if f==3:cnt += 1
print(cnt)

### FIXED CODE ###

input()
S = [int(i) for i in input()]
cnt = 0
for i in range(0, 1000):
  c = (i//100, (i//10)%10, i%10)
  f = 0
  for s in S:
    if s == c[f]:
      f += 1 
      if f==3:break 
  if f==3:cnt += 1
print(cnt)
### BUGGY CODE ###

import sys
import math
input = sys.stdin.readline


def main():
    sc = Scan()
    N = sc.intarr()[0]
    S = sc.strarr()[0]

    array = []
    for i in range(N):
        for j in range(i+1, N):
            for m in range(j+1, N):
                num = S[i] + S[j] + S[m]
                array.append(num)
    array = set(array)
    print(len(array))


class Scan():

    def intarr(self):
        line = input()
        array = line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


def display(array):
    for a in range(len(array)):
        if len(array) - a != 1:
            print(array[a], end=' ')
        else:
            print(array[a])


main()


### FIXED CODE ###

import sys
import math
input = sys.stdin.readline


def main():
    sc = Scan()
    _ = sc.intarr()[0]
    S = sc.strarr()[0]

    count = 0

    for i in range(1000):
        # print("--------")
        lucky = format_str(i)
        first = S.find(lucky[0])
        third = S.rfind(lucky[2])

        if first == -1 or third == -1:
            continue
        elif first < third:
            if lucky[1] in S[first + 1:third]:
                count += 1
    print(count)


def format_str(num):
    if num < 10:
        return "00" + str(num)
    elif num < 100:
        return "0" + str(num)
    else:
        return str(num)


class Scan():

    def intarr(self):
        line = input()
        array = line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


def display(array):
    for a in range(len(array)):
        if len(array) - a != 1:
            print(array[a], end=' ')
        else:
            print(array[a])


main()
### BUGGY CODE ###

n = int(input())
s = input()
cnt = 0
flag = False

for x in range(10):
	for y in range(10):
		for z in range(10):
			for i in range(n-2):
				if int(s[i]) == x:
					for j in range(i+1, n-1):
						if int(s[j]) == y:
							for k in range(j+1, n):
								if int(s[k]) == z:
									flag = True
									cnt += 1
									break
							if flag:
								break
					if flag:
						break
			
print(cnt)

### FIXED CODE ###

n = int(input())
s = input()
cnt = 0

for x in range(10):
	for y in range(10):
		for z in range(10):
			i = s.find(str(x))
			if i != -1:
				i = s.find(str(y), i+1)
				if i != -1:
					i = s.find(str(z), i+1)
					if i != -1:
						cnt += 1
				
print(cnt)
### BUGGY CODE ###

def main():
    H, W = map(int, input().split())
    grid = [list(input()) for _ in range(H)]
    L = [[0] * W for _ in range(H)]
    R = [[0] * W for _ in range(H)]
    D = [[0] * W for _ in range(H)]
    U = [[0] * W for _ in range(H)]
    for h in range(H):
        for w in range(W):
            if grid[h][w] == '#':
                continue
            if w == 0:
                L[h][w] = 1
            else:
                L[h][w] = L[h][w-1] + 1
            if h == 0:
                U[h][w] = 1
            else:
                U[h][w] = U[h-1][w] + 1
    for h in range(H - 1, -1, -1):
        for w in range(W - 1, -1, -1):
            if grid[h][w] == '#':
                continue
            if w == W - 1:
                R[h][w] = 1
            else:
                R[h][w] = R[h][w + 1] + 1
            if h == H - 1:
                D[h][w] = 1
            else:
                D[h][w] = D[h + 1][w] + 1
    ans = 0
    for h in range(H):
        for w in range(W):
            ans = max(ans, L[h][w] + R[h][w] + U[h][w] + D[h][w] - 3)
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    H, W = map(int, input().split())
    grid = [list(input()) for _ in range(H)]
    L = [[0] * W for _ in range(H)]
    R = [[0] * W for _ in range(H)]
    D = [[0] * W for _ in range(H)]
    U = [[0] * W for _ in range(H)]
    for h in range(H):
        for w in range(W):
            if grid[h][w] == '#':
                continue
            if w == 0:
                L[h][w] = 1
            else:
                L[h][w] = L[h][w-1] + 1
            if h == 0:
                U[h][w] = 1
            else:
                U[h][w] = U[h-1][w] + 1
    for h in range(H - 1, -1, -1):
        for w in range(W - 1, -1, -1):
            if grid[h][w] == '#':
                continue
            if w == W - 1:
                R[h][w] = 1
            else:
                R[h][w] = R[h][w + 1] + 1
            if h == H - 1:
                D[h][w] = 1
            else:
                D[h][w] = D[h + 1][w] + 1
    ans = 0
    for h in range(H):
        for w in range(W):
            ans = max(ans, L[h][w] + R[h][w] + U[h][w] + D[h][w] - 3)
    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

from operator import mul
N = int(input())
from functools import reduce
A = list(map(int, input().split()))
sum=reduce(mul,A)

if sum>1000000000000000000:
    sum = -1

print(sum)

### FIXED CODE ###


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

if 0 in A:
    print(0)
else:
    for n in range(N):
        sum = sum * A[n]
        if sum>1000000000000000000:
            print(-1)
            break
    else:
        print(sum)
### BUGGY CODE ###

import numpy as np
from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())

Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1

maze = [input() for _ in range(H)]

INF = 10 ** 12

score = np.zeros((H, W), dtype=int)
score[:, :] = INF
score[Ch, Cw] = 0

candidates = deque()
candidates.append((Ch, Cw))

walk = [(0, 1), (0, -1), (-1, 0), (1, 0)]
warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]

while candidates:
    h, w = candidates.popleft()
    # move
    for dh, dw in walk:
        y = h + dh
        x = w + dw
        s = score[h, w]
        if y < 0 or H <= y:
            continue
        if x < 0 or W <= x:
            continue        
        if maze[y][x] == '.' and score[y, x] > s:
            score[y, x] = s
            candidates.appendleft((y, x))
    # warp
    for dh, dw in warp:
        y = h + dh
        x = w + dw
        s = score[h, w]
        if y < 0 or H <= y:
            continue
        if x < 0 or W <= x:
            continue
        if maze[y][x] == '.' and score[y, x] > s + 1:
            score[y, x] = s + 1
            candidates.append((y, x))

if score[Dh, Dw] == INF:
    print(-1)
else:
    print (score[Dh, Dw])

### FIXED CODE ###

#import numpy as np
from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())

Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1

maze = [input() for _ in range(H)]

INF = 10 ** 12

score = [[INF] * W for _ in range(H)]

score[Ch][Cw] = 0

candidates = deque()
candidates.append((Ch, Cw))

walk = [(0, 1), (0, -1), (-1, 0), (1, 0)]
warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]

while candidates:
    h, w = candidates.popleft()
    # move
    for dh, dw in walk:
        y = h + dh
        x = w + dw
        s = score[h][w]
        if y < 0 or H <= y:
            continue
        if x < 0 or W <= x:
            continue        
        if maze[y][x] == '.' and score[y][x] > s:
            score[y][x] = s
            candidates.appendleft((y, x))
    # warp
    for dh, dw in warp:
        y = h + dh
        x = w + dw
        s = score[h][w]
        if y < 0 or H <= y:
            continue
        if x < 0 or W <= x:
            continue
        if maze[y][x] == '.' and score[y][x] > s + 1:
            score[y][x] = s + 1
            candidates.append((y, x))

if score[Dh][Dw] == INF:
    print(-1)
else:
    print (score[Dh][Dw])
### BUGGY CODE ###

from itertools import accumulate
from bisect import bisect_left

N = int(input())
C = [0]+list(accumulate(map(int,input().split())))

def helper(i,j):
  m = (C[j]+C[i])/2
  k = bisect_left(C, m, lo=i+1,hi=j-1)

  if k > i+1:
    _,a,b = min((abs(m-C[x]),C[x]-C[i],C[j]-C[x]) for x in (k-1,k))
  else:
    a,b = C[k]-C[i],C[j]-C[k]
  return a,b


m = bisect_left(C,C[N]/2)
if m < 2:
  m = 2
elif m > N-2:
  m = N-2

L = helper(0,m)+helper(m,N)
best = max(L)-min(L)

i = m+1
while i < N-1 and abs(abs(C[N]-C[i])-abs(C[i])) < best*2:
  L = helper(0,i)+helper(i,N)
  best = min(best, max(L)-min(L))
  i += 1

i = m-1
while i > 1 and abs(abs(C[N]-C[i])-abs(C[i])) < best*2:
  L = helper(0,i)+helper(i,N)
  best = min(best, max(L)-min(L))
  i -= 1


print(best)

### FIXED CODE ###

from itertools import accumulate
from bisect import bisect

N = int(input())
C = [0]+list(accumulate(map(int,input().split())))

def h(i,j):
  ci,cj = C[i],C[j]
  k = bisect(C, (ci+cj)//2, lo=i+1,hi=j)
  _,a,b = min((abs(ci+cj-2*c),cj-c,c-ci) for c in (C[k-1],C[k]))
  return a,b

def solve(x):
  L = h(0,x)+h(x,N)
  return max(L)-min(L)

print(min(solve(i) for i in range(2,N-1)))
### BUGGY CODE ###

import math

N = int(input())
upper = int(math.sqrt(N)) + 1
#print(upper)

for n in range(1,N+1):
    myans = 0
    for x in range(1, upper):
        for y in range(1, upper):
            for z in range(1, upper):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
                    #print(x,y,z,x**2 + y**2 + z**2 + x*y + y*z + z*x)
                    myans += 1
    print(myans)

### FIXED CODE ###


N = int(input())
myans = [ 0 for n in range(N+1)]
upper = int(N**(2/3))
#print(upper)
for x in range(1, 105):
    for y in range(1, 105):
        for z in range(1, 105):
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v < N+1:
                myans[v] += 1
#print(myans)
for a,b in enumerate(myans):
    if a != 0:
        print(b)
### BUGGY CODE ###

N=int(input())
p=list(map(int,input().split()))
a=[]
for i in range(N):
  for k in range(i):
    if p[i]>=p[k]:
     a.append(p[i])
c=set(a)
print(N-len(c))

### FIXED CODE ###

N=int(input())
p=list(map(int,input().split()))
a=[]
k=p[0]
for i in range(1,N):
    if k>p[i]:
     a.append(p[i])
     k=p[i] 
print(len(a)+1)
### BUGGY CODE ###

N = int(input())
c = input()

x =[0] * N

for i, cc in enumerate(c):
    if cc == "R":
        x[i] = 1

#一番左が赤だと削れる
#一番右が白だと削れる
cmd = 0
while len(x) > 0:
    if x[0] == 1:
        x.pop(0)
    if len(x) > 0:
        if x[-1] == 0:
            x.pop(-1)
    if len(x) > 0:
        if x[0] == 0 and x[-1] == 1:
            x[0] = 1
            x[-1] = 0
            cmd += 1

print(cmd)







### FIXED CODE ###

N = int(input())
c = input()

x =[0] * N

ww = 0
rr = 0
for i, cc in enumerate(c):
    if cc == "R":
        x[i] = 1
        rr += 1
    else:
        ww += 1

cmd = 0
for i in range(rr):
    if x[i] == 0:
        cmd += 1

cmd2 = 0
for j in range(rr+1, len(x)):
    if x[j] == 1:
        cmd2 += 1


print(max(cmd, cmd2))
### BUGGY CODE ###

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

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

res = {}
start = None

if n == 1:
    if k % 2:
        print(*arr)
    else:
        print(*[])
    exit()

for i in range(1, k + 1):
    if not start:
        response = []
        for elem in arr:
            if elem not in response:
                response.append(elem)
            else:
                idx = response.index(elem)
                response = response[:idx]
        if not response:
            print(*response)
            exit()
        start = response[0]
        res[i] = 0
        continue

    idx = -1
    while start in arr[idx + 1:]:
        idx += arr[idx+1:].index(start) + 2
        if idx < len(arr):
            start = arr[idx]
        else:
            break

    res[i] = idx
    if idx == len(arr):
        k %= len(res)
        if not k:
            k = len(res)
        break

answer = res[k]
response = []
for elem in arr[answer:]:
    if elem not in response:
        response.append(elem)
    else:
        idx = response.index(elem)
        response = response[:idx]
print(*response)


### FIXED CODE ###

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

if n == 1:
    if k % 2:
        print(*arr)
    else:
        print(*[])
    exit()

table = {}
original_table = {}
move = {}

for i, a in enumerate(arr):
    if a not in table:
        table[a] = i
        original_table[a] = i
    else:
        move[table[a]], move[i] = i + 1, original_table[a] + 1
        table[a] = i

res = {}
idx = 0

for i in range(1, k + 1):
    while idx in move and move[idx] > idx:
        idx = move[idx]

    res[i] = idx
    if idx == len(arr):
        k %= len(res)
        if not k:
            k = len(res)
        break

    if idx in move:
        idx = move[idx]
    else:
        idx += 1

idx = res[k]
response = []

while idx < len(arr):
    while idx in move and move[idx] > idx:
        idx = move[idx]
    if idx < len(arr):
        response.append(arr[idx])
    idx += 1

print(*response)
### BUGGY CODE ###


N, Q = map(int, input().split())
S = input()
LRs = [list(map(int, input().split())) for i in range(Q)]

counts = []
for i in range(len(S)-1):
    if S[i] == 'A' and S[i+1] == 'C':
        counts.append(1)
    else:
        counts.append(0)
counts.append(0)

for LR in LRs:
    start = LR[0] - 1
    end = LR[1] 
#     print(S[start:end])
#     print(counts[start:(end-1)])
    print(sum(counts[start:(end-1)]))
    

### FIXED CODE ###


N, Q = map(int, input().split())
S = input()
LRs = [list(map(int, input().split())) for i in range(Q)]

counts = []
for i in range(len(S)-1):
    if S[i] == 'A' and S[i+1] == 'C':
        counts.append(1)
    else:
        counts.append(0)
counts.append(0)

rev_counts = [0]
for i in reversed(range(len(S)-1)):
    rev_counts.append(rev_counts[-1] + counts[i])
rev_counts = list(reversed(rev_counts))
# print(counts)
# print(rev_counts)


for LR in LRs:
    start = LR[0] - 1
    end = LR[1]  -1
    print(rev_counts[start] - rev_counts[end])
### BUGGY CODE ###

from bisect import insort

X, Y, Z, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

z = [[0] * Y for _ in range(X)]
n = []
for x in range(X) :
    for y in range(Y) :
        n.append((A[x]+B[y]+C[0], (x, y)))
n.sort()

for _ in range(K) :
    cur, (x, y) = n.pop()
    # print(cur, x, y)
    if z[x][y] < Z - 1 :
        z[x][y] += 1
        insort(n, (A[x]+B[y]+C[z[x][y]], (x, y)))
    print(cur)
    

### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

s = []
for x in range(X) :
    for y in range(Y) :
        s.append(A[x]+B[y])
s.sort(reverse=True)

t = []
for k in range(min(K, len(s))) :
    for z in range(Z) :
        t.append(s[k]+C[z])
        
t.sort(reverse=True)

print("\n".join(map(str, t[:K])))
### BUGGY CODE ###

N = int(input())
A = sorted([int(i) for i in input().split()])

dp = [-1] * (A[-1]+1)
ans = 0
for i in range(N):
    a = A[i]
    if dp[a] == -1 and A.count(a) == 1:
        ans += 1
        for j in range(a+a, A[-1]+1, a):
            dp[j] = 0
    else:
        continue

print(ans)

### FIXED CODE ###

from collections import Counter

N = int(input())
A = [int(i) for i in input().split()]
num = set(A)
count = Counter(A)
dp = [True] * (10**6 + 1)

for a in num:
    for n in range(a+a, 10**6+1, a):
        dp[n] = False

ans = 0
for a in num:
    if count[a] == 1 and dp[a] == True:
        ans += 1

print(ans)