Harryxun/stf_run huggingface dataset:
import numpy as np

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

total_vote = np.sum(A)
threshold = total_vote*(1/4*M)
A.sort(reverse = True)
if A[M] > threshold:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

import numpy as np

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

total_vote = np.sum(A)
threshold = total_vote/(4*M)
A.sort(reverse = True)
if A[M-1] >= threshold:
    print('Yes')
else:
    print('No')
import sys
input = lambda: sys.stdin.readline().rstrip()
yes = lambda boolean: print('Yes') if boolean else print('No')
input_ints = lambda: list(map(int, input().split()))

N, M = input_ints()
A = input_ints()
A.sort(reverse=1)
yes(A[M-1]*4*M>_1)

### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip()
yes = lambda boolean: print('Yes') if boolean else print('No')
input_ints = lambda: list(map(int, input().split()))
 
N, M = input_ints()
A = input_ints()
A.sort(reverse=1)
yes(A[M-1]*4*M>=sum(A))
if n%2==0:
    ans=n/2
else:
    ans=n//2+1
print(ans)

### FIXED CODE ###

#A
n=int(input())

if n%2==0:
    ans=int(n/2)
else:
    ans=n//2+1
print(ans)
k=int(input())
l=[1, 9, 30, 76, 141, 267, 400, 624, 885, 1249, 1590, 2208, 2689, 3411, 4248, 5248, 6081, 7485, 8530, 10248, 11889, 13687, 15228, 17988, 20053, 22569, 25242, 28588, 31053, 35463, 38284, 42540, 46581, 50893, 55362, 61824, 65857, 71247, 76884, 84388, 89349, 97881, 103342, 111528, 120141, 128047, 134580, 146316, 154177, 164817, 174438, 185836, 194157, 207927, 218812, 233268, 245277, 257857, 268182, 288216, 299257, 313635, 330204, 347836, 362973, 383709, 397042, 416448, 434025, 456967, 471948, 499740, 515581, 536073, 559758, 583960, 604833, 633651, 652216, 683712, 709065, 734233, 754734, 793188, 818917, 846603, 874512, 909496, 933081, 977145, 1006126, 1041504, 1073385, 1106467, 1138536, 1187112, 1215145, 1255101, 1295142, 1342852, 1373253, 1422195, 1453816, 1502376, 1553361, 1595437, 1629570, 1691292, 1726717, 1782111, 1827492, 1887772, 1925853, 1986837, 2033674, 2089776, 2145333, 2197483, 2246640, 2332104, 2379085, 2434833, 2490534, 2554600, 2609625, 2693919, 2742052, 2813988, 2875245, 2952085, 3003306, 3096024, 3157249, 3224511, 3306240, 3388576, 3444609, 3533637, 3591322, 3693924, 3767085, 3842623, 3912324, 4027884, 4102093, 4181949, 4270422, 4361548, 4427853, 4548003, 4616104, 4718640, 4812789, 4918561, 5003286, 5131848, 5205481, 5299011, 5392008, 5521384, 5610705, 5739009, 5818390, 5930196, 6052893, 6156139, 6239472, 6402720, 6493681, 6623853, 6741078, 6864016, 6953457, 7094451, 7215016, 7359936, 7475145, 7593865, 7689630, 7886244, 7984165, 8130747, 8253888, 8403448, 8523897, 8684853, 8802826, 8949612, 9105537, 9267595, 9376656, 9574704, 9686065, 9827097, 9997134, 10174780, 10290813, 10493367, 10611772, 10813692]
print(l[k-1])

### FIXED CODE ###

from collections import Counter

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

c=Counter(s)
ans1=c['B']*c['R']*c['G']

lim= n//2 if n%2==1 else n//2-1

for i in range(1,lim+1):
  for j in range(i,n-i):
    right=s[j-i]
    middle=s[j]
    left=s[j+i]
    if right!=middle and middle!=left and left!=right:
      ans1-=1
