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

n,k = map(int,input().split())         # n=町の個数 , k=テレポート回数
a_list = list(map(int,input().split()))         # 各町のテレポート先リスト
dum = a_list[0]                        # dum=次のテレポート先
k = k - 1                              # テレポート回数をデクリメント
ans_list = [1]                         # 訪れた町を ans_list に格納
ok = True
while(1):
    #print(dum,ans_list)
    if ok and ans_list.count(dum) == 1:
        ind = ans_list.index(dum)
        loop = ans_list[ind:]
        len_loop = len(loop)
        k = k % len_loop
        ans_list = []
        ok = False

    if k == 0:
        print(int(dum))
        break
    if ok:
        ans_list.append(dum)
    dum = a_list[int(dum)-1]
    k = k - 1



### FIXED CODE ###

n,k = map(int,input().split())         # n=町の個数 , k=テレポート回数
a_list = list(map(int,input().split()))     # 各町のテレポート先リスト
dum = a_list[0]                        # dum=次のテレポート先
k = k - 1                              # テレポート回数をデクリメント
ans_list = [1]                         # 訪れた町を ans_list に格納
ok = True
check_list = n*[0]
check_list[0] = 1
for i in range(k+1):
    if ok and check_list[dum-1] == 1:
        #print(dum,111)
        ind = ans_list.index(dum)
        loop = ans_list[ind:]
        len_loop = len(loop)
        k = k % len_loop
        ans_list = []
        ok = False
    else:
        check_list[dum-1] = 1

    if k == 0:
        print(int(dum))
        break
    ans_list.append(dum)
    dum = a_list[int(dum)-1]
    k = k - 1
### BUGGY CODE ###

import copy
def main():
    h, w = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(h)]
    b = [list(map(int, input().split())) for _ in range(h)]
    m = (h+w+5)*80
    dp = [[False]*(m+1) for _ in range(w)]
    dp[0][abs(a[0][0] - b[0][0])] = True
    for i in range(1, w):
        x = abs(a[0][i] - b[0][i])
        for j in range(m+1):
            if dp[i-1][j]:
                if j+x <= m:
                    dp[i][j+x] = True
                dp[i][abs(j-x)] = True
    for i in range(1, h):
        for j in range(w):
            buf = [False]*(m+1)
            x = abs(a[i][j] - b[i][j])
            for k in range(m+1):
                f = False
                if j == 0:
                    if dp[0][k]:
                        f = True
                else:
                    if dp[j-1][k] or dp[j][k]:
                        f = True
                if f:
                    if k+x <= m:
                        buf[k+x] = True
                    buf[abs(k-x)] = True
            dp[j] = copy.deepcopy(buf)
    for i in range(m+1):
        if dp[w-1][i]:
            print(i)
            break

if __name__ == "__main__":
    main()

### FIXED CODE ###

import numpy as np
def main():
    h, w = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(h)]
    b = [list(map(int, input().split())) for _ in range(h)]
    n = 80*(80+80) + 10
    m = n//2
    dp = [[None]*w for i in range(h)]
    for i in range(h):
        for j in range(w):
            dp[i][j] = np.zeros(n, np.bool)
    dp[0][0][m+abs(a[0][0] - b[0][0])] = True
    dp[0][0][m-abs(a[0][0] - b[0][0])] = True
    for i in range(h):
        for j in range(w):
            x = abs(a[i][j] - b[i][j])
            if 0 < i and 0 < h:
                dp[i][j][x:] |= dp[i-1][j][:n-x]
                dp[i][j][:n-x] |= dp[i-1][j][x:]
                dp[i][j][x:] |= dp[i][j-1][:n-x]
                dp[i][j][:n-x] |= dp[i][j-1][x:]
            elif 0 < i:
                dp[i][j][x:] |= dp[i-1][j][:n-x]
                dp[i][j][:n-x] |= dp[i-1][j][x:]
            elif 0 < j:
                dp[i][j][x:] |= dp[i][j-1][:n-x]
                dp[i][j][:n-x] |= dp[i][j-1][x:]
    ans = float("inf")
    for i in range(m-80-1, m+80+2):
        if dp[h-1][w-1][i]:
            ans = min(ans, abs(m-i))
    print(ans)

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

