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

import numpy as np

n = int(input())
a = list(map(int,input().split()))
m = 0
ans= np.array([])
for i in reversed(range(n)):
  z = np.count_nonzero(ans%(i+1)==0)
  if (z+a[i])%2==1:
    ans = np.append(ans,i+1)
    m+= 1
  else:
    pass
ans = ans.tolist()
ans = [int(i) for i in ans]
print(m)
print(*ans)
    
  

### FIXED CODE ###

n = int(input())
A = list(map(int,input().split()))
ans= []
B = [0]*n
for i in reversed(range(n)):
  if sum(B[i::i+1])%2!=A[i]:
    ans.append(i+1)
    B[i]+= 1
print(len(ans))   
print(*ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

import math

def main():
    x = int(input())

    for b in range(10**9):
        y = (x + (-1*b)**5)**(1/5)
        if type(y) == float:
            y = math.floor(y * 10 ** 6) / (10 ** 6)
            if y % 1 == 0:
                print(int((x + (-1*b)**5)**(1/5)), -1*b)
                break


if __name__ == '__main__':
    main()


### FIXED CODE ###

X = int(input())
C= [i**5 for i in range(120)]

a = 0
b = 0

for a in range(len(C)):
    for b in range(len(C)):
        if C[a] + C[b] == X:
            print(a, -b)
            exit(0)
        elif C[a] - C[b] == X:
            print(a, b)
            exit(0)
### BUGGY CODE ###

import math
import sys

a, b, n = map(int, input().split())
array = range(1, n+1, math.ceil(1/10**5))
ans = -sys.maxsize-1

for x in array:
    val = int((a*x)/b) - a*int(x/b)
    if val > ans:
        ans = val

print(ans)


### FIXED CODE ###

a, b, n = map(int, input().split())
x = min(b-1, n)
ans = int((a*x)/b) - a*int(x/b)
print(ans)
### BUGGY CODE ###

def main():
    N = int(input())
    a = list(map(int, input().split()))
    inf = 10 ** 13
    dp = [[0]*N for i in range(N)]
    s = [0] * (N+1)
    for i, x in enumerate(a):
        s[i+1] = s[i] + x
        dp[i][i] = 0
    for i in range(N-2, -1, -1):
        DP = dp[i]
        si = s[i]
        for j in range(i+1, N):
            tmp = s[j+1] - si
            D = inf
            for k in range(i, j):
                if D > DP[k]+dp[k+1][j]:
                    D = DP[k]+dp[k+1][j]
            DP[j] = D + tmp
    print(dp[0][N-1])
main()


### FIXED CODE ###

def main():
    N = int(input())
    a = list(map(int, input().split()))

    dp = [[10**13]*N for i in range(N)]
    s = [0] * (N+1)
    for i in range(N):
        s[i+1] = s[i] + a[i]
        dp[i][i] = 0
    for i in range(N-1, -1, -1):
        for j in range(i+1, N):
            tmp = s[j+1] - s[i]
            for k in range(i, j):
                dp[i][j] = min(dp[i][j], dp[i][k]+dp[k+1][j] + tmp)

    print(dp[0][N-1])


main()
### BUGGY CODE ###

N=int(input())
d={}
for i in range(N):
  tmp = input()
  if tmp in d:
    d[tmp] += 1
  else:
    d[tmp] = 1

a = d.items()
b = d.values()
max_k_list = [kv[0] for kv in a if kv[1] == max(b)]
[print(i) for i in sorted(max_k_list)]

### FIXED CODE ###

N=int(input())
d={}
for i in range(N):
  tmp = input()
  if tmp in d:
    d[tmp] += 1
  else:
    d[tmp] = 1

max_v=max(d.values())
ans=list(filter(lambda x: x[1] == max_v, d.items()))
[print(i[0]) for i in sorted(ans)]
### BUGGY CODE ###

N, u, v = map(int, input().split())
u, v = u-1, v-1
AB = [list(map(int, input().split())) for a in range(N-1)]

G = [[0 for b in range(N)] for a in range(N)]

for ab in AB:
  G[ab[0]-1][ab[1]-1] = 1
  G[ab[1]-1][ab[0]-1] = 1

def dfs(current, goal, distance, prev):
  if current == goal:
    return distance
  dists = [0]
  for i in range(N):
    if G[current][i] == 1 and i != prev and i != current:
      dists.append(dfs(i, goal, distance + 1, current))
  return max(dists)

distances = [0]
for i in range(N):
  count = 0
  for j in range(N):
    if G[i][j] == 1:
      count += 1
  if count == 1:
    distances.append(dfs(i, v, 0, -1))

print(max(distances)-1)


### FIXED CODE ###

from collections import deque
N, u, v = map(int, input().split())
u, v = u-1, v-1
AB = [list(map(int, input().split())) for a in range(N-1)]

G = [[] for a in range(N)]

for ab in AB:
  G[ab[0]-1].append(ab[1]-1)
  G[ab[1]-1].append(ab[0]-1)

qA = deque([v])
qT = deque([u])
costsA = [0 for a in range(N)]
doneA = [0 for a in range(N)]
costsT = [0 for a in range(N)]
doneT = [0 for a in range(N)]

doneA[v] = 1
doneT[u] = 1

def bfs(q, costs, done):
  while q:
    start = q.popleft()
    for i in G[start]:
      if done[i] == 0:
        q.append(i)
        costs[i] = costs[start] + 1
        done[i] = 1

bfs(qA, costsA, doneA)
bfs(qT, costsT, doneT)

distances = [0]
for i in range(N):
  if costsA[i] > costsT[i]:
    distances.append(costsA[i])

print(max(distances)-1)
### BUGGY CODE ###

from bisect import bisect_left


def main():
    n, m = map(int, input().split())
    arr = list(map(int, input().split()))
    arr.sort()
    s = 0

    bc = [list(map(int, input().split())) for _ in range(m)]
    bc.sort(key=lambda x: x[1], reverse=True)

    for b, c in bc:
        idx = bisect_left(arr, c)

        if b >= idx:
            s += sum(arr[idx:])
            arr = [c] * idx
        else:
            s += sum(arr[idx:])
            arr = arr[b:idx] + [c] * b

        if not arr:
            break

    print(s + sum(arr))


main()

### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    s = 0

    bc = [list(map(int, input().split())) for _ in range(m)]
    bc.sort(key=lambda x: x[1], reverse=True)

    arr = []
    sum_b = 0
    for b, c in bc:
        arr += [c] * b
        sum_b += b
        if sum_b >= n:
            break

    arr += a
    arr.sort(reverse=True)
    print(sum(arr[:n]))


main()
### BUGGY CODE ###

S=input()
counter=0

while S.find('W') != -1:
    for i in range(len(S)):
        if S[i]=='B':
            counter+=1
        else:
            temp = S[:i]+S[i+1:]
            S =temp
            break

print(counter)

### FIXED CODE ###

S=input()
counter=0
result = 0

for i in range(len(S)):
    if S[i]=='B':
        counter+=1
    else:
        result +=counter

print(result)
### BUGGY CODE ###

s=input()
k=int(input())

lis=[]
for i in range(len(s)):
    lis.append(s[i:len(s)])
    lis.sort()

l=[]
for i in lis[:5]:
    for j in range(5):
        l.append(i[:j+1])

l=set(l)
l=list(l)

l.sort()

print(l[k-1])

### FIXED CODE ###

s=input()
k=int(input())

lis=[]
for i in range(len(s)):
    lis.append(s[i:i+5])
    lis.sort()

l=[]
for i in lis[:5]:
    for j in range(5):
        l.append(i[:j+1])

l=set(l)
l=list(l)

l.sort()

print(l[k-1])
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

from heapq import heappop, heappush

N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

q = []
push = lambda x,i: heappush(q, (-x,i))
for i,x in enumerate(B):
    push(x,i)

answer = 0
while q:
    x,i = heappop(q)
    x = -x
    dx = x - A[i]
    if dx < 0:
        answer = -1
        break
    nbd = B[(i-1)%N] + B[(i+1)%N]
    t = dx // nbd
    if t == 0:
        if dx == 0:
            continue
        answer = -1
        break
    B[i] -= nbd * t
    answer += t
    push(B[i],i)

print(answer)



### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

from heapq import heappop, heappush

N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

q = []
push = lambda x,i: heappush(q, (-x,i))
for i,x in enumerate(B):
    push(x,i)

answer = 0
while q:
    x,i = heappop(q)
    x = -x
    if x < A[i]:
        answer = -1
        break
    dx = x-A[i]
    nbd = B[(i-1)%N] + B[(i+1)%N]
    t = dx // nbd
    if t == 0:
        if x == A[i]:
            continue
        answer = -1
        break
    B[i] -= nbd * t
    answer += t
    push(B[i],i)

print(answer)
### BUGGY CODE ###

n = int(input())
h = list(map(int,input().split()))
count = 0
done = False
h_max = -1
while done == False:
    start = 0
    for i in range(n):
        if i > 0 and h[i-1] >= 0 and h[i] <= 0:
            count += 1
        elif i == n-1 and h[i] > 0:
            count += 1
        h[i] -= 1

        if h_max < h[i]:
            h_max = h[i]
    if h_max == 0:
        done = True
print(count)


### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
count = 0
done = False
while done == False:
    for i in range(n):
        if h[i] >= 0:
            h[i] -= 1
        
        if i > 0 and h[i] < 0 and h[i-1] >= 0:
            count += 1

        if i == n-1 and h[i] >= 0:
            count += 1
    if max(h) <= 0:
        done = True
print(count)
### BUGGY CODE ###

import copy
import statistics
n = int(input())
x = [int(y) for y in input().split()]
z = copy.deepcopy(x)

for i in range(n):
  x.pop(i)
  print(statistics.median(x))
  x.insert(i, z[i])

### FIXED CODE ###

import copy
import statistics
n = int(input())
x = [int(y) for y in input().split()]
z = copy.deepcopy(x)
z.sort()
t = (z[int(n / 2) - 1] + z[int(n / 2)]) / 2

for i in range(n):
  if x[i] < t:
    print(z[int(n / 2)])
  else:
    print(z[int(n / 2) - 1])
### BUGGY CODE ###

import itertools

N,Q = map(int,input().split())
S = input()
lr = [map(int,input().split()) for _ in range(Q)]
l_r = [list(i) for i in zip(*lr)] 

scc = list(itertools.accumulate(S))

for i in range(Q):
    right = scc[l_r[1][i]-1]
    left = right[l_r[0][i]-1:]
    print(left.count("AC"))

### FIXED CODE ###

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


t = [0] * (N+1)

for i in range(N):
    if S[i : i+2] == "AC":
        t[i+1] = t[i] + 1
    else:
        t[i+1] = t[i]

for j in range(Q):
    l,r = map(int,input().split())
    print(t[r-1] - t[l-1])
### BUGGY CODE ###

from collections import deque
import copy
n = int(input())

games = [0]*n

for i in range(n):
  games[i] = deque([int(x) for x in input().split()])

ans = 0
already = [False]*n
fin = 0
rev=0
while True:
  flag = False
  key = copy.deepcopy(already)
  if rev%2:
    for i in range(n):
      if key[i]:
        continue
      k = games[i][0]-1
      if key[k]:
        continue
      if games[k][0] == i+1:
        flag = True
        key[k] = True
        key[i] = True
        games[k].popleft()
        games[i].popleft()
        if len(games[k]) == 0:
          already[k] = True
          fin += 1
        if len(games[i]) == 0:
          already[i] = True
          fin += 1
  else:
    for i in range(n-1, -1, -1):
      if key[i]:
        continue
      k = games[i][0]-1
      if key[k]:
        continue
      if games[k][0] == i+1:
        flag = True
        key[k] = True
        key[i] = True
        games[k].popleft()
        games[i].popleft()
        if len(games[k]) == 0:
          already[k] = True
          fin += 1
        if len(games[i]) == 0:
          already[i] = True
          fin += 1
  if flag:
    ans += 1
  else:
    ans = -1
    break
  if fin == n:
    break
  rev += 1
  
print(ans)




### FIXED CODE ###

import sys
from copy import deepcopy as copy

def main():
    input = sys.stdin.readline
    n = int(input())
    a = [None]*n
    for i in range(n):
        a[i] = [int(x)-1 for x in input().split()]
    
    index = [0]*n
    search = [int(x) for x in range(n)]
    ans = 0
    while True:
        already = set()
        judge = True
        sub = []
        for key in search:
            if index[key] == n-1:
                continue
            key2 = a[key][index[key]]
            if index[key2] == n-1:
                continue
            if key != a[key2][index[key2]]:
                continue
            if key in already or key2 in already:
                continue
            already.add(key)
            already.add(key2)
            index[key] += 1
            index[key2] += 1
            sub.append(key)
            sub.append(key2)
            judge = False
        if judge:
            break
        ans += 1
        search = copy(sub)
        
    for value in index:
        if value != n-1:
            print(-1)
            sys.exit()
    print(ans)
    
if __name__ == "__main__":
    main()
### BUGGY CODE ###

import numpy as np
N, M = map(int, input().split())
A = tuple([int(input()) for _ in range(M)])
MOD = 1000000007

dp = np.zeros(N + 2, dtype='int')
dp[0] = 1
for now in range(N):
    for _next in range(now + 1, now + 3):
        if _next not in A:
            dp[_next] += dp[now]
            dp[_next] %= MOD
print(dp[N])


### FIXED CODE ###

import numpy as np
N, M = map(int, input().split())
A = np.ones(N + 2, dtype='bool')
for _ in range(M):
    A[int(input())] = False
MOD = 1000000007

dp = np.zeros(N + 2, dtype='int')
dp[0] = 1
for now in range(N):
    for _next in range(now + 1, now + 3):
        if A[_next]:
            dp[_next] += dp[now]
            dp[_next] %= MOD
print(dp[N])
### BUGGY CODE ###

N = int(input())
s = []
for _ in range(N):
  s.append(str(input()))
  
cnt = 0

for i in range(N-1):
  s1 = s[i]
  s1list = list(s1)
  for j in range(i+1, N):
    s2 = s[j]
    s2list = list(s2)
    for c in s1list:
      try:
        s2list.remove(str(c))
      except:
        continue
    if not s2list:
      cnt += 1
print(cnt)

### FIXED CODE ###

from collections import Counter
N = int(input())
s = []
cnt = 0
for _ in range(N):
  a = str(input())
  alist = sorted(list(a))
  s.append(str(''.join(alist)))
  
l = Counter(s)
for i in l.values():
  if i > 1:
    cnt += (i - 1) * i / 2
print(int(cnt))
### BUGGY CODE ###

import sys
import itertools
sys.setrecursionlimit(10000)
def resolve():
    N = int(input())
    Reds = [list(map(int, input().split(" "))) for i in range(N)]
    Blues = [list(map(int, input().split(" "))) for i in range(N)]
    maxpairs = 0
    for blues in itertools.permutations(Blues, N):
        npairs = 0
        for i in range(N):
            if able_to_be_pair(Reds[i], blues[i]):
                npairs += 1
        maxpairs = max(maxpairs, npairs)
    print(maxpairs)

def able_to_be_pair(red, blue):
    return True if (blue[0] - red[0]) > 0 and (blue[1] - red[1]) > 0 else False

if '__main__' == __name__:
    resolve()

### FIXED CODE ###

import sys
import itertools
sys.setrecursionlimit(10000)
def resolve():
    N = int(input())
    Reds = sorted([list(map(int, input().split(" "))) for i in range(N)], key=lambda x: x[1], reverse=True)
    Blues = sorted([list(map(int, input().split(" "))) for i in range(N)], key=lambda x: x[0])
    used = []
    for red in Reds:
        for blue in Blues:
            if blue not in used and able_to_be_pair(red, blue):
                used.append(blue)
                break
    print(len(used))

def able_to_be_pair(red, blue):
    return True if (blue[0] - red[0]) > 0 and (blue[1] - red[1]) > 0 else False

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

import copy
S = input()

'''
def bit_cal(max_num,cal_list=[],current_cnt=0):
    new_list = []
    if len(cal_list) == 0:
        for i in range(2):
            new_list.append([i])
    else:
        for cal_val in cal_list:
            for i in range(2):
                tmp = copy.deepcopy(cal_val)
                tmp.append(i)
                new_list.append(tmp)
    current_cnt += 1
    if max_num == current_cnt:
        return new_list
    return bit_cal(max_num,new_list,current_cnt)
'''

def bit_cal(max_num,cal_list=[],current_cnt=0):
    new_list = []
    if len(cal_list) == 0:
        for i in range(2):
            new_list.append(str(i))
    else:
        for cal_val in cal_list:
            for i in range(2):
                new_list.append(cal_val + str(i))
    current_cnt += 1
    if max_num == current_cnt:
        return new_list
    return bit_cal(max_num,new_list,current_cnt)

all_plus_combination = bit_cal(len(S)-1)


ans = 0
for plus_combination in all_plus_combination:
    start_idx = 0
    for i in range(len(S)-1):
        if plus_combination[i] == '1':
            ans += int(S[start_idx:i+1])
            start_idx = i+1
    ans +=int(S[start_idx:100])
print(ans)



### FIXED CODE ###

import copy
S = input()

'''
bit探索
2 進数表記した場合の下から数えて n 桁目（一番下の桁を 0 とします）が 1 であるかどうかをチェックするためのコードは、(i >> n) & 1 
'''
def bit_cal2(n):
    return_list = ['']* (2 ** n)
    for i in range(2 ** n):
        for j in range(n):
            if ((i >> j) & 1):
                return_list[i] = return_list[i] + '1'
            else:
                return_list[i] = return_list[i] + '0'
    return return_list

#自作のは遅かった
'''
def bit_cal(max_num,cal_list=[],current_cnt=0):
    new_list = []
    if len(cal_list) == 0:
        for i in range(2):
            new_list.append([i])
    else:
        for cal_val in cal_list:
            for i in range(2):
                tmp = copy.deepcopy(cal_val)
                tmp.append(i)
                new_list.append(tmp)
    current_cnt += 1
    if max_num == current_cnt:
        return new_list
    return bit_cal(max_num,new_list,current_cnt)

'''
all_plus_combination = bit_cal2(len(S)-1)
ans = 0
for plus_combination in all_plus_combination:
    start_idx = 0
    for i in range(len(S)-1):
        if plus_combination[i] == '1':
            ans += int(S[start_idx:i+1])
            start_idx = i+1
    ans +=int(S[start_idx:100])
print(ans)
### BUGGY CODE ###

from math import sqrt
n = int(input())
m = int(sqrt(n))
lst = []
for i in range(2, m + 1):
    if n % i == 0:
        j = 0
        while True:
            if n % i == 0:
                n //= i
                j += 1
            else:
                for k in range(j):
                    lst.append(i)
                break

lst.append(n)

ans = float("INF")
for i in range(2 ** len(lst)):
    num1 = 1
    num2 = 1
    for j in range(len(lst)):
        if (i >> j) & 1:
            num1 *= lst[j]
        else:
            num2 *= lst[j]
    ans = min(ans, max(len(str(num1)), len(str(num2))))
    
print(ans)
            
            


### FIXED CODE ###

from math import sqrt
n = int(input())
m = int(sqrt(n))
lst = []
for i in range(2, m + 1):
    if n % i == 0:
        j = 0
        while True:
            if n % i == 0:
                n //= i
                j += 1
            else:
                for k in range(j):
                    lst.append(i)
                break

lst.append(n)

ans = float("INF")
for i in range(2 ** len(lst)):
    num1 = 1
    num2 = 1
    for j in range(len(lst)):
        if (i >> j) & 1:
            num1 *= lst[j]
        else:
            num2 *= lst[j]
    ans = min(ans, max(len(str(num1)), len(str(num2))))
    
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = 1
rev = 1
l = []
for i in range(n//2) :
    ans *= a[i]
    rev *= a[n-i-1]

l.append(ans)
l.append(rev)
if n % 2 == 1 :
    l.append(a[n//2+1])
else :
    l.append(1)

x = 1
for j in range(3):
    x *= l[j]

if x > 10**18 :
    print(-1)
else :
    print(x)


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
if 0 in a :
    ans  = 0
    print(ans)
else :
    ans = 1
    for i in range(n):
        ans *= a[i]
        if ans > 10**18 :
            print(-1)
            break
if ans <= 10**18 and ans != 0 :
    print(ans)
### BUGGY CODE ###

# ABC132 E
from collections import deque

f=lambda:map(int,input().split())
N,M=f()
G=[[] for _ in [0]*(N+1)]
for _ in [0]*M:
    a,b=f()
    G[a].append(b)
S,T=f()
    
def check(i):
    tmpF=[0]*(N+1)
    res=[i]
    for i in range(3):
        tmpres=[]
        tmpF=[0]*(N+1)
        for r in res:
            for node in G[r]:
                if tmpF[node]:
                    continue
                tmpres.append(node)
                tmpF[node]=1
        res=tmpres[:]
    return res

KKP=[[]]+[check(i+1) for i in range(N)]

F=[-1]*(N+1)
F[0]=-1
q=deque()
q.append((S,0))
while q:
    node,par=q.popleft()
    if F[node]>=0:
        continue
    F[node]=F[par]+1
    for nnode in KKP[node]:
        if F[nnode]>=0:
            continue
        q.append((nnode,node))
    if F[T]>=0:
        break
print(F[T])

### FIXED CODE ###

# ABC132 E
from collections import deque

f=lambda:map(int,input().split())
N,M=f()
G=[[] for _ in [0]*(N+1)]

for _ in [0]*M:
    a,b=f()
    G[a].append(b)
S,T=f()
S=(S,0)
T=(T,0)

q=deque()
q.append(S)
F=set()
res=-1
while q:
    node,r=q.popleft()
    if (node,r%3) in F:
        continue
    if (node,r%3) == T:
        res=r//3
        break
    F.add((node,r%3))
    for next_node in G[node]:
        if (next_node,(r+1)%3) in F:
            continue
        q.append((next_node,r+1))
print(res)
### BUGGY CODE ###

import sys

n = int(input())


for i in range(1, 3500):
    for j in range(1, 3500):
        # 分子
        rest = 4 * i * j - n * i - n * j
        if rest > 0:
            ans = n * i * j / rest
            if ans.is_integer():
                print(i, j, int(ans))
                sys.exit()

### FIXED CODE ###

import sys

n = int(input())


for i in range(1, 3500):
    for j in range(1, 3500):
        # 分子
        rest = 4 * i * j - n * i - n * j
        if rest > 0:
            ans = n * i * j / rest
            if ans.is_integer():
                print(i, j, int(ans))
                sys.exit()
### BUGGY CODE ###

N_ken,M_si = map(int,input().split())
ken_year_map = {}
ken_year_list = []

for si in range(1,M_si+1):
    ken,year = map(int,input().split())
    ken_year_list.append([ken,year])
    if ken in ken_year_map:
        ken_year_map[ken].append(year)
    else:
        ken_year_map[ken] = [year]
for i in ken_year_map:
    ken_year_map[i].sort()

for ken,year in ken_year_list:
    print((str(ken).zfill(6))+(str(ken_year_map[ken].index(year)+1)).zfill(6))

### FIXED CODE ###

import sys
input = sys.stdin.readline
import bisect

N_ken,M_si = map(int,input().split())
ken_year_map = {}
for i in range(1,N_ken+1):ken_year_map[i]=[]

ken_list = [0]*M_si
year_list = [0]*M_si

for si in range(M_si):
    ken_list[si],year_list[si] = map(int,input().split())
    ken_year_map[ken_list[si]] += [year_list[si]]
        
for i in ken_year_map:
    ken_year_map[i].sort()

for ken,year in zip(ken_list,year_list):
    print('{:06}{:06}'.format(ken,bisect.bisect_right(ken_year_map[ken], year)))
### BUGGY CODE ###

def get_expect(p):
    return 1.0 * (p + 1) / 2

def main():
    N, K = map(int, input().split(" "))
    P = list(map(int, input().split(" ")))
    print(max([
        sum([
            get_expect(p)
            for p in P[i:i + K]
        ])
        for i in range(N - K + 1)
    ]))


if __name__ == "__main__":
    main()

### FIXED CODE ###

import numpy as np
from scipy import signal

def main():
    N, K = map(int, input().split(" "))
    P = np.array(list(map(int, input().split(" "))))

    e = (P + 1) / 2

    t = np.ones((K))

    print(np.amax(
        signal.fftconvolve(
            e,
            t
        )
    ))

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

#!/usr/bin/env python3
N = int(input())

s = [] * 2
print(0, flush=True)
s[0] = input()
if s[0] == 'Vacant':
    exit()

l, r = 0, N
while r - l > 2:
    m = (l + r) // 2
    print(m, flush=True)
    s[1] = input()
    if s[1] != 'Vacant':
        exit()

    if s[0] == s[1]:
        l, r = (l, m) if (m - l) % 2 == 1 else (m, r)
    else:
        l, r = (m, r) if (m - l) % 2 == 1 else (l, m)
    s[0] = s[1]
print(m + 1, flush=True)


### FIXED CODE ###

#!/usr/bin/env python3
N = int(input())

print(0, flush=True)
w0 = input()
if w0 == 'Vacant':
    exit()

l, r = 0, N
while True:
    m = (l + r) // 2
    print(m, flush=True)
    w1 = input()
    if w1 == 'Vacant':
        break
    if m % 2 == (w0 != w1):
        l = m
    else:
        r = m
### BUGGY CODE ###

n = input()
array = []
for i in range(n):
	inst = raw_input().split()
	if inst[0] == "insert":
		array.insert(0,inst[1])
	if inst[0] == "delete" and inst[1] in array:
		array.remove(inst[1])
	if inst[0] == "deleteFirst" and len(array) > 0:
		del array[0]
	if inst[0] == "deleteLast" and len(array) > 0:
		del array[len(array)-1]
print " ".join(i for i in array)

### FIXED CODE ###

n = input()
array = []
base = 0
for i in xrange(n):
    inst = raw_input().split()
    if inst[0][0] == 'i':
        array.append(int(inst[1]))
    elif inst[0] == "delete":
        if int(inst[1]) in array:
            x = array[::-1].index(int(inst[1]))
            if x != -1 and int(inst[1]):
                del array[-x-1]
    elif inst[0][6] == 'F':
        array.pop()
    else:
        base += 1
print (" ".join(map(str,array[base:][::-1])))