print(ans1)
#n,l = map(int,input().split())
#l = kist(input())

n = int(input())
l = list(map(int,input()))

ttl = sum(l)

m = int(input())

for i in range(m):
    p,x = map(int,input().split())
    print(ttl-l[p-1]+x)

### FIXED CODE ###

#n,l = map(int,input().split())
#l = kist(input())

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

ttl = sum(l)

m = int(input())

for i in range(m):
    p,x = map(int,input().split())
    print(ttl-l[p-1]+x)
N = int(input())
A = list(map(int, input().split()))

count = 0

def dfs(x, y):
    global count
    if x >= N or y >= N:
        return
    diff = abs(x - y)
    if (A[x]+A[y]) == diff:
        count += 1
    
    if y+1 >= N:
        dfs(x+1, x+2)
    dfs(x, y+1)


dfs(0, 1)
print(count)


### FIXED CODE ###

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

count = 0

def solve():
    from collections import Counter
    cc=Counter()
    ans=0
    for i,val in enumerate(A,1):
        if i-val>0:
            ans+=cc[i-val]
        cc[i+val]+=1
    print(ans)
    
def dfs(x, y):
    global count
    if x >= N or y >= N:
        return
    
    if (A[x]+A[y]) == y-x:
        count += 1

    if x+1 >= N and y+1 >= N:
        return
        
    if y+1 >= N:
        dfs(x+1, x+2)
    else:
        dfs(x, y+1)


#dfs(0, 1)
#print(count)
solve()
x,y = map(int. input ().split())
while True
    if x == 0 and y == 0 :
        break
    elif x < y:
        print(x,y)
    else:
        print(y,x)
        


### FIXED CODE ###

while True:
    x,y = map(int,input().split())

    if x == 0 and y == 0:
        break
    elif x < y:
        print(x,y)
    else:
        print(y,x)
mod = 10 ** 9 + 7
N,M = map(int,input().split())
X = [1,1]
for i in range(N):
    X.append((X[i]+X[i+1]) % mod)
#print(X)
a = int(input())
ans = X[a - 1]
#print(ans)
tmp = a
check = 0
for _ in range(M-1):
    a = int(input())
    if a - tmp == 1:
        check = 1
    y = a - tmp - 2
    ans *= X[y]
    ans %= mod 
    tmp = a
    #print(ans)
y = N - tmp - 1
ans *= X[y]
ans %= mod 
if check == 1:
    print(0)
else:
    print(ans)

### FIXED CODE ###

mod = 10 ** 9 + 7
N,M = map(int,input().split())
X = [1,1]
for i in range(N):
    X.append((X[i]+X[i+1]) % mod)
if M == 0:
    print(X[N])
else:
    a = int(input())
    ans = X[a - 1]
    #print(ans)
    tmp = a
    check = 0
    for _ in range(M-1):
        a = int(input())
        if a - tmp == 1:
            check = 1
        y = a - tmp - 2
        ans *= X[y]
        ans %= mod
        tmp = a
        #print(ans)
    y = N - tmp - 1
    ans *= X[y]
    ans %= mod 
    if check == 1:
        print(0)
    else:
        print(ans)
n=int(input())
s=[list(input()).sort() for in range(n)]

### FIXED CODE ###

n=int(input())
s=[input() for i in range(n)]
l=list("abcdefghijklmnopqrstuvwxyz")
c_tmp=[]
for j in l:
  for i in s:
    c_tmp.append(i.count(j))
  print(j*min(c_tmp),end="")
  c_tmp.clear()
from sys import stdin
from collections import Counter
N = int(stdin.readline().rstrip())
D = [int(x) for x in stdin.readline().rstrip().split()]
mod = 998244353
ans = 1
if N == 1 and D[0] == 0:
    print(1)
elif len(set(D))==1:
    print(0)
elif D.count(0) != 1:
    print(0)
elif D[0] != 0:
    print(0)