from fractions import gcd
from functools import reduce, lru_cache

MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

@lru_cache()
def lcm(x, y):
    return int(x*y)//int(gcd(x, y))

B = [1 for i in range(N)]
global_lcm = reduce(lcm, A)
ans = 0
for i in range(N):
    B[i] = int(global_lcm//A[i])
    ans += B[i] % MOD
    ans %= MOD

print(ans)

### FIXED CODE ###

from fractions import gcd
from functools import reduce, lru_cache

MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

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

B = [1 for i in range(N)]
global_lcm = reduce(lcm, A) % MOD
ans = 0
for i in range(N):
    ans += (global_lcm*pow(A[i], MOD-2, MOD)) % MOD
    ans %= MOD

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

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

dp = [[0] * (N + 1) for _ in range(N + 1)]
for l in range(1, N + 1):
  for i in range(N + 1 - l):
    j = i + l
    if (N - l) % 2 == 0:
      dp[i][j] = max(dp[i + 1][j] + a[i], dp[i][j - 1] + a[j - 1])
    else:
      dp[i][j] = min(dp[i + 1][j] - a[i], dp[i][j - 1] - a[j - 1])
print(dp[0][N])


### FIXED CODE ###

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

dp = [[0] * (N + 1) for _ in range(N + 1)]
for l in range(1, N + 1):
  for i in range(N + 1 - l):
    j = i + l
    if (N - l) % 2 == 0:
      dp[i][j] = max(dp[i + 1][j] + a[i], dp[i][j - 1] + a[j - 1])
    else:
      dp[i][j] = min(dp[i + 1][j] - a[i], dp[i][j - 1] - a[j - 1])
print(dp[0][N])
### BUGGY CODE ###

from collections import defaultdict
def f(n,k):
    to = defaultdict(list)
    for _ in range(n - 1):
        a, b = map(int, input().split())
        to[a] += [b]
        to[b] += [a]
    ans = 1
    fin = [0] * (n + 1)
    nd = [1]
    while nd:
        nnd = []
        for i in nd:
            nk = k
            for i1 in to[i]:
                if fin[i1] == 0:
                    nnd.append(i1)
                else:
                    nk -= 1
                nk-=sum(fin[i2] for i2 in to[i1] if i2!=i)
            fin[i] = 1
            ans = ans * nk % md
        nd = nnd
    print(ans)
md=10**9+7
n,k=map(int,input().split())
f(n,k)


### FIXED CODE ###

from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 6)

def per(a, b):
    t = (a, b)
    if t in memo:
        return memo[t]
    re = 1
    for i in range(b):
        re = re * (a - i) % md
    memo[t] = re
    return re

def dfs(i, oi):
    cnt_ko = len(to[i])
    if i == 1:
        re = k * per(k - 1, cnt_ko) % md
    elif cnt_ko == 1:
        return 1
    else:
        re = per(k - 2, cnt_ko - 1)
    for ki in to[i]:
        if ki == oi: continue
        re = re * dfs(ki, i) % md
    return re

md = 10 ** 9 + 7
memo = {}
n, k = map(int, input().split())
to = defaultdict(list)
for _ in range(n - 1):
    a, b = map(int, input().split())
    to[a] += [b]
    to[b] += [a]
print(dfs(1, 0))
### BUGGY CODE ###

#!usr/bin/env python3
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    n, k = LI()
    a = LI()
    ans = [1]*n
    for i in range(k-1, n):
        for j in range(k):
            ans[i] *= a[i-j]
        if i > k-1:
            if i == 0 or ans[i] > ans[i-1]:
                print('Yes')
            else:
                print('No')
    return


# Solve
if __name__ == "__main__":
    solve()


### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    n, k = LI()
    a = LI()
    for i in range(k, n):
        if a[i] > a[i-k]:
            print('Yes')
        else:
            print('No')
    return


# Solve
if __name__ == "__main__":
    solve()
### BUGGY CODE ###

s,t=[tuple(input()) for u in (1,1)]
l,li=[['' for i in range(len(s)+1)] for j in (1,1)]
for j in range(len(t)):
  for i in range(len(s)):
    if t[j]==s[i]:
      l[i+1]=li[i]+t[j]
    else:l[i+1]=li[i+1] if len(li[i+1])>len(l[i]) else l[i]
    li=l
