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

N, K = map(int, input().split())
listp = tuple(map(int, input().split()))
ans = 0
for n in range(N-K+1):
    b = sum(listp[n:n+K])
    ansc = (b+K)/2
    if ansc > ans:
        ans = ansc
    else:
        pass    
print(ans)    


### FIXED CODE ###

N, K = map(int, input().split())
listp = tuple(map(int, input().split()))
bc =sum(listp[0:K])
b = sum(listp[0:K])
for n in range(1,N-K+1):
    b = b - listp[n-1]+listp[n+K-1]
    
    if b > bc:
        bc = b
    else:
        pass    
    #print(b)    
print((bc+K)/2)
### BUGGY CODE ###

n,a,b = [int(i) for i in input().split()]
#k=n//(a+b)
#ans=a*k+a*(n-(a+b))
ans=0
while n >= 0:
    ans+=min(a,n)
    n-=(a+b)
print(ans)


### FIXED CODE ###

n,a,b = [int(i) for i in input().split()]
if n!=(a+b): print(a*(n//(a+b))+min(a,n%(a+b)))
else: print(a)
### BUGGY CODE ###

from collections import deque
N,M=list(map(int,input().split()))
AB=[set() for i in range(N+1)]
node_list=[None]*(N+1)
class node():
    def __init__(self,i):
        self.node=i
        self.prev=None
def bfs(i):#１に到達
    Done=set()
    Done.add(i)
    d=deque([i])

    while(d):

        kako = set()
        k=d.popleft()
        if node_list[k] is None:
            n = node(k)
        else:
            n=node_list[k]
        for i in AB[k]:
            if i not in Done:
                jk=node(i)
                jk.prev=n
                node_list[i]=jk
                Done.add(i)
                d.append(i)
                if i==1:
                    return True,jk


        node_list[k]=n
    return False,0




for i in range(M):
    A,B=list(map(int,input().split()))
    AB[A].add(B)
    AB[B].add(A)
flag1=True
for i in range(2,N+1):
    flag,jk=bfs(i)
    if flag:
        if flag1:
            print("Yes")
            flag1=False

        while(jk.prev.node!=i):
            jk=jk.prev
        print(jk.node)


### FIXED CODE ###

from collections import deque
N,M=list(map(int,input().split()))
AB=[set() for i in range(N+1)]
room=[0]*(N+1)
pre=[None]*(N+1)
def bfs(i):#１に到達
    Done=set()
    Done.add(i)
    d=deque([i])
    # child=set()
    # child.add(i)
    # count=1
    while(d):
        k=d.popleft()
        # if k not in child:
        #     count+=1
        #     child=child.union(Done)
        # room[k]=count
        for i in AB[k]:
            if i not in Done:
                pre[i]=k
                Done.add(i)
                d.append(i)





for i in range(M):
    A,B=list(map(int,input().split()))
    AB[A].add(B)
    AB[B].add(A)

flag=True
bfs(1)
if pre.count(None)<=N+1:
    for i in range(2,N+1):
        if flag:
            print("Yes")
            flag=False
        if pre[i] is not None:
            print(pre[i])
else:print("No")
### BUGGY CODE ###

N, M = map(int, input().split())
a = [-10]
ans = -1
MOD = 10 ** 9 + 7
if N == 1:
    ans = 1
else:
    for i in range(M):
        a += [int(input())]
        if a[i + 1] - a[i] == 1:
            ans = 0
            break
if not ans in [0, 1]:
    memo = [0] * (N + 1)
    memo[0] = 1
    if 1 in a:
        memo[1] = 0
    else:
        memo[1] = 1
    for i in range(N - 1):
        if i + 2 in a:
            continue
        memo[i + 2] = memo[i] + memo[i + 1]
        memo[i + 2] = memo[i + 2] % MOD
    else:
        ans = memo[i + 2]
print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
a = []
ans = -1
MOD = 10 ** 9 + 7
if N == 1:
    ans = 1
else:
    if M > 0:
        a += [int(input())]
    for i in range(M - 1):
        a += [int(input())]
        if a[i + 1] - a[i] == 1:
            ans = 0
            break
    a.append([-1])
if not ans in [0, 1]:
    memo = [0] * (N + 1)
    memo[0] = 1
    memo[1] = 1
    try:
        if a[0] == 1:
            a.pop(0)
            memo[1] = 0
    except:
        pass
    j = 0
    for i in range(N - 1):
        if i + 2 == a[j]:
            j += 1
            continue
        memo[i + 2] = memo[i] + memo[i + 1]
        memo[i + 2] = memo[i + 2] % MOD
    else:
        ans = memo[i + 2]
print(ans)
### BUGGY CODE ###


H, W = map(int, input().split())
S = ["#" * (W + 2)] + ["#" + input() + "#" for _ in range(H)] + ["#" * (W + 2)]

LEFT = [[0 for j in range(W+2)] for i in range(H+2)]
RIGHT = [[0 for j in range(W+2)] for i in range(H+2)]
UP = [[0 for j in range(W+2)] for i in range(H+2)]
DOWN = [[0 for j in range(W+2)] for i in range(H+2)]

for h in range(H+2):
  for w in range(W+2):
    if S[h][w] == ".":
      LEFT[h][w] = LEFT[h][w-1] + 1
    else:
      LEFT[h][w] = 0

for h in range(H+2):
  for w in range(W+2)[::-1]:
    if S[h][w] == ".":
      RIGHT[h][w] = RIGHT[h][w+1] + 1
    else:
      RIGHT[h][w] = 0

for h in range(H+2)[::-1]:
  for w in range(W+2):
    if S[h][w] == ".":
      UP[h][w] = UP[h+1][w] + 1
    else:
      UP[h][w] = 0

for h in range(H+2):
  for w in range(W+2):
    if S[h][w] == ".":
      DOWN[h][w] = DOWN[h-1][w] + 1
    else:
      DOWN[h][w] = 0

ans = -1

for h in range(H+2):
  for w in range(W+2):
    value = RIGHT[h][w] + LEFT[h][w] + UP[h][w] + DOWN[h][w] - 3
    ans = max(ans, value)

print(ans)

### FIXED CODE ###


H, W = map(int, input().split())
S = ["#" * (W + 2)] + ["#" + input() + "#" for _ in range(H)] + ["#" * (W + 2)]

LEFT = [[0 for j in range(W+2)] for i in range(H+2)]
RIGHT = [[0 for j in range(W+2)] for i in range(H+2)]
UP = [[0 for j in range(W+2)] for i in range(H+2)]
DOWN = [[0 for j in range(W+2)] for i in range(H+2)]

for h in range(H+2):
  for w in range(W+2):
    if S[h][w] == ".":
      LEFT[h][w] = LEFT[h][w-1] + 1
    else:
      LEFT[h][w] = 0

for h in range(H+2):
  for w in range(W+2)[::-1]:
    if S[h][w] == ".":
      RIGHT[h][w] = RIGHT[h][w+1] + 1
    else:
      RIGHT[h][w] = 0

for h in range(H+2)[::-1]:
  for w in range(W+2):
    if S[h][w] == ".":
      UP[h][w] = UP[h+1][w] + 1
    else:
      UP[h][w] = 0

for h in range(H+2):
  for w in range(W+2):
    if S[h][w] == ".":
      DOWN[h][w] = DOWN[h-1][w] + 1
    else:
      DOWN[h][w] = 0

ans = -1

for h in range(H+2):
  for w in range(W+2):
    value = RIGHT[h][w] + LEFT[h][w] + UP[h][w] + DOWN[h][w] - 3
    ans = max(ans, value)

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

n = int(input())

l = [0] * n
for i in range(n):
    l[i] = input()

k = set(l)
m = 0
ans = []

for i in k:
    cnt = l.count(i)
    if cnt > m:
        m = cnt
        ans.clear()
        ans.append(i)
    elif cnt == m:
        ans.append(i)

ans.sort()

for i in ans:
    print(i)

### FIXED CODE ###

n = int(input())

words = {}

for i in range(n):
    key = input()
    if key not in words:
        words[key] = 0
    words[key] += 1

l = []
th = max(words.values())

for i,j in words.items():
    if th == j:
        l.append(i)

l.sort()

print(*l, sep="\n", end="")
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from bisect import bisect

def main():
    N, Q = LI()
    XST = []
    for _ in range(N):
        s, t, x = LI()
        s -= x
        t -= x
        XST.append([x, s, t])
    D = []
    for _ in range(Q):
        D.append(II())
    ts = []
    for x, s, t in XST:
        ts.append(s)
        ts.append(t)
    ts.sort()
    ts.append(INF)
    xs = [INF] * (N * 2 + 1)
    XST.sort(reverse=True)
    for x, s, t in XST:
        s0 = bisect(ts, s)
        t0 = bisect(ts, t)
        for i in range(s0, t0):
            xs[i] = x
    for d in D:
        y = bisect(ts, d)
        y = xs[y]
        if y == INF:
            y = -1
        print(y)
    return

main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from bisect import bisect_left

def main():
    N, Q = LI()
    XST = []
    for _ in range(N):
        s, t, x = LI()
        s -= x
        t -= x
        XST.append([x, s, t])
    D = []
    for _ in range(Q):
        D.append(II())
    ans = [-1] * Q
    nexts = [-1] * Q
    XST.sort()
    for x, s, t in XST:
        i = bisect_left(D, s)
        end = bisect_left(D, t)
        while i < end:
            if nexts[i] == -1:
                ans[i] = x
                nexts[i] = end
                i += 1
            else:
                i = nexts[i]
    for y in ans:
        print(y)
    return

main()
### BUGGY CODE ###

r, g, b, n = map(int, input().split())

ans = 0
for i in range(n // r + 1):
    for j in range(n // g + 1):
        if i * r + j * g > n:
            break
        k = n - (i * r + j * g)

        if k % b == 0:
            ans += 1

print(ans)

### FIXED CODE ###

r, g, b, n = map(int, input().split())

ans = 0
for i in range(n // r + 1):
    for j in range((n - i * r) // g + 1):
        k = n - (i * r + j * g)
        if k % b == 0:
            ans += 1

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

n, k = map(int, input().split())
arr = list(map(int, input().split())) + [0] * k

INF = 1 << 60

# dp初期化
dp = [INF] * (n + k)
dp[0] = 0

for i in range(1, n):
    dp[i] = min(dp[j] + abs(arr[i] - arr[j]) for j in range(max(i - k, 0), i))


print(dp[n - 1])

### FIXED CODE ###

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

# dp初期化
dp = [float("inf")] * n
dp[0] = 0

for i in range(1, n):
    dp[i] = min(dp[j] + abs(arr[i] - arr[j]) for j in range(max(i - k, 0), i))

print(dp[n - 1])
### BUGGY CODE ###

import math
b=list(map(int,input().split(" ")))
c=2*b[0]/b[1]
t=0
for i in range(1,int(c)+1):
    for j in range(1,int(c)+1):
        for k in range(1,int(c)+1):
            if (i+j-k)/2*b[1]>=1 and (i+j-k)/2*b[1]<=b[0] and math.modf((i+j-k)/2*b[1])[0]==0:
                if (k+j-i)/2*b[1]>=1 and (k+j-i)/2*b[1]<=b[0] and math.modf((k+j-i)/2*b[1])[0]==0:
                    if (i+k-j)/2*b[1]>=1 and (i+k-j)/2*b[1]<=b[0] and math.modf((i+k-j)/2*b[1])[0]==0:
                        t+=1
                        
print (t)

### FIXED CODE ###

n,k=map(int,input().split())
c=int(n/k)
if(k%2==1):
    print(c*c*c)
else:
    ans=c*c*c
    c=int((n+k/2)/int(k))
    print(c*c*c+ans)
### BUGGY CODE ###

N=int(input())
A=list(map(int, input().split()))
Q=int(input())
B,C=map(int, input().split())
rep=[i for i, x in enumerate(A) if x == B]
for i in range(len(rep)):
    A[rep[i]]=C
ans=sum(A)
print(ans)

for _ in range(Q-1):
    B,C=map(int, input().split())
    rep=[i for i, x in enumerate(A) if x == B]
    for i in range(len(rep)):
        A[rep[i]]=C
    ans+=(C-B)*len(rep)
    print(ans)

### FIXED CODE ###

mod=pow(10,5)+2
N=int(input())
num=[0]*mod
ans=0
A=list(map(int, input().split()))
for i in range(N):
    num[A[i]]+=1
    ans+=A[i]
Q=int(input())
for i in range(Q):
    B,C=map(int, input().split())
    cnt=num[B]
    num[C]+=num[B]
    num[B]=0
    ans+=(C-B)*cnt
    print(ans)
### BUGGY CODE ###

s = input()
q = int(input())
cnt = 0
for i in range(q):
    t = input()
    if t == '1':
        cnt = 1 - cnt
    else:
        t2, f, c = t.split()
        if cnt == 0:
            if f == '1':
                s = c+s
            else:
                s += c
        else:
            if f == '1':
                s += c
            else:
                s = c+s

if cnt == 0:
    print(s)
else:
    print(s[::-1])

### FIXED CODE ###

s = input()
q = int(input())
cnt = 0
l = ''
r = ''
for i in range(q):
    t = input()
    if t == '1':
        cnt = 1 - cnt
    else:
        t2, f, c = t.split()
        if cnt == 0:
            if f == '1':
                l = c + l
            else:
                r += c
        else:
            if f == '1':
                r += c
            else:
                l = c + l
                
if cnt == 0:
    print(l+s+r)
else:
    print(r[::-1]+s[::-1]+l[::-1])
### BUGGY CODE ###

n = int(input())
a = input().split()
b = []
for i in range(n):
    if i % 2 != n % 2:
        b.insert(0, a[i])
    else:
        b += a[i]
else:
    print(" ".join(b))

### FIXED CODE ###

from collections import deque

n = int(input())
a = input().split()
b = deque()

for i in range(n):
    if i % 2 != n % 2:
        b.appendleft(a[i])
    else:
        b.append(a[i])
else:
    print(*b)
### BUGGY CODE ###

from sys import stdin, setrecursionlimit

setrecursionlimit(1000000)


def main():
    def read_tree(n):
        tree = [[] for _ in range(n + 1)]
        for _ in range(n - 1):
            a, b = [int(x) for x in input().split()]
            tree[a].append(b)
        return tree

    def accumulate(tree, cnt):
        def walk(p, c):
            cnt[p] += c
            for n in tree[p]:
                walk(n, cnt[p])

        walk(1, 0)

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

    tree = read_tree(n)
    cnt = [0] * (n + 1)

    for _ in range(q):
        p, x = [int(x) for x in input().split()]
        cnt[p] += x
    
    accumulate(tree, cnt)

    for i in range(1, n + 1):
        print(cnt[i], end=" ")


main()


### FIXED CODE ###

from sys import stdin, setrecursionlimit

setrecursionlimit(1000000)


def main():
    def read_tree(n):
        parents = [0 for _ in range(n + 1)]
        for _ in range(n - 1):
            a, b = [int(x) for x in input().split()]
            parents[b] = a
        return parents

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

    parents = read_tree(n)
    cnt = [0] * (n + 1)

    for _ in range(q):
        p, x = [int(x) for x in input().split()]
        cnt[p] += x
    
    for i in range(1, n + 1):
        cnt[i] += cnt[parents[i]]

    for i in range(1, n + 1):
        print(cnt[i], end=" ")


main()
### BUGGY CODE ###

from operator import mul
from functools import reduce

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)

    mem_key = str(n) + '-' + str(r)
    if mem_key in mem:
        return mem[mem_key]

    val = fact[n] * factinv[r] * factinv[n-r] % p
    mem[mem_key] = val
    return val

MOD = 10 ** 9 + 7
N, K = map(int, input().split())
if K == 1:
    print(0)
    exit()

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

N = len(A)
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    factinv.append((factinv[-1] * inv[-1]) % MOD)

ans = 0
sum_num = 0
mem = {}
for i in range(N - (K - 1)):
    for j in range(i+K-1, N):
        ans += (((A[j] - A[i]) % MOD) * cmb(j-i-1, K-2, MOD)) % MOD
print(ans % MOD)


### FIXED CODE ###

MOD = 10 ** 9 + 7

def ncr(n, r, mod=MOD):
    return (fct[n] * invf[r] * invf[n - r]) % mod


def make_tables(n, mod=MOD):
    fct = [1 for _ in range(n + 1)]
    invf = [1 for _ in range(n + 1)]

    for i in range(2, n + 1):
        fct[i] = (fct[i - 1] * i) % mod
        invf[i] = divmod(fct[i])
    return fct, invf


def divmod(a, mod=MOD):
    return pow(a, mod - 2, mod)


N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
for i in range(N):
    A[i] %= MOD

fct, invf = make_tables(N, mod=MOD)

ans = 0
for i in range(N - K + 1):
    ans += ((A[-1-i] - A[i]) % MOD * ncr(N - i - 1, K - 1)) % MOD
print(ans % MOD)
### BUGGY CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def MAP(): return map(int, input().split())
inf = sys.maxsize

h, w, k = MAP()
s = [[int(i) for i in STR()] for _ in range(h)]

ans = inf
for i in range(2 ** (h - 1)): #縦方向の割り方を全探索 O(500)
    hdiv = [1 if i & 2 ** j else 0 for j in range(h - 1)]
    hdiv.append(1)
    sh = sum(hdiv)
    tmpans = sh - 1
    partsum = [0 for _ in range(sh)]
    j = 0
    while j < w: #O(2 * 10 ** 4)
        tmp = 0
        idx = 0
        for kk in range(h): #O(10)
            tmp += s[kk][j]
            if hdiv[kk]:
                partsum[idx] += tmp
                tmp = 0
                idx += 1
        flag = True
        for kk in range(sh):
            if partsum[kk] > k:
                tmpans += 1
                for l in range(sh):
                    partsum[l] = 0
                flag = False
        if flag:
            j += 1
    ans = min(ans, tmpans)
print(ans)


### FIXED CODE ###

import sys
inf = sys.maxsize

if __name__ == '__main__':
    h, w, k = map(int, sys.stdin.readline().strip().split())
    s = [[int(i) for i in sys.stdin.readline().strip()] for _ in range(h)]
    
    ans = inf
    for i in range(2 ** (h - 1)): #縦方向の割り方を全探索 O(512)
        hdiv = [1 if i & 2 ** j else 0 for j in range(h - 1)]
        hdiv.append(1)
        sh = sum(hdiv)
        tmpans = sh - 1
        partsum = [0 for _ in range(sh)]
        partsum_p = [0 for _ in range(sh)]
        j = 0
        for j in range(w): #O(10 ** 3)
            tmp = 0
            idx = 0
            flag = False
            for kk in range(h): #O(10)
                tmp += s[kk][j]
                if hdiv[kk]:
                    partsum_p[idx] = partsum[idx]
                    partsum[idx] += tmp
                    if partsum[idx] > k and not flag:
                        tmpans += 1
                        flag = True
                    tmp = 0
                    idx += 1
            if flag:
                partsum = [partsum[l] - partsum_p[l] for l in range(sh)]
                partsum_p = [0 for _ in range(sh)]
                for kk in range(sh):
                    if partsum[kk] > k:
                        tmpans = inf
                        break
        ans = min(ans, tmpans)
    print(ans)
### BUGGY CODE ###

rules = ['dream', 'dreamer', 'erase', 'eraser']

s = input()
stack = [0]
mem = [0]
ok = False
while len(stack) > 0:
    start_id = stack.pop()
    string = s[start_id:]
    if string == '':
        print('YES')
        ok = True
        break
    for rule in rules:
        if string.startswith(rule):
            next_start_id = start_id + len(rule)
            part = string[next_start_id:]
            if part not in mem:
                stack.append(next_start_id)
                mem.append(next_start_id)
if not ok:
    print('NO')

### FIXED CODE ###

rules = ['dream', 'dreamer', 'erase', 'eraser']

s = input()
stack = [0]
mem = [0 for _ in range(len(s)+1)]
ok = False
while len(stack) > 0:
    start_id = stack.pop()
    string = s[start_id:]
    if start_id == len(s):
        print('YES')
        ok = True
        break

    for rule in rules:
        if string.startswith(rule):
            next_start_id = start_id + len(rule)
            if next_start_id <= len(s):
                part = string[next_start_id:]
                if mem[next_start_id] == 0:
                    stack.append(next_start_id)
                    mem[next_start_id] = 1
if not ok:
    print('NO')
### BUGGY CODE ###

N,M=map(int,input().split())
d={}
PY=[]
for _ in range(M):
    p,y=map(int,input().split())
    PY.append((p,y))
    d[p]=d.get(p, [])+[y]

import bisect

for k, v in d.items():
    d[k]=sorted(v)

for p,y in PY:
    print(str(p).zfill(6)+str(bisect.bisect_left(d[p],y)+1).zfill(6))

### FIXED CODE ###

N,M=map(int,input().split())
d={}
PY=[]
import bisect
for _ in range(M):
    p,y=map(int,input().split())
    PY.append((p,y))
    t=d.get(p, [0])
    i=bisect.bisect_left(t,y)
    t.insert(i,y)
    d[p]=t
    
dx={}
for k, v in d.items():
    for i in range(len(v)):
        dx[(k,v[i])]=i
        
for p,y in PY:
    print(str(p).zfill(6)+str(dx[(p,y)]).zfill(6))
### BUGGY CODE ###

n, m = [int(v) for v in input().split(' ')]

costs = []
links = []
for i in range(n):
    costs.append([0] * i)
    links.append([])

for i in range(m):
    l, r, c = [int(v) for v in input().split(' ')]
    l -= 1
    r -= 1

    for j in range(l, r):
        for k in range(j + 1, r + 1):
            c0 = costs[k][j]
            if c0 == 0 or c0 > c:
                costs[k][j] = c
                links[k].append(j)

import heapq
h = []
closed = 0

heapq.heappush(h, (0, n-1))

while len(h) > 0:
    c0, n1 = heapq.heappop(h)
    if n1 == 0:
        print(c0)
        exit()

    for n2 in links[n1]:
        c1 = costs[n1][n2]
        heapq.heappush(h, (c0 + c1, n2))

print("-1")

### FIXED CODE ###

import heapq

n, m = [int(v) for v in input().split(' ')]

links = []
for i in range(n):
    links.append([])

for i in range(m):
    l, r, c = [int(v) for v in input().split(' ')]
    l -= 1
    r -= 1
    links[r].append((l, c))

h = []
heapq.heappush(h, (0, n-1))
closed = 0
while len(h) > 0:
    c0, n0 = heapq.heappop(h)
    if (closed & (1 << n0)) != 0:
        continue
    closed |= (1 << n0)
    if n0 == 0:
        print(c0)
        exit()

    for n1, c1 in links[n0]:
        if (closed & (1 << n1)) != 0:
            continue
        heapq.heappush(h, (c0 + c1, n1))

    n2 = n0 + 1
    if n2 < n:
        if (closed & (1 << n2)) == 0:
            heapq.heappush(h, (c0, n2))

print("-1")
### BUGGY CODE ###

t = int(input())
buf = []
for _ in range(t):
    n = int(input())
    aaa = list(map(int, input().split()))
    s = input()
    can = {0}

    for i in range(n - 1, -1, -1):
        c = s[i]
        a = aaa[i]
        if c == '0':
            for b in list(can):
                can.add(a ^ b)
        else:
            new_can = set()
            for b in can:
                if a ^ b in can:
                    new_can.add(b)
            can = new_can
            if len(can) == 0:
                break

    if 0 in can:
        buf.append(0)
    else:
        buf.append(1)

print('\n'.join(map(str, buf)))


### FIXED CODE ###

from itertools import groupby, chain
from operator import itemgetter


def sweep(l):
    result = []
    s = set(l)
    while s:
        a = max(s)
        b = 1 << (a.bit_length() - 1)
        s = {t ^ a if t >= b else t for t in s}
        s.discard(0)
        result.append([a, b])

    return result


t = int(input())
buf = []
for _ in range(t):
    n = int(input())
    aaa = list(map(int, input().split()))
    s = input()

    if s[-1] == '1':
        buf.append(1)
        continue

    grp = [list(map(itemgetter(1), itr)) for c, itr in groupby(zip(s, aaa), key=itemgetter(0))]
    if s[0] == '0':
        grp = grp[1:]
    grp1 = grp[0::2]
    grp0 = grp[1::2]
    erasable = [False] * sum(len(g) for g in grp1)
    for i in range(len(grp1)):
        l1 = list(chain(*grp1[:i + 1]))
        l0 = list(chain(*grp0[i:]))
        s0 = sweep(l0)

        for a, b in s0:
            for i in range(len(l1)):
                if l1[i] & b:
                    l1[i] ^= a

        for j, c in enumerate(l1):
            if c == 0:
                erasable[j] = True

    if all(erasable):
        buf.append(0)
    else:
        buf.append(1)


print('\n'.join(map(str, buf)))
### BUGGY CODE ###

import sys
input = sys.stdin.readline
#N, K = (int(i) for i in input().split())
#B = [int(x) for x in input().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]

N, K = (int(i) for i in input().split())
A = [int(x) for x in input().split()]

cur = 1
for i in range(K-1):
    cur *= A[i]

pre = cur*A[K-1] 
cur = pre

#print(pre)
count = 0
for i in range(K, N):
    cur = cur//A[count] * A[i]
    #print(cur)
    if pre < cur:
        print("Yes")
    else:
        print("No")
    pre = cur
    count += 1


### FIXED CODE ###

import sys
input = sys.stdin.readline
#N, K = (int(i) for i in input().split())
#B = [int(x) for x in input().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]

N, K = (int(i) for i in input().split())
A = [int(x) for x in input().split()]

for i in range(K, N):
    if A[i - K] < A[i]:
        print("Yes")
    else:
        print("No")