else:
    tmp = 1
    cnt = Counter(D)
    #print(cnt)
    flag = True
    for i in range(1,max(D)+1):
        #print(cnt[i],tmp)
        if i != 1 and cnt[i] != tmp:
            flag = False
        c = (tmp**cnt[i]) % mod
        ans *= c % mod
        tmp = cnt[i]
        ans = ans % mod
    if flag:
        print(1)
    else:
        print(ans % mod)

### FIXED CODE ###

from sys import stdin
N = int(stdin.readline().rstrip())
if N % 2 == 0:
    print(N//2-1)
else:
    print(N//2)
n,y=map(int,input().split())
A,B,C=[-1,-1,-1]
f=True
for a in range(n+1):
	for b in range(n+1):
		if 10000*a+5000*b+1000*(n-a-b)==y and 0<=n-a-b<=n:
			A,B,C=[a,b,n-a-b]
			f=False
			break
	if f==False:
		break
print(A,B,C)

### FIXED CODE ###

n,y=map(int,input().split())
A,B,C=[-1,-1,-1]
f=True
for a in range(n+1):
	for b in range(n+1):
		if 10000*a+5000*b+1000*(n-a-b)==y and 0<=n-a-b<=n:
			A,B,C=[a,b,n-a-b]
			f=False
			break
	if f==False:
		break
print(A,B,C)
a = input()
b = ["a","b","c"]
if b in a:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a = input()
if "a" in a and "b" in a and "c" in a:
  print("Yes")
else:
  print("No")
def main():
	N, K = map(int,input().split())
	points = [0]*N
	max_x, max_y, min_x, min_y = -10**9, -10**9, 10**9, 10**9
	for i in range(N):
		points[i] = list(map(int, input().split()))
		max_x = max(max_x, points[i][0])
		min_x = min(min_x, points[i][0])
		max_y = max(max_y, points[i][1])
		min_y = min(min_y, points[i][1])

	points.sort(key=lambda x:x[0])
	ans = (max_x-min_x)*(max_y-min_y)
	for lr in range(1, N-K+1):
		for l in range(lr):
			this_points = list(points[l:N-lr+l])
			w = this_points[-1][0]-this_points[0][0]
			if w <= 0:
				continue
			this_points.sort(key=lambda x:x[1])
			for t in range(N-K-lr+1):
				h = this_points[t+N-K-lr-1][1] - this_points[t][1]
				if h <= 0:
					continue
				ans = min(ans, w*h)
	print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
	N, K = map(int,input().split())
	points = [0]*N
	max_x, max_y, min_x, min_y = -10**9, -10**9, 10**9, 10**9
	for i in range(N):
		points[i] = list(map(int, input().split()))
		max_x = max(max_x, points[i][0])
		min_x = min(min_x, points[i][0])
		max_y = max(max_y, points[i][1])
		min_y = min(min_y, points[i][1])

	points.sort(key=lambda x:x[0])
	ans = (max_x-min_x)*(max_y-min_y)
	for r in range(K, N+1):
		for l in range(N-r+1):
			w = points[r+l-1][0] - points[l][0]
			this_points = sorted(list(points[l:l+r]), key=lambda x:x[1])
			for b in range(r-K+1):
				h = this_points[b+K-1][1] - this_points[b][1]
				ans = min(ans, w*h)
	print(ans)


if __name__ == '__main__':
    main()
import sys
N, Q = [int(i) for i in input().split()]
tree = {i:[] for i in range(1,N+1)}
cost_ls = {i:0 for i in range(1,N+1)}
for i in range(N-1):
    a, b = [int(j) for j in sys.stdin.readline().split()]
    tree[a].append(b)
    tree[b].append(a)

yet = set()
def plus(node, num):
    yet.add(node)
    cost_ls[node] += num
    if len(tree[node]) > 0:
        for child in tree[node]:
            if child in yet:
                continue
            plus(child, cost_ls[node])

for i in range(Q):
    p, x = [int(j) for j in sys.stdin.readline().split()]
    cost_ls[p] += x

plus(1, 0)

print(" ".join([str(cost) for cost in cost_ls.values()]))

### FIXED CODE ###

import sys

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

N, Q = map(int, input().split())
V = {i: [] for i in range(1, N + 1)}
for _ in range(N - 1):
    a, b = map(int, input().split())
    V[a].append(b)
    V[b].append(a)

C = {i: 0 for i in range(1, N + 1)}

for _ in range(Q):
    p, x = map(int, input().split())
    C[p] += x


def propagate(u, p):
    for v in V[u]:
        if v == p:
            continue
        C[v] += C[u]
        propagate(v, u)


propagate(1, 0)

print(' '.join(str(C[i]) for i in range(1, N + 1)))
# ABC073 D - joisino's travel
import itertools
N,M,R=map(int, input().split())
r=list(map(int, input().split()))
inf=float("inf")
mat=[[inf]*N for _ in range(N)]
dist=[inf]*N
visited=[False]*N
for i in range(M):
    a,b,c=map(int,input().split())
    mat[a-1][b-1]=c
    mat[b-1][a-1]=c

for i in range(R):
    r[i]-=1

ans=inf
for i in range(N):
    for j in range(N):
        for k in range(N):
            mat[i][j]=min(mat[i][j],mat[i][k]+mat[k][j])

for rr in itertools.permutations(r,R):
    t_sum=0
    for j in range(1,R):
        t_sum+=mat[rr[j-1]][rr[j]]
    ans=min(ans,t_sum)
print(int(ans))


### FIXED CODE ###

# ABC073 D - joisino's travel
import itertools
N,M,R=map(int, input().split())
r=list(map(int, input().split()))
inf=float("inf")
mat=[[inf]*N for _ in range(N)]

for i in range(M):
    a,b,c=map(int,input().split())
    if mat[a-1][b-1]>c:
        mat[a-1][b-1]=mat[b-1][a-1]=c

for i in range(R):
    r[i]-=1

ans=inf
for k in range(N):
    for i in range(N):
        for j in range(N):
            mat[i][j]=min(mat[i][j],mat[i][k]+mat[k][j])

for rr in itertools.permutations(r,R):
    t_sum=0
    for j in range(1,R):
        t_sum+=mat[rr[j-1]][rr[j]]
    ans=min(ans,t_sum)
print(int(ans))
n = int(input())

max_1 = 0
max_2 = 0
max_index = 0

for i in range(n):
 	item = int(input())
    if item >= max_1:
        max_1, max_2 = item, max_1
        max_index = i
    elif item > max_2:
        max_2 = item

for i in range(n):
    ans = max_2 if i == max_index else max_1
    print(ans)



### FIXED CODE ###

n = int(input())

max_1 = 0
max_2 = 0
max_index = 0

for i in range(n):
    item = int(input())
    if item >= max_1:
        max_1, max_2 = item, max_1
        max_index = i
    elif item > max_2:
        max_2 = item

for i in range(n):
    ans = max_2 if i == max_index else max_1
    print(ans)
s = list(input())
Pflag = False
Dflag = False
if s[0] == "?":
  if s[1] == "D":
    s[0] = "P"
  if s[1] == "P":
    s[0] = "D"
  if s[1] == "?":
    s[0] = "P"
    s[1] = "D"
if s[-1] == "?":
  s[-1] = "D"
for index, i in enumerate(s):
  if i == "?":
    if s[index+1] == "?":
      s[index] = "P"
    if s[index-1] == "P":
      s[index] = "D"
    if s[index+1] == "D":
      s[index] = "P"
ans = "".join(s)
print(ans)

### FIXED CODE ###

s = list(input())
for index, i in enumerate(s):
  if i == "?":
    s[index] = "D"
ans = "".join(s)
print(ans)
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    *A, = iss()
    *B, = iss()
    *C, = iss()
    tmp = "a"

    while True:
        if tmp == "a" and len(A) == 0:
            print('A')
            exit()
        if tmp == "b" and len(B) == 0:
            print('B')
            exit()
        if tmp == "c" and len(C) == 0:
            print('C')
            exit()

        if tmp == 'a':
            tmp = A.pop(0)
        if tmp == 'b':
            tmp = B.pop(0)
        if tmp == 'c':
            tmp = C.pop(0)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    *A, = iss()
    *B, = iss()
    *C, = iss()
    tmp = "a"

    while True:
        if tmp == 'a' and len(A) == 0:
            print('A')
            exit()
        elif tmp == 'b' and len(B) == 0:
            print('B')
            exit()
        elif tmp == 'c' and len(C) == 0:
            print('C')
            exit()

        if tmp == 'a':
            tmp = A.pop(0)
        elif tmp == 'b':
            tmp = B.pop(0)
        elif tmp == 'c':
            tmp = C.pop(0)


if __name__ == '__main__':
    main()
n = int(input())
p = list(map(int,input().split()))

ans = 0

for i in range(1,n-1):
    if p[i-1]<p[i]<p[i+1] or p[i-1]>p[i]>i[i+1]:
        ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
p = list(map(int,input().split()))
ans = 0

for i in range(1,n-1):
    a,b,c = p[i-1:i+2]
    if b != min(a,b,c,) and b != max(a,b,c):
        ans += 1
print(ans)
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
m = 0
d.sort()
if (len(d))%2 == 0:
  m = (d[(len(d)//2)-1]+d[len(d)//2])/2
else:
  m = d[(len(d)//2)]
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      p = d[i]
      q = d[i-1]
    else:
      p = d[i]
      q = d[i-1]
      break
print(p-q)

### FIXED CODE ###

n = int(input())
d = sorted(list(map(int,input().split())))
print(d[n//2]-d[n//2-1])
import math
print(int(math.sqrt(int(input())))

### FIXED CODE ###

import math
n = int(input())
print(int(math.pow(int(math.sqrt(n)), 2)))
from itertools import permutations
INFTY = 10**8
N,M,R = map(int,input().split())
r = list(map(int,input().split()))
G = {i:[] for i in range(1,N+1)}
for _ in range(M):
    a,b,c = map(int,input().split())
    G[a].append((b,c))
    G[b].append((a,c))
dist = [[INFTY for _ in range(N+1)] for _ in range(N+1)]
for i in range(1,N+1):
    dist[i][i] = 0
for i in range(1,N+1):
    for j,d in G[i]:
        dist[i][j] = d
for k in range(1,N+1):
    for i in range(1,N+1):
        for j in range(1,N+1):
            dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j])
dmin = 10**8
for i in range(R):
    for j in range(R):
        if i!=j:
            A = list(range(R))
            A.remove(i)
            A.remove(j)
            for x in permutations(A,R-2):
                d = dist[r[i]][r[x[0]]]
                for k in range(1,R-2):
                    d += dist[r[x[i]]][r[x[i-1]]]
                d += dist[r[x[R-3]]][r[j]]
            dmin = min(dmin,d)
print(dmin)

### FIXED CODE ###

from itertools import permutations
INFTY = 10**8
N,M,R = map(int,input().split())
A = list(map(int,input().split()))
G = {i:[] for i in range(1,N+1)}
for _ in range(M):
    a,b,c = map(int,input().split())
    G[a].append((b,c))
    G[b].append((a,c))
d = {i:[INFTY for _ in range(N+1)] for i in range(N+1)}
for i in G:
    d[i][i] = 0
    for x in G[i]:
        d[i][x[0]] = x[1] 
for k in range(1,N+1):
    for i in range(1,N+1):
        for j in range(1,N+1):
            d[i][j] = min(d[i][j],d[i][k]+d[k][j])
dmin = INFTY
for x in permutations(range(R),R):
    cnt = 0
    for i in range(R-1):
        cnt += d[A[x[i]]][A[x[i+1]]]
    dmin = min(dmin,cnt)
print(dmin)
def GCD(x,y):
    if y == 0:
        return x
    else:
        return GCD(y,x%y)


N = int(input())
if N == 2:
    print(-1)
    exit()
if N == 7:
    print(1/0)
if N == 3:
    print(".aa")
    print("a..")
    print("a..")
    exit()

four = ["aacd",
        "bbcd",
        "efgg",
        "efhh"]
five = ["aabbc",
        "h.iic",
        "hj..d",
        "gj..d",
        "gffee"]
six = ["aacd..",
       "bbcd..",
       "ef..gg",
       "ef..hh",
       "..iikl",
       "..jjkl"]
ans = [list("."*N) for i in range(N)]
a,b,c = [[0,N//5,0],[0,N//5-1,1],[0,N//5-2,2],[2,N//5-1,0],[1,N//5,0]][N%5]
p = 0
for i in range(a):
    for x in range(4):
        for y in range(4):
            ans[p+x][p+y] = four[x][y]
    p += 4

for i in range(b):
    for x in range(5):
        for y in range(5):
            ans[p+x][p+y] = five[x][y]
    p += 5

for i in range(c):
    for x in range(6):
        for y in range(6):
            ans[p+x][p+y] = six[x][y]
    p += 6
for i in ans:
    print("".join(i))

### FIXED CODE ###

def GCD(x,y):
    if y == 0:
        return x
    else:
        return GCD(y,x%y)


N = int(input())
if N == 2:
    print(-1)
    exit()
if N == 7:
    ans = [".aaggcc",
           "c..ddee",
           "c..ffgg",
           "hij....",
           "hij....",
           "klm....",
           "klm...."]
    for i in ans:
        print("".join(i))
    exit()
if N == 3:
    print(".aa")
    print("a..")
    print("a..")
    exit()

four = ["aacd",
        "bbcd",
        "efgg",
        "efhh"]
five = ["aabbc",
        "h.iic",
        "hj..d",
        "gj..d",
        "gffee"]
six = ["aacd..",
       "bbcd..",
       "ef..gg",
       "ef..hh",
       "..iikl",
       "..jjkl"]
ans = [list("."*N) for i in range(N)]
a,b,c = [[0,N//5,0],[0,N//5-1,1],[0,N//5-2,2],[2,N//5-1,0],[1,N//5,0]][N%5]
p = 0
for i in range(a):
    for x in range(4):
        for y in range(4):
            ans[p+x][p+y] = four[x][y]
    p += 4

for i in range(b):
    for x in range(5):
        for y in range(5):
            ans[p+x][p+y] = five[x][y]
    p += 5

for i in range(c):
    for x in range(6):
        for y in range(6):
            ans[p+x][p+y] = six[x][y]
    p += 6
for i in ans:
    print("".join(i))
N, x = map(int, input().split())
A = list(map(int, input().split()))

if len(A) % 2 == 0:
    A = A + [0]
# print('A', A)

ans = 0
for i in range(1, N, 2):
    total = A[i - 1] + A[i]
    diff = total - x
    if diff <= 0:
        continue
    v1 = min(A[i], diff)
    v2 = diff - v1
    A[i] -= v1
    A[i - 1] -= v2
    ans += v1 + v2
    # print('A', A)
print(ans)


### FIXED CODE ###

print('A' + input().split()[1][0] + 'C')
def insertion(A, n, g):
    c = 0
    for i in range(g, n):
        key = A[i]
        j = i - g
        while j >= 0 and A[j] > key:
            A[j + g] = A[j]
            j -= g
            c += 1
        A[j + g] = key
    return c

def main():
    n = input()
    A = [input() for i in range(n)]

    G = list()
    h = 1
    while h <= n:
        G[0:0] = h
        h = 3 * h + 1
    cnt = 0

    for i in G:
        cnt += insertion(A, n, i)

    print(len(G))
    print(" ".join(map(str, G)))
    print(cnt)
    for k in A: print(k)

main()

### FIXED CODE ###

def insertion(A, n, g):
    cnt = 0
    for i in range(g, n):
        while i >= g and A[i - g] > A[i]:
            A[i], A[i - g] = A[i - g], A[i]
            i -= g
            cnt += 1
    return cnt

def main():
    n = int(raw_input())
    A = [int(raw_input()) for i in range(n)]

    G = list()
    h = k = 1
    while h <= n:
        G.append(h)
        h = (4 ** k) + (3 * (2 ** (k - 1)) + 1)
        k += 1
    G = G[::-1]

    cnt = 0
    for i in G:
        cnt += insertion(A, n, i)

    print(len(G))
    print(" ".join(map(str, G)))
    print(cnt)
    for j in A: print(j)

main()
N,K=input().split()
dis=list(K)
dis=input().split()

while True:
    for c in dis:
        if N.count(c)!=0:
            frag=1
        else:
            pass

    if frag==1:
        N=int(N)+1
        N=str(N)
        frag=0
    else:
        break

print(N)

### FIXED CODE ###

N,K=input().split()
D=input().split()
frag=0

while True:
    for s in D:
        if N.count(s)!=0:
            frag=1

        else:
            pass
    if frag==1:
        a=int(N)+1
        N=str(a)

    else:
        break

    frag=0

print(N)
# coding: utf-8


def main():
    A, B, K = map(int, input().split())
    for i in range(A, B + 1):
        if i < A + K or B - K < i:
            print(i)

    print(ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

# coding: utf-8
A, B, K = map(int, input().split())
ans = []
for i in range(K):
    a, b = A + i, B - i
    if a < b:
        ans.extend([a, b])
    elif a == b:
        ans.append(a)
    else:
        break
ans.sort()
for a in ans:
    print(a)
n = int(input())
a = list(map(int,input().split()))

max = (10 ** 9) + 7

#入力配列の総和
line = 0
for i in range (n):
    line += a[i]

#a11, a22, ...対角線要素の総和
rem = 0
for i in range(n):
    rem += a[i]*a[i]

sum = ((line*line) - rem) // 2

ans = sum % max

print(ans)


### FIXED CODE ###

in1 = list(map(int,input().split()))
D = in1[0]
T = in1[1]
S = in1[2]

if D <= T * S:
    print('Yes')
else:
    print('No')
import math

r = 100000000
sqrt = math.sqrt(r)
p = [1 for i in range(r)]
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]

count = 0
while True:
    try:
        n = int(raw_input())
        if p[n-1]:
            count += 1
print count

### FIXED CODE ###

def isPrime(p):
	if p == 2: return 1
	if p < 2 or p&1 == 0: return 0
	return 1 if pow(2,p-1,p) == 1 else 0
	
n = int(raw_input())
print sum(isPrime(int(raw_input())) for i in range(n))
d,t,s=map(int,input())
if(d//t>=s):
  print("YES")
else:
  print("NO")


### FIXED CODE ###

d,t,s=map(int,input().split())
if(d/s<=t):
  print("Yes")
else:
  print("No")
a,b= map(int,raw_input().split());
if a<b :
  print 'a<b';
elif a>b :
  print 'a>b';
else
  print 'a==b' ;

### FIXED CODE ###

a,b= map(int,input().split());
if a < b :
	print("a < b" );
elif a > b :
	print("a > b" );
elif a == b :
	print("a == b") ;
X, N = map(int, input().split())
if N>0:
  P = list(map(int, input().split()))
  P = [i for i in range(-1, 101) if i not in P]
  for i in range(len(P)):
    if abs(X-P[i])<=abs(X-P[i+1]):
      print(P[i])
      break
else:
  print(X)

### FIXED CODE ###

X, N = map(int, input().split())
if N>0:
  P = list(map(int, input().split()))
else:
  P = []
i = 0
while True:
  if X-i not in P:
    print(X-i)
    break
  if X+i not in P:
    print(X+i)
    break
  i += 1