print(l[-1])

### FIXED CODE ###

s,t=input(),input()
n,m=len(s),len(t)
dp=[[0]*(m+1) for i in range(n+1)]
for i in range(n):
  for j in range(m):
    if s[i]==t[j]:
      dp[i+1][j+1]=dp[i][j]+1
    else:
      dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])
ans=""
while m>0 and n>0:
  if s[n-1]==t[m-1]:ans=s[n-1]+ans;n-=1;m-=1
  elif dp[n][m]==dp[n-1][m]:n-=1
  else:m-=1
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
# input
n = int(input())
R = []
for i in range(n):
    R.append(int(input()))

# calc
maximum = -10**9
for i in range(n):
    for j in range(i+1, n):
        if R[j] - R[i] > maximum:
            maximum = R[j] - R[i]

# output
print(maximum)

### FIXED CODE ###

n = int(input())
max_diff = -10**10

current_min = int(input())

for _ in range(n-1):
    current = int(input())
    diff = current - current_min
    if diff > max_diff:
        max_diff = diff
    if current < current_min:
        current_min = current
print(max_diff)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
N, K = map(int,input().split())
H = list(map(int,input().split()))
DP = [0]*N
for _ in range(1,N):
  Hi = H[_]
  DP[_] = min( [DP[j] + abs(Hi - H[j]) for j in range(max(0,_-K),_)])
print(DP[-1])

### FIXED CODE ###

N, K = map(int,input().split())
H = list(map(int,input().split()))
import numpy as np
dp = np.zeros(N,dtype=np.int)
harr = np.array(H)
for i in range(1,N):
  St = max(0,i-K)
  Hi = harr[i]
  dp[i] = min(dp[max(0,i-K):i] + np.abs(Hi - harr[max(0,i-K):i]))
print(dp[-1])
### BUGGY CODE ###

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

class Graph(object):
	def __init__(self):
		self.graph = defaultdict(list)

	def __len__(self):
		return len(self.graph)

	def add_edge(self, a, b):
		self.graph[a].append(b)

def DFS(G, W, Wlist, visit, node):
	for i in G.graph[node]:
		if visit[i] != "Yes":
			visit[i] = "Yes"
			DFS(G, W, Wlist, visit, i)
			W[node] += W[i]
			Wlist[node].append(W[i])

#処理内容
def main():
	#入力
	N = int(input())
	G = Graph()
	for i in range(N - 1):
		a, b = getlist()
		a -= 1; b -= 1
		G.add_edge(a, b)
		G.add_edge(b, a)

	#DFS
	W = [1] * N
	Wlist = [[0] for i in range(N)]
	visit = ["No"] * N
	visit[0] = "Yes"
	DFS(G, W, Wlist, visit, 0)
	# print(W)
	# print(Wlist)
	for i in range(N):
		Wlist[i].append(N - W[i])

	# print(Wlist)
	ans_up = 0
	pow2 = pow(2, N - 1, con)
	for i in range(N):
		ans_up += pow2 - 1
		for j in Wlist[i]:
			ans_up -= pow(2, j, con) - 1
			ans_up %= con

	# print(ans_up)

	ans = ans_up * pow(pow2 * 2, con - 2, con)
	print(ans % con)

if __name__ == '__main__':
	main()

### FIXED CODE ###

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
from collections import deque
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

class Graph(object):
	def __init__(self):
		self.graph = defaultdict(list)

	def __len__(self):
		return len(self.graph)

	def add_edge(self, a, b):
		self.graph[a].append(b)

def DFS(G, W, Wlist, visit, node):
	for i in G.graph[node]:
		if visit[i] == 0:
			visit[i] = 1
			DFS(G, W, Wlist, visit, i)
			W[node] += W[i]
			Wlist.append(W[i])

class BFS(object):
	def __init__(self, graph, s, N):
		self.g = graph.graph
		self.Q = deque(); self.Q.append(s)
		self.dist = [INF] * N; self.dist[s] = 0
		self.prev = [None] * N; self.prev[s] = -1
		self.order = []
		while self.Q:
			v = self.Q.popleft()
			self.order.append(v)
			for i in self.g[v]:
				if self.dist[i] == INF:
					self.dist[i] = self.dist[v] + 1
					self.prev[i] = v
					self.Q.append(i)


