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

import numpy as np


N,K,Q=input().split()

N=int(N)
K=int(K)
Q=int(Q)
arr=np.full(N, K)
for i in range(Q):
	A=int(input())
	arr-=1
	arr[A-1]+=1

for j in arr:
	if j>0:
		print("Yes")
	else:
		print("No")

### FIXED CODE ###

import numpy as np


N,K,Q=input().split()

N=int(N)
K=int(K)
Q=int(Q)
arr=np.full(N, K)
arr-=Q
for i in range(Q):
	A=int(input())
	arr[A-1]+=1
for j in arr:
	if j>0:
		print("Yes")
	else:
		print("No")
### BUGGY CODE ###

n = int(input())
index = 0
result = []
if n % 2 == 0:
    for i in input().split():
        if index % 2 == 1:
            result.insert(0, i)
            index += 1
        else:
            result.append(i)
            index += 1
else:
    for i in input().split():
        if index % 2 == 1:
            result.append(i)
            index += 1
        else:
            result.insert(0, i)
            index += 1

print(" ".join(result))

### FIXED CODE ###

from collections import deque

n = int(input())

result = deque()
index = 0

if n % 2 == 0:
    for i in input().split():
        if index % 2 == 1:
            result.appendleft(i)
            index += 1
        else:
            result.append(i)
            index += 1
else:
    for i in input().split():
        if index % 2 == 1:
            result.append(i)
            index += 1
        else:
            result.appendleft(i)
            index += 1

print(" ".join(result))
### BUGGY CODE ###

def division(n):
    a = [1]
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n = int(input())
c = division(n)

ans = 10**12
for i in range(2**(len(c))):
    x,y = 1,1
    for j in range(len(c)):
        if i>>j&1:
            x *= c[j]
        else:
            y *= c[j]
    ans = min(ans,x+y-2)
print(ans)

### FIXED CODE ###

n = int(input())
ans = 10**12
for a in range(1,10**6+1):
    if n%a==0:
        b=n//a
    ans = min(ans,a+b-2)
print(ans)
### BUGGY CODE ###

a, b, k = map(int, input().split())
for i in range(k):  
    if a > 0:
        a -= 1
    elif b > 0:
        b -= 1
    else:
        break
print(a, b)

### FIXED CODE ###

a, b, k = map(int, input().split())
if a >= k:
    a -= k
elif a < k and a + b >= k:
    b = b - (k-a)
    a = 0
else:
    a = 0
    b = 0
print(a, b)
### BUGGY CODE ###

H, N = map(int, input().split())
dp = [10 ** 100] * H
for _ in range(N):
    A, B = map(int, input().split())
    for i in range(H - 1, -1, -1):
        if A + i >= H:
            dp[i] = min(dp[i], B)
        else:
            dp[i] = min(dp[i], dp[A + i] + B)
print(dp[0])


### FIXED CODE ###

H, N = map(int, input().split())
dp = [10 ** 100] * H
for _ in range(N):
    A, B = map(int, input().split())
    for i in range(H - 1, -1, -1):
        if A + i >= H:
            dp[i] = min(dp[i], B)
        else:
            dp[i] = min(dp[i], dp[A + i] + B)
print(dp[0])
### BUGGY CODE ###

x,y,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p = sorted(p, reverse = True)[:x]
q = sorted(q, reverse = True)[:y]
r = sorted(r, reverse = True)

for i in range(min(x+y, len(r))):
  if p[x-1] >= q[y-1] and r[0] > q[y-1]:
    q.pop(y-1)
    q.append(r[0])
    r.pop(0)
    q = sorted(q, reverse = True)
  elif q[y-1] >= p[x-1] and r[0] > p[x-1]:
    p.pop(x-1)
    p.append(r[0])
    r.pop(0)
    p = sorted(p, reverse = True)

print(sum(p) + sum(q))

### FIXED CODE ###

import heapq