#処理内容
def main():
	#入力
	N = int(input())
	G = Graph()
	Nedge = [0] * N
	for i in range(N - 1):
		a, b = getlist()
		a -= 1; b -= 1
		G.add_edge(a, b)
		G.add_edge(b, a)
		Nedge[a] += 1; Nedge[b] += 1

	W = [1] * N
	#葉の場合の処理
	# for i in range(N):
	# 	if Nedge[i] == 1:
	# 		W[i] = 1

	BF = BFS(G, 0, N)

	for i in range(N - 1, 0, -1):
		v = BF.order[i]
		W[BF.prev[v]] += W[v]

	Wlist = []
	for i in range(N):
		for j in G.graph[i]:
			if j != BF.prev[i]:
				Wlist.append(W[j])
	for i in range(N):
		Wlist.append(N - W[i])

	pow2 = pow(2, N - 1, con)
	ans_up = N * (pow2 - 1)
	for i in Wlist:
		ans_up -= pow(2, i, con) - 1
		ans_up %= con

	ans = ans_up * pow(pow2 * 2, con - 2, con)
	print(ans % con)

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

import sys
input=sys.stdin.readline
import collections

def main():
    N = int(input())
    Q = [collections.deque(map(int, input().split())) for _ in range(N)]
    games = N*(N-1)//2

    days = 0
    for _ in range(games):
        gamed = [0 for _ in range(N)]
        for i in range(N-1):
            if gamed[i] or not len(Q[i]):
                continue
            j = Q[i][0] - 1
            if gamed[j] or not len(Q[j]):
                continue
            if Q[j][0] == i+1:
#                print("game:", j+1, i+1, days)
                Q[i].popleft()
                Q[j].popleft()
                gamed[i] = gamed[j] = 1
                games -= 1
        days += 1
        if not 1 in gamed:
            print(-1)
            return
        if games == 0:
            break

    print(days)
if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input=sys.stdin.readline
from collections import deque

def main():
    N = int(input())
    Q = [deque(map(int, input().split())) for _ in range(N)]
    games = N*(N-1)//2

    days = 0
    nxt = [i for i in range(N)] # 翌日に対戦相手を更新する選手のリスト
    opp = [0]*N # 選手毎の、次の対戦相手のリスト
    while 1:
        days += 1
        for i in nxt:
            opp[i] = Q[i].popleft() - 1 if Q[i] else -1

        tmp = set() # 次の日の更新のため、試合をした選手をメモ
        for i in nxt:
            if i not in tmp and i == opp[opp[i]]:
#                print("game:", i+1, opp[i]+1, days)
                tmp.add(i)
                tmp.add(opp[i])
                games -= 1
        if games == 0:
            break
        elif not tmp:
            print(-1)
            return
        nxt = tmp
    print(days)

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

N=int(input())
L=list(input() for i in range(N))
M=sorted(set(L))
S=[]
for i in M:
  c=0
  for j in range(N):
    if L[j]==i:
      c+=1
  S.append(c)
maxs=0
for i in range(len(S)):
  if S[i]>maxs:
    maxl=[]
    maxl.append(i)
    maxs=S[i]
  elif S[i]==maxs:
    maxl.append(i)
for i in maxl:
  print(M[i])

### FIXED CODE ###

N=int(input())
L=list(input() for i in range(N))
L=sorted(L)
X=L[0]
c=0
d=0
e=[]
for i in range(N):
  if L[i]==X:
    c+=1
    if i==N-1 and c>d:
      e=[X]
    elif i==N-1 and c==d:
      e.append(X)
  elif L[i]!=X and d<c:
    d=c
    c=0
    e=[]
    e.append(X)
    X=L[i]
    c+=1
  elif L[i]!=X and d==c:
    c=1
    e.append(X)
    X=L[i]
    if i==N-1:
      e.append(X)
  elif L[i]!=X and d>c:
    c=0
    X=L[i]
    c+=1
for i in e:
  print(i)
### BUGGY CODE ###


H, W = map(int, input().split())
edges = [["#" for i in range(W+2)]] + [["#"] + [None for i in range(W)] + ["#"] for j in range(H)] + [["#" for i in range(W+2)]]

for i in range(1, H+1):
  S = input()
  for j in range(1, W+1):
    edges[i][j] = S[j-1]

def dfs(x, y):
  flag = 1

  for next in [(x+1, y), (x-1, y), (x, y+1), (x, y-1)]:
    a, b = next
    while edges[b][a] == ".":
      flag += 1
      if x - a > 0:
        a -= 1
      elif x - a < 0:
        a += 1
      elif y - b > 0:
        b -= 1
      elif y - b < 0:
        b += 1
  
  return flag

ans = -1
for h in range(1, H+1):
  for w in range(1, W+1):
    if edges[h][w] == "#":
      continue
    ans = max(ans, dfs(w, h))

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 ###

k=int(input())
s=0
import math
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            g=math.gcd(math.gcd(a,b),c)
            s+=g
print(s)


### FIXED CODE ###

k=int(input())
s=0
import math
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            s+=math.gcd(math.gcd(a,b),c)
print(s)
### BUGGY CODE ###

N = int(input())


def query(i):
    print(i)
    s = input()
    if s == 'Vacant':
        exit()
    return s


def is_ok(ind):
    global ng
    global leftans
    # 左ならTrue
    response = query(ind)
    if (ind-ng) % 2 == 1:
        return leftans == response
    else:
        leftans = response
        return leftans != response


def bin_search_meguru():
    global ng
    """
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng, okは,とり得る最小の値-1,とり得る最大の値+1
    """

    # 適当にいじる
    ng = 0  # ind=0が条件を満たすこともあるため
    ok = N  # ind=len(a)-1が条件を満たさないこともあるため

    # いじらない
    # okとngのどちらが大きいかわからないことを考慮
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return False


leftans = query(0)
bin_search_meguru()


### FIXED CODE ###

N = int(input())


def query(i):
    print(i)
    s = input()
    if s == 'Vacant':
        exit()
    return s


root = query(0)


def is_ok(ind):
    # 左ならTrue
    response = query(ind)
    if ind % 2 == 1:
        return root == response
    else:
        return root != response


def bin_search_meguru():
    """
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng, okは,とり得る最小の値-1,とり得る最大の値+1
    """

    # 適当にいじる
    ng = -1  # ind=0が条件を満たすこともあるため
    ok = N  # ind=len(a)-1が条件を満たさないこともあるため

    # いじらない
    # okとngのどちらが大きいかわからないことを考慮
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return False


bin_search_meguru()
### BUGGY CODE ###

N = int(input())
ans = 1000000000001

for i in range(N):
  if N % (i+1) == 0:
    if (N/(i+1)) + (i+1) -2 < ans:
      ans = int((N/(i+1)) + (i+1) -2)

print(ans)

### FIXED CODE ###

N = int(input())
ans = 1000000000001

for i in range(int(N**0.5)):
  if N % (i+1) == 0:
    A = N / (i+1)
    B = (i+1)
    if A + B - 2 < ans:
      ans = int(A + B - 2)
print(ans)
### BUGGY CODE ###

S = list(input())
N = len(S)
Pos = [0 for i in range(N)]

for i in range(N):
    count = 0
    if S[i] == 'R':
        while S[i + count] != 'L':
            count += 1
        if count % 2 == 0:
            Pos[i + count] += 1
        else:
            Pos[i + count - 1] += 1
    else:
        while S[i - count] != 'R':
            count += 1
        if count % 2 == 0:
            Pos[i - count] += 1
        else:
            Pos[i - count + 1] += 1
    #print(count)
    #print(*Pos)

print(*Pos)

### FIXED CODE ###

S = list(input())
N = len(S)
Pos = [0 for i in range(N)]