x,y,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p = sorted(p, reverse = True)[:x]
q = sorted(q, reverse = True)[:y]
r = sorted(r, reverse = True)

pqr = p + q + r
pqr = sorted(pqr, reverse = True)[:x+y]

print(sum(pqr))
### BUGGY CODE ###

a,b,c,d=map(int,input().split())
cnt=0
for i in range(a,b+1):
  if i%c==0:
    cnt+=0
  elif i%d==0:
    cnt+=0
  else:
    cnt+=1
    
print(cnt)    


### FIXED CODE ###

a,b,c,d=map(int,input().split())
def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)
    
r=int((c*d)/gcd(c,d)) 
s=(b//c)-((a-1)//c)
t=(b//d)-((a-1)//d)
u=(b//r)-((a-1)//r)

print(int(b-a+1-s-t+u))
### BUGGY CODE ###

import itertools
import sys
input = sys.stdin.readline

def main():
    D, G = map(int, input().split())
    spc_list = [[(i+1) * 100] + [int(v) for v in input().split()] for i in range(D)]
    min_q = float("inf")
    for q_list in itertools.permutations(list(range(D))):
        score = 0
        q_num = 0
        for q_idx in q_list:
            if score + spc_list[q_idx][0] * spc_list[q_idx][1] + spc_list[q_idx][2] < G:
                score += spc_list[q_idx][0] * spc_list[q_idx][1] + spc_list[q_idx][2]
                q_num += spc_list[q_idx][1]
            else:
                for _ in range(spc_list[q_idx][1]):
                    score += spc_list[q_idx][0]
                    q_num += 1
                    if score >= G:
                        break
                score += spc_list[q_idx][2]
            if score >= G:
                break
        if q_num < min_q:
            min_q = q_num
    print(min_q)


if __name__ == '__main__':
    main()

### FIXED CODE ###

import math
import itertools
import sys
input = sys.stdin.readline

def main():
    D, G = map(int, input().split())
    spc_list = [[(i+1) * 100] + [int(v) for v in input().split()] for i in range(D)]
    max_scores = [spc[0] * spc[1] + spc[2] for spc in spc_list]
    min_q = float("inf")
    for q_list in itertools.permutations(list(range(D))):
        score = 0
        q_num = 0
        for q_idx in q_list:
            if score + max_scores[q_idx] < G:
                score += max_scores[q_idx]
                q_num += spc_list[q_idx][1]
            else:
                q_num += min(math.ceil((G-score) / spc_list[q_idx][0]), spc_list[q_idx][1])
                score = G
                """
                for _ in range(spc_list[q_idx][1]):
                    score += spc_list[q_idx][0]
                    q_num += 1
                    if score >= G:
                        break
                score += spc_list[q_idx][2]
"""
            if score >= G:
                break
        if q_num < min_q:
            min_q = q_num
    print(min_q)


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

import numpy as np
h,w,m = map(int,input().split())
bombX = [0]*h
bombY = [0]*w
bomb = []
maxX = maxY = 0
for i in range(m):
    i,j = map(lambda x:int(x)-1, input().split())
    bomb.append((i,j))
    bombX[i] += 1
    bombY[j] += 1
    maxX = max(maxX,bombX[i])
    maxY = max(maxY,bombY[j])
maxX_index = list(i for i in range(h) if bombX[i] == maxX)
maxY_index = list(i for i in range(w) if bombY[i] == maxY)
for i in maxX_index:
    for j in maxY_index:
        if (i,j) not in bomb:
            print(maxX+maxY)
            exit()
print(maxX+maxY-1)

### FIXED CODE ###

h,w,m = map(int,input().split())
bombX = [0]*h
bombY = [0]*w
bomb = set()
maxX = maxY = 0
for i in range(m):
    i,j = map(lambda x:int(x)-1, input().split())
    bomb.add((i,j))
    bombX[i] += 1
    bombY[j] += 1
    maxX = max(maxX,bombX[i])
    maxY = max(maxY,bombY[j])
maxX_index = list(i for i in range(h) if bombX[i] == maxX)
maxY_index = list(i for i in range(w) if bombY[i] == maxY)
for i in maxX_index:
    for j in maxY_index:
        if (i,j) in bomb: continue
        print(maxX+maxY)
        exit()
print(maxX+maxY-1)
### BUGGY CODE ###

import collections
import math

#****************************************************************
def comb(n):
    if n < 2:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
#****************************************************************

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

c = collections.Counter(A)
dict_ans = {i:0 for i in c.keys()}
full_ans = sum(list(map(comb, c.values())))

for i in c.keys():
    target = c.copy()
    target[i] -= 1
    if target[i] == 0:
        dict_ans[i] = full_ans
    else:
        dict_ans[i] = sum(list(map(comb, target.values())))

for i in A:
    print(dict_ans[i])


### FIXED CODE ###

import collections
import math

#****************************************************************
def comb(n):
    if n < 2:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
#****************************************************************

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

c = collections.Counter(A)
full_ans = sum(list(map(comb, c.values())))

for a in A:
    print(full_ans - c[a] + 1)
### BUGGY CODE ###

a,b = list(map(int,input().split()))
ansa = a
m = 2
sp = False
while 2**(m+1) <= b:
    if (a<2**m) and (2**(m+1)<=b):
        sp = True
        break
    else:
        m +=1

if sp == True:
    ansb = 2**(m+1)
    for i in range(a+1,2**m):
        ansa = ansa^i
    for i in range(2**(m+1)+1,b+1):
        ansb = ansb^i
    print(ansa^ansb)
else:
    for i in range(a+1,b+1):
        ansa = ansa^i
    print(ansa)

### FIXED CODE ###

a,b = list(map(int,input().split()))
def func(num):
    m = 0
    if num%2 == 0:
        if num%4 == 0:
            m = 1
        return num^m
    else:
        if (num-1)%4 == 0:
            m = 1
        return m^1
print(func(a-1)^func(b))
### BUGGY CODE ###

def next_array(array):#辞書式に次の配列を与える関数
  s = -1
  for x in array[::-1]:
    if x < M:
      break
    else:
      s -= 1
    #Mより小さい最後の項を取得
  
  if s >= -N:
    array[s] += 1#その項を１増やす
    if s < -1:
      for i in range(s+1,0):#以降の項を全て同じ値に
        array[i] = array[s]
        
  return array
 
def score(array, rules):#点数計算
  scr = 0
  for rule in rules:
    if (array[rule[1]-1] - array[rule[0]-1] == rule[2]):
      scr += rule[3]
      
  return scr
 
# input
N, M, Q = map(int, input().split())
rules = []
for i in range(Q):
  a, b, c, d = map(int, input().split())
  rules.append([a, b, c, d])

array = [1] * N
max_scr = 0
 
while True:
  max_scr = max(max_scr, score(array,rules)) 
  if array[0] == M:#全探索完了
    break 
    array = next_array(array)#次の配列へ
    
print(max_scr)

### FIXED CODE ###

def next_array(array):#辞書式に次の配列を与える関数
  s = -1
  for x in array[::-1]:
    if x < M:
      break
    else:
      s -= 1
    #Mより小さい最後の項を取得
  
  if s >= -N:
    array[s] += 1#その項を１増やす
    if s < -1:
      for i in range(s+1,0):#以降の項を全て同じ値に
        array[i] = array[s]

  return array
 
def score(array, rules):#点数計算
  scr = 0
  for rule in rules:
    if (array[rule[1]-1] - array[rule[0]-1] == rule[2]):
      scr += rule[3]
      
  return scr
 
# input
N, M, Q = map(int, input().split())
rules = []
 
for i in range(Q):
  a, b, c, d = map(int, input().split())
  rules.append([a, b, c, d])
  
array = [1] * N
max_scr = 0
 
while True:
  max_scr = max(max_scr, score(array,rules)) 
  if array[0] == M:#全探索完了
    break 
  array = next_array(array)#次の配列へ
    
print(max_scr)
### BUGGY CODE ###

from collections import defaultdict, deque, Counter
N,M,K= map(int,input().split())

friend = defaultdict(list)
#block = defaultdict(list)

for i in range(M):
    a,b= list(map(int,input().split()))
    friend[a].append(b)
    friend[b].append(a)
'''
for i in range(K):
    c,d= list(map(int,input().split()))
    block[c].append(d)
    block[d].append(c)
    '''
block = [list(map(int,input().split())) for i in range(K)]

IDs = [-1] * (N+1)
ID = 0
for i in range(1,N+1):
    if IDs[i] != -1:
        continue
    dq = deque([i])
    while dq:
        v = dq.popleft()
        IDs[v] = ID
        for nv in friend[v]:
            if IDs[nv] == -1:
                dq.append(nv)
    ID += 1

group = Counter(IDs)

ans = []
for i in range(1,N+1):
    temp = group[IDs[i]] - len(friend[i]) - 1
    ans.append(temp)

for c,d in block:
    if IDs[c] == IDs[d]:
        ans[c-1] -= 1
        ans[d-1] -= 1

print(*ans)









### FIXED CODE ###

from collections import defaultdict, deque, Counter
N,M,K= map(int,input().split())

friend = defaultdict(list)
#block = defaultdict(list)

for i in range(M):
    a,b= list(map(int,input().split()))
    friend[a].append(b)
    friend[b].append(a)
'''
for i in range(K):
    c,d= list(map(int,input().split()))
    block[c].append(d)
    block[d].append(c)
    '''
block = [list(map(int,input().split())) for i in range(K)]

IDs = [-1] * (N+1)
ID = 0
for i in range(1,N+1):
    if IDs[i] != -1:
        continue
    dq = deque([i])
    while dq:
        v = dq.popleft()
        IDs[v] = ID
        for nv in friend[v]:
            if IDs[nv] == -1:
                dq.append(nv)
    ID += 1

group = Counter(IDs)

ans = []
for i in range(1,N+1):
    temp = group[IDs[i]] - len(friend[i]) - 1
    ans.append(temp)

for c,d in block:
    if IDs[c] == IDs[d]:
        ans[c-1] -= 1
        ans[d-1] -= 1

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

N,K=input().split()
N=int(N)
K=int(K)

list=[]


if N%K==0:
    print(0)
else:
    while N not in list:
        list.append(N)
        N=abs(N-K)
    print(min(list))


### FIXED CODE ###

N,K=input().split()
N=int(N)
K=int(K)

print(min(N%K,K-N%K))
### BUGGY CODE ###

n, k, q = list(map(int, input().split()))
score_list = [k] * n
a = list(map(int, [input() for i in range(q)]))

for i in range(q):
  score_list = list(map(lambda x: x-1, score_list))
  score_list[a[i]-1] += 1
#  print(score_list)

 # print(a[i])

#for i in range(n):
#  print(score_list[i])

    
for i in range(n):
  if score_list[i] > 0:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]

#print(a)

score = [k - q ] * n
#print(score)
for i in range(q):
  score[ a[i]-1 ] += 1
  #print(score)
  
for i in range(n):
  print("Yes" if score[i] > 0 else "No")
### BUGGY CODE ###

#-*- coding:utf-8 -*-
N = int(input())

def lucas(M):
    if M > 1:
        return lucas(M-1)+lucas(M-2)
    elif M == 1:
        return 1
    elif M == 0:
        return 2 

print(lucas(N))

### FIXED CODE ###

#-*- coding:utf-8 -*-
N = int(input())

def lucas(M):
    a = 2
    b = 1
    
    if M > 1:
        for x in range(N-1):
            a,b = b,a+b
        return b
    elif M == 1:
        return 1
    elif M == 0:
        return 2 

print(lucas(N))
### BUGGY CODE ###

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

a=[0]*n
for i in range(m):
  l, r = map(int, input().split())
  for j in range(l,r+1):
    a[j-1] += 1
print(a.count(m))

### FIXED CODE ###

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

a=0
b=n
for i in range(m):
  l, r = map(int, input().split())
  a = max(a, l)
  b = min(b, r)
if b-a+1 >= 0:
  print(b-a+1)
else:
  print(0)
### BUGGY CODE ###

import sys
import numpy as np
from numba import njit

input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())
vws = [tuple(map(int, input().split())) for _ in range(N)]
Q = int(input())
VLs = list(map(lambda s: tuple(map(int, s.split())), readlines()))

n = min(2**10, N)

dp = np.zeros((n, 10**5+1), np.int32)
for i in range(n):
    v, w = vws[i]
    dp[i] = dp[(i-1)//2]
    dp[i, w:] = np.maximum(dp[(i-1)//2, :-w]+v, dp[i, w:])

@njit("i4(i4[::1], i4[::1], i4, i4[::1])", cache = True)
def func(vs, ws, L, dp_):
    values = np.zeros(1 << len(vs), np.int32)
    weights = np.zeros(1 << len(vs), np.int32)
    for i in range(len(vs)):
        for bits in range(1 << len(vs)):
            if bits & (1 << i):
                values[bits] += vs[i]
                weights[bits] += ws[i]
    mask = (weights <= L)     
    return np.amax(dp_[L - weights[mask]] + values[mask])

for V, L in VLs:
    V -= 1
    if V < n:
        print(dp[V, L])
    else:
        vs = []
        ws = []
        while V >= n:
            vs.append(vws[V][0])
            ws.append(vws[V][1])
            V = (V-1) // 2
        print(func(np.array(vs, np.int32), np.array(ws, np.int32), L, dp[V]))


### FIXED CODE ###

import sys
import numpy as np
from numba import njit

input = sys.stdin.buffer.readline

N = int(input())
vws = [tuple(map(int, input().split())) for _ in range(N)]

n = min(2**11, N)
vws_arr = np.array(vws, np.int32)

dp = np.zeros((n, 10**5+1), np.int32)
for i in range(n):
    v, w = vws[i]
    dp[i] = dp[(i-1)//2]
    dp[i, w:] = np.maximum(dp[(i-1)//2, :-w]+v, dp[i, w:])


@njit("i4(i4[::1], i4[::1], i4, i4[::1])", cache = True)
def func(vs, ws, L, dp_):
    values = np.zeros(1 << len(vs), np.int32)
    weights = np.zeros(1 << len(vs), np.int32)
    for i in range(len(vs)):
        for bits in range(1 << len(vs)):
            if bits & (1 << i):
                values[bits] += vs[i]
                weights[bits] += ws[i]
    ret = 0
    for v, w in zip(values, weights):
        if w <= L:
            ret = max(dp_[L - w] + v, ret)
    return ret

Q = int(input())
for _ in range(Q):
    V, L = map(int, input().split())
    V -= 1
    if V < n:
        print(dp[V, L])
    else:
        Vs = []
        while V >= n:
            Vs.append(V)
            V = (V-1) // 2
        vs = vws_arr[Vs, 0]
        ws = vws_arr[Vs, 1]
        print(func(vs, ws, L, dp[V]))
### BUGGY CODE ###

mod = 10 ** 9 + 7

S = input()

l = len(S)
dp = [[0 for i in range(13)] for j in range(l+1)]

dp[0][0] = 1

for i, num in enumerate(S):

    if num == "?":
        for k in range(10):
            for j in range(13):
                dp[i+1][((j * 10) + k) % 13] += dp[i][j]
                # nextdp[((j * 10) + k) % 13] %= mod

    else:
        k = int(num)
        for j in range(13):
            dp[i+1][((j * 10) + k) % 13] += dp[i][j]
            # nextdp[((j * 10) + k) % 13] %= mod

    for j in range(13):
        dp[i+1][j] %= mod

print(dp[l][5])


### FIXED CODE ###

mod = 10 ** 9 + 7

S = input()

dp = [0] * 13

dp[0] = 1

l = len(S)

for i in S:
    nextdp = [0] * 13
    if i == "?":
        for k in range(10):
            for j in range(13):
                nextdp[((j * 10) + k) % 13] += dp[j]
                # nextdp[((j * 10) + k) % 13] %= mod

    else:
        k = int(i)
        for j in range(13):
            nextdp[((j * 10) + k) % 13] += dp[j]
            # nextdp[((j * 10) + k) % 13] %= mod

    dp = [nextdp[i] % mod for i in range(13)]

    # for i in range(13):
    #     dp[i] = nextdp[i] % mod

print(dp[5])
### BUGGY CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-08-29 21:20:05 +0900
# LastModified: 2020-08-29 21:22:11 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    N = int(input())
    A = list(map(int, input().split()))
    amari = 1000000007
    ans = 0
    for i in range(N):
        for j in range(i+1, N):
            ans += A[i]*A[j]%amari
            ans %= amari
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C_fix_2
# CreatedDate:  2020-08-29 22:01:34 +0900
# LastModified: 2020-08-29 22:07:06 +0900
#


import os
import sys
import numpy as np
# import pandas as pd


def main():
    n = int(input())
    A = list(map(int, input().split()))
    amari = 1000000007
    ans = ((sum(A))*(sum(A)) - sum(a**2 for a in A))
    print(ans//2%amari)


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

from collections import Counter
 
N = int(input())
A = list(map(int, input().split()))
 
# サイズA_maxのbool配列dpを用意し、trueで初期化する
A_max = max(A)
dp = [True] * (A_max + 1)
 
# 数列の要素を昇順に見る O(nloglogn)
for x in range(A_max):
    # すでに計算していれば再度計算しない
    if not dp[x]:
        continue
    # xが数列Aに含まれているとき、xより大きいxの倍数yについて、dp[y]をfalseに変更する
    if x in A:
        t = 2
        while x * t <= A_max:
            dp[x * t] = False
            t += 1
 
# 同じ値が複数存在するかチェックする用のカウンタ
C = {a: 0 for a in A}
for a in A:
    C[a] += 1
 
ans = 0
for a in A:
    if C[a] == 1 and dp[a] is True:
        ans += 1
 
print(ans)

### FIXED CODE ###

from collections import Counter

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

# 同じ値が複数存在するかチェックする用のカウンタ
counter = Counter(A)

# D[a] = True: Aにaより小さいaの約数が存在する
A_max = max(A)
dp = {a: False for a in A}

for a in A:
    # xが数列Aに含まれているとき、aより大きいaの倍数tについて、dp[a * t]をTrueに変更する
    if counter[a] > 0:
        t = 2
        while a * t <= A_max:
            dp[a * t] = True
            t += 1

ans = 0
for a in A:
    if counter[a] == 1 and dp[a] is False:
        ans += 1

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

n,q = map(int,input().split())
s = list(map(str,input()))
lr = [0] * (len(s)-1)

for i in range(len(s)-1):
    if s[i] == "A" and s[i+1] == "C":
        lr[i] = 1

for i in range(q):
    st,fn = map(int,input().split())
    tmp = lr[st-1:fn-1]
    print(sum(tmp))

### FIXED CODE ###

n,q = map(int,input().split())
s = input()
lr = [0] * (n+1)

for i in range(n):
    lr[i+1] = lr[i]+(1 if s[i:i+2] == "AC" else 0)

for i in range(q):
    st,fn = map(int,input().split())
    print(lr[fn-1] - lr[st-1])
### BUGGY CODE ###

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

ANS = [A.index(x) + 1 for x in range(1, N + 1)]

ANS = ' '.join(map(str, ANS))
print(ANS)

### FIXED CODE ###

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

for i in range(N):
    L[i] = [A[i], i+1]
L.sort()

ANS = [0 for i in range(N)]
for i in range(N):
    ANS[i] = L[i][1]
print(*ANS)
### BUGGY CODE ###

a,b,k = map(int, input().split())
l = [i for i in range(a,b+1)]
#print(l)
c = len(l)

x = []
if k*2 > c:
    x = l
else:
    for j in range(k):
        x.append(l[j])
        x.append(l[-(j+1)])

print(*sorted(x), sep='\n')


### FIXED CODE ###

a,b,k = map(int, input().split())
#print(l)
c = b-a+1

x = []
if k*2 > c:
    for i in range(a, b+1):
        x.append(i)
else:
    for j in range(a, a+k):
        x.append(j)
    for j in range(b-k+1, b+1):
        x.append(j)

print(*sorted(x), sep='\n')
### BUGGY CODE ###

def main():
  n = int(input())
  a = [int(input()) for i in range(n)]
  check_id=1
  check_list=[]
  while True:
    if check_id in check_list:
      print(-1)
      break
    if check_id==2:
      print(len(check_list))
      break      
    check_list.append(check_id)
    check_id=a[check_id-1]  
      
main()

### FIXED CODE ###

def main():
  n = int(input())
  a = [int(input()) for i in range(n)]
  check_id=1
  for i in range(1,n+1):
    check_id=a[check_id-1]
    if check_id==2:
      print(i)
      break
  if check_id!=2:
      print(-1)
main()
### BUGGY CODE ###

N, W = map(int, input().split())
goods = [tuple(map(int, input().split())) for _ in range(N)]
Mv = 10 ** 5

table = [[float('inf')] * (Mv + 1) for _ in range(N + 1)]
table[0][0] = 0
for n in range(N):
    for v in range(Mv + 1):
        addn = table[n][v - goods[n][1]] + goods[n][0] if v >= goods[n][1] else float('inf')
        table[n + 1][v] = min(table[n][v], addn)
ans = 0
for i in range(Mv):
    if table[N][i] <= W:
        ans = max(ans, i)
print(ans)


### FIXED CODE ###

import numpy as np

N, W = map(int, input().split())
goods = [tuple(map(int, input().split())) for _ in range(N)]
Mv = 10 ** 5
Mw = 10 ** 11

table = np.full((N + 1, Mv + 1), Mw, dtype=np.int64)
table[0][0] = 0
for n in range(N):
    tmp = np.full(Mv + 1, Mw, dtype=np.int64)
    tmp[goods[n][1]:] = table[n][:Mv + 1 - goods[n][1]] + goods[n][0]
    table[n + 1] = np.minimum(table[n], tmp)

print(np.max(np.where(table[N] <= W, table[N], 0).nonzero()))
### BUGGY CODE ###

N = int(input())
ball = list(map(int, input().split()))
ball.sort(reverse = True)
dic = {}
for i in range(ball[0] + 1):
    dic[i] = 0
for x in ball:
    dic[x] += 1

ans = 0
for x in ball:
    if dic[x] != 0:
        y = 2**(x.bit_length()) - x
        if dic[y] != 0:
            if y == x and dic[y] == 1: 
                continue
            ans += 1
            dic[x] -= 1
            dic[y] -= 1
print(ans)

### FIXED CODE ###

N = int(input())
ball = list(map(int, input().split()))
ball.sort(reverse = True)
ok = {}
for x in ball:
    if x in ok:
        ok[x] += 1
    else:
        ok[x] = 1
ans = 0
for x in ball:
    if ok[x] != 0:
        y = 2**(x.bit_length()) - x
        if y in ok:
            if ok[y] != 0:
                if y == x and ok[y] == 1: 
                    continue
                ans += 1
                ok[x] -= 1
                ok[y] -= 1
print(ans)