i = 0
while i < N:
    count = 0
    if S[i] == 'R':
        while S[i + count] != 'L':
            count += 1
        if count % 2 == 0:
            Pos[i + count] += count // 2
            Pos[i + count - 1] += count // 2
        else:
            Pos[i + count - 1] += count // 2 + 1
            Pos[i + count] += count // 2
    else:
        while i + count < N and S[i + count] != 'R':
            count += 1
        if count % 2 == 0:
            Pos[i] += count // 2
            Pos[i - 1] += count // 2
        else:
            Pos[i] += count // 2 + 1
            Pos[i - 1] += count // 2
    #print(count)
    i = i + count
    #print(*Pos)

print(*Pos)
### BUGGY CODE ###

n = int(input())
h = list(map(int,input().split()))
count = [0] * n

for j in range(n):
	for i in range(j,n-1):
		if h[i] >= h[i+1]:
			count[j] += 1
		else:
			break

print(max(count))


### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
count = [0] * n
MAX = 0

j = 0
for i in range(j,n-1):
	if h[i] >= h[i+1]:
		count[j] += 1
	else:
		j += 1

for i in range(n):
	if MAX < count[i]:
		MAX = count[i]
	i = count[i] + 2

print(MAX)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

N = int(input())
A = list(map(int, input().split()))
MOD = 10**9+ 7

ans = 0
for i in range(61):
  n = sum([int(bin(a>>i)[-1]) for a in A])
  ans += n * (N - n) * (2 ** i)
print(ans%MOD)

### FIXED CODE ###

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

N = int(input())
A = list(map(int, input().split()))
MOD = 10**9+ 7

ans = 0
two = 1
for i in range(61):
  n = len([ a for a in A if (a >> i) & 1 ])
  ans += (n * (N - n) * two % MOD)
  two *= 2 
print(ans%MOD)
### BUGGY CODE ###

import bisect

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

Z=[-100000000000000000]
T=[-100000000000000000]

for i in range(A):
    s=int(input())
    Z.append(s)
Z.append(100000000000000000)
for i in range(B):
    t=int(input())
    T.append(t)
T.append(100000000000000000)
    
for i in range(Q):
    x=int(input())
    a=max(Z[bisect.bisect_left(Z,x)],T[bisect.bisect_left(T,x)])-x
    b=x-min(Z[bisect.bisect_left(Z,x)-1],T[bisect.bisect_left(T,x)-1])
    c=Z[bisect.bisect_left(Z,x)]-T[bisect.bisect_left(T,x)-1]+(x-T[bisect.bisect_left(T,x)-1])
    d=Z[bisect.bisect_left(Z,x)]-T[bisect.bisect_left(T,x)-1]+(Z[bisect.bisect_left(Z,x)]-x)
    e=T[bisect.bisect_left(T,x)]-Z[bisect.bisect_left(Z,x)-1]+(x-Z[bisect.bisect_left(Z,x)-1])
    f=T[bisect.bisect_left(T,x)]-Z[bisect.bisect_left(Z,x)-1]+(T[bisect.bisect_left(T,x)]-x)
    print(min(a,b,c,d,e,f))

### FIXED CODE ###

import bisect
import sys
input = sys.stdin.readline
A,B,Q=map(int,input().split())

Z=[-10**10]
T=[-10**10]

for i in range(A):
    s=int(input())
    Z.append(s)
Z.append(10**11)
for i in range(B):
    t=int(input())
    T.append(t)
T.append(10**11)
    
for i in range(Q):
    x=int(input())
    a=max(Z[bisect.bisect_left(Z,x)],T[bisect.bisect_left(T,x)])-x
    b=x-min(Z[bisect.bisect_left(Z,x)-1],T[bisect.bisect_left(T,x)-1])
    c=Z[bisect.bisect_left(Z,x)]-T[bisect.bisect_left(T,x)-1]+(x-T[bisect.bisect_left(T,x)-1])
    d=Z[bisect.bisect_left(Z,x)]-T[bisect.bisect_left(T,x)-1]+(Z[bisect.bisect_left(Z,x)]-x)
    e=T[bisect.bisect_left(T,x)]-Z[bisect.bisect_left(Z,x)-1]+(x-Z[bisect.bisect_left(Z,x)-1])
    f=T[bisect.bisect_left(T,x)]-Z[bisect.bisect_left(Z,x)-1]+(T[bisect.bisect_left(T,x)]-x)
    print(min(a,b,c,d,e,f))