Harryxun/stf_run huggingface dataset:
S = input()

answer = 0

def F(s):
    global answer
    if len(s) <= 1:
        return
    if s[0] == 'x':
        if s[-1] == 'x':
            F(s[1:-1])
        else:
            answer += 1
            F(s[1:])
    else:
        if s[-1] == 'x':
            answer += 1
            F(s[:-1])
        elif s[0] == s[-1]:
            F(s[1:-1])
        else:
            print(-1)
            exit()

F(S)
print(answer)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)
S = input()

answer = 0
left = 0
right = len(S) - 1
while left < right:
    if S[left] == S[right]:
        left += 1
        right -= 1
    elif S[left] == 'x':
        left += 1
        answer += 1
    elif S[right] == 'x':
        right -= 1
        answer += 1
    else:
        print(-1)
        exit()
print(answer)
th = K-1
print(elements[th])

### FIXED CODE ###

elements = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
th = K-1
print(elements[th])
import math
H=int(input())
A=int(input())
Q=math.ceil(H/A)
print(Q)

### FIXED CODE ###

import math
str = input()
str_list=str.split()
H=int(str_list[0])
A=int(str_list[1])
Q=math.ceil(H/A)
print(Q)
s1, s2, s3 = input().split()
count = 0
if s1 == 1:
  count++
if s2 == 1:
  count++
if s3 == 1:
  count++
print(count)


### FIXED CODE ###

s = input()
count = 0


if s[0] == '1':
  count += 1
  
if s[1] == '1':
  count += 1
  
if s[2] == '1':
  count += 1
  
print(count)
R, G= map(int,input().split())
print(2*G-R)

### FIXED CODE ###

r=int(input())
g=int(input())
print(2*g-r)
n=int(input())
arr=input.split()
den=0
app=0
for i in arr:
  i=int(i)
  if (i%2):
    if i%3==0 or i%5==0:
      app+=1
    else:
      den+=1
if den>0:
  print("DENIED")
else:
  print("APPROVED")

### FIXED CODE ###

n = int(input()) 
  
# input the array 
# arr = []
arr = list(map(int, input().split()))
den=0
app=0
for i in arr:
    i=int(i)
    if (i%2==0):
        if i%3==0 or i%5==0:
            app+=1
        else:
            den+=1
            break

if den>0:
  print("DENIED")
else:
  print("APPROVED")
#abc090 a
c=[]
for i in range(3):
    line=list(input().split())
    c.append(line)
print(c[0][0]+c[1][1]+c[2][2])

### FIXED CODE ###

#abc090 a
c=[]
for i in range(3):
    line=input()
    c.append(line)
print(c[0][0]+c[1][1]+c[2][2])
import math
N = int(input())
xy = []
for i in range(N):
  x, y = map(int, input().split())
  xy += [(x, y, math.atan2(y,x))]
xy.sort(key=lambda val:val[2])
x_accum = [0]
y_accum = [0]
for i in range(N):
  x_accum += [x_accum[-1] + xy[i][0]]
  y_accum += [y_accum[-1] + xy[i][1]]
  
ans = 0
for i in range(N):
  for j in range(N):
    ans = max(ans,  math.hypot(x_accum[j]-x_accum[i] ,y_accum[j]-y_accum[i]))
print(ans)

### FIXED CODE ###

S = input()
T = input()
ans = 0
for i in range(3):
  if S[i] == T[i]:
    ans+=1
    
print(ans)
import sys

def input():
    return sys.stdin.readline()[:-1]

def main():
    n,m = map(int,input().split())
    k = []
    s = []
    ans = 0
    
    for _ in range(m):
        tmp = [int(i) for i in input().split()]
        k.append(tmp.pop(0))
        s.append(tmp)

    p = [int(i) for i in input().split()]

    for i in range(2**n):
        tentou=[0]*m
        b = bin(i)[2:].zfill(5)
        for i2 in range(len(s)):
            for i3 in s[i2]:
                if b[i3-1] == "1":
                    tentou[i2]+=1
        tentou = [z % 2 for z in tentou]
        if tentou == p:
            ans+=1
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

def input():
    return sys.stdin.readline()[:-1]

def main():
    n,m = map(int,input().split())
    k = []
    s = []
    ans = 0
    
    for _ in range(m):
        tmp = [int(i) for i in input().split()]
        k.append(tmp.pop(0))
        s.append(tmp)

    p = [int(i) for i in input().split()]

    for i in range(2**n):
        tentou=[0]*m
        b = bin(i)[2:].zfill(n)
        for i2 in range(len(s)):
            for i3 in s[i2]:
                if b[i3-1] == "1":
                    tentou[i2]+=1
        tentou = [z % 2 for z in tentou]
        if tentou == p:
            ans+=1
    print(ans)

if __name__ == '__main__':
    main()
import os
import math

def main():
    l = int(input())
    if l%3 == 0:
        s = l/3
        print(math.pow(s,3))
    else:
        s = math.floorl(l/3)
        s1 = s + 0.5
        print(s*s1*s1)

if __name__ == "__main__":
    main()

### FIXED CODE ###

l = int(input())
print((l/3)**3)
List = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]

ans = [[0,0,0] for i in range(3)]
ans1 = [[0,0,0] for i in range(3)]

res = False

for i in range(n):
    for a in range(3):
        for c in range(3):
            if b[n] == List[a][c]:
                ans[a][c] = 1
                ans1[c][a] = 1
                
if ans[1][1] == 1:
    if ans[0][0] > 0 and ans[2][2] > 0:
        res = True
    if ans[2][0] > 0 and ans[0][2] > 0:
        res = True
                
for i in range(3):
    if ans[i][0] > 0 and ans[i][1] > 0 and ans[i][2] > 0:
        res = True
    if ans1[i][0] > 0 and ans1[i][1] > 0 and ans1[i][2] > 0:
        res = True
   
            
if res:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = int(input())

ans = n // 2

if n % 2 == 0:
    print(ans)
else:
    print(ans+1)
kaibun = input()
i=0
count = 0
while i+1<=len(kaibun)/2:
  if kaibun[i]!=kaibunn[-i-1]:
    count+=1
  i+=1

print(count)

### FIXED CODE ###

kaibun = input()
i=0
count = 0
while i+1<=len(kaibun)/2:
  #print( kaibun[i],kaibun[-i-1])
  if kaibun[i]!=kaibun[-i-1]:
    count+=1
  i+=1

print(count)
from math import factorial

N = int(input())
nums = list(map(int, input().split()))
numsB = nums[:]
d = dict()

for num in nums:
    if num not in d:
        d[num] = 1
    else:
        d[num] += 1

total = 0
for i in d:
    n = d[i]
    if n == 2:
        total += 1
    elif n > 2:
        total += factorial(n) / factorial(2) / factorial(n - 2)

for num in numsB:
    tmp = d[num] - 1
#    if tmp >= 2:
#        hoge = factorial(tmp) / factorial(2) / factorial(tmp - 2)
    print(int(total - tmp))


### FIXED CODE ###

import math

N = int(input())
nums = list(map(int, input().split()))
numsB = nums[:]
d = dict()

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for num in nums:
    if num not in d:
        d[num] = 1
    else:
        d[num] += 1

total = 0
for i in d:
    n = d[i]
    if n == 2:
        total += 1
    elif n > 2:
        total += combinations_count(n, 2)

for num in numsB:
    tmp = d[num] - 1
#    if tmp >= 2:
#        hoge = factorial(tmp) / factorial(2) / factorial(tmp - 2)
    print(int(total - tmp))
n,k = map(int, input().split(" "))
s = list(input())

s_num = []
s_first = s[0]
pre = s[0]
num = 0

for i in s:
    if pre == i:
        num += 1
    else:
        s_num.append(num)
        num = 1
        pre = "1" if pre == "0" else "0"
else:
    s_num.append(num)
ret = 0
if s_first == "0":
    ret.append(sum(s_num[0:(2*k)]))
    for i in range(1,len(s_num)//2):
        ret = max(ret,sum(s_num[((i-1)*2+1):(2*(i+k))]))
else:
    ret.append(sum(s_num[0:(2*k+1)]))
    for i in range(1,len(s_num)//2):
        ret = max(ret,(sum(s_num[(i*2):(2*(k+i)+1)])))
 
print(ret)

### FIXED CODE ###

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

if s[0] == "0":
    s_num = [0]
else:
    s_num = []
pre = s[0]
num = 0

for i in s:
    if pre == i:
        num += 1
    else:
        s_num.append(num)
        num = 1
        pre = "1" if pre == "0" else "0"
else:
    s_num.append(num)

sums = [0]

for i,e in enumerate(s_num):
    sums.append(sums[i] + e)

ret = 0
sums_len = len(sums)-1
for i in range(0,len(sums),2):
    ret = max(ret,(sums[min(i+k*2+1,sums_len)] - sums[i]))
 
print(ret)
N, K = map(int, input().split())
H = []

for i in range(N):
        H.append(int(input()))

H.sort()

ans = []
for i in range(N-K-1):
        # print(i)
        dif = H[i+K-1] - H[i]
        ans.append(dif)

print(min(ans))
        

### FIXED CODE ###

n,k=map(int,input().split())
H=[]
for i in range(n):
    H.append(int(input()))
 
H.sort()
 
#print(H)
 
ans=H[n-1]-H[0]
 
for i in range(n-k+1):
    #print(H[i+k-1]-H[i])
    ans=min(ans,H[i+k-1]-H[i])
 
print(ans)
print("vowel") if input() in ["a","i","u","e","o"] else print("consonant
")

### FIXED CODE ###

print("vowel") if input() in ["a","i","u","e","o"] else print("consonant")
X, Y = input().split()

print(X + Y // 2)

### FIXED CODE ###

X, Y = map(int, input().split())

print(X + Y // 2)
A = [int(a) for a in input().split()]
masu=int((A[0]*A[1]/2)+0.5)
if A[1]==1 or A[0]==1:
    print(1)
else:
    print(masu)

### FIXED CODE ###

K=int(input())
list=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(list[K-1])
n,k=map(int,input().split())
hashmap=dict()
for i in range(k):
  d=input()
  for i in range(d):
    key=int(input())
    hashmap[key]=d

count=0
for i in range(1,n+1):
  if hashmap.get(key)==None:
    count+=1
print(count)

### FIXED CODE ###

n,k=map(int,input().split())
hashmap=dict()
for _ in range(k):
  d=int(input())
  arr=[int(p) for p in input().split()]
  for key in arr:
    hashmap[key]=d
count=0
for i in range(1,n+1):
  if hashmap.get(i)==None:
    count+=1
print(count)
L = input()
n = len(L)
mod = 10**9+7
dp1 = [0]*(n+1)
dp2 = [0]*(n+1)
dp1[0] = 1
for i in range(n):
    if L[i] == "1":
        dp1[i+1] = (dp[i]*2)%mod
        dp2[i+1] = (dp1[i] + dp2[i]*3)%mod
    else:
        dp1[i+1] = dp1[i]
        dp2[i+1] = (dp2[i]*3)%mod
print((dp1[n]+dp2[n])%mod)

### FIXED CODE ###

L = input()
n = len(L)
mod = 10**9+7
dp1 = [0]*(n+1)
dp2 = [0]*(n+1)
dp1[0] = 1
for i in range(n):
    if L[i] == "1":
        dp1[i+1] = (dp1[i]*2)%mod
        dp2[i+1] = (dp1[i] + dp2[i]*3)%mod
    else:
        dp1[i+1] = dp1[i]
        dp2[i+1] = (dp2[i]*3)%mod
print((dp1[n]+dp2[n])%mod)
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N > K:
  print(X*N + Y*(N-K))
else:
  print(X*a)

### FIXED CODE ###

N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N > K:
  print(X*K + Y*(N-K))
else:
  print(X*N)
N,D=map(int,input().split())
print(N)
print(D)
import math
print(N/(1+2*D))
math.ceil(N/(1+2*D)

### FIXED CODE ###

N,D=map(int,input().split())

import math

print(math.ceil(N/(1+2*D)))
a,b,c,d=map(int, input().split())
while True:
	b -= c
	if c<=0 print"Yes":
      	break
	a -=d
	if a<=0 print"No":
      	break


### FIXED CODE ###


a, b, c, d = map(int, input().split())

while True:
  c -= b
  if c <= 0:
    print('Yes')
    break
  
  a -= d
  if a <= 0:
    print('No')
    break
A,B,C=map(int,input().split())
if A*B*C == 5*5*7
    print('YES')
else:
    print('NO')

### FIXED CODE ###

A,B,C=map(int,input().split())
if A*B*C == 5*5*7:
    print('YES')
else:
    print('NO')
n, m = list(map(int, input().split()))
v = list(map(int, input().split()))
t = sum(v)/(4*m)

ct = 0
for i in v:
    if v>t:
        ct += 1
        
if ct >= m:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n, m = list(map(int, input().split()))
v = list(map(int, input().split()))
t = sum(v)/(4*m)

ct = 0
for i in v:
    if i>=t:
        ct += 1
        
if ct >= m:
    print("Yes")
else:
    print("No")
# あなたは、500円玉をA枚、100円玉をB枚、50円玉をC枚持っています。 これらの硬貨の中から何枚かを選び、合計金額をちょうどX円にする方法は何通りありますか。
A,B,C=map(int,input().split())
# A,B,C,X=map(int,'30 30 30 12000'.split())
N=0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if i*500+j*100+k*50==X:
                N+=1

print(N)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
X = int(input())

N=0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if i*500+j*100+k*50==X:
                N+=1

print(N)
a = list[int(input().split()) for i in range(3)]
a.remove(max(a))
result = 0
for i in range(2):
    result += a[i]
print(int(max(a) * 10 + result))


### FIXED CODE ###

a = list(input().split())
b = int(max(a))
a.remove(max(a))
result = 0
for i in range(2):
    result += int(a[i])
print(b * 10 + int(result))
#一日ごとに晴れ(Sunny)、くもり(Cloudy)、雨(Rainy)、
w = int(input())
if w == "Sunny":
  print("Cloudy")
elif w == "Cloudy":
  print("Rainy")
elif w == "Rainy":
  print("Sunny")
else:
  print("Check")

### FIXED CODE ###

s = input()
if s == "Sunny":
  print("Cloudy")
elif s == "Cloudy":
  print("Rainy")
elif s == "Rainy":
  print("Sunny")
else:
  print("Check")
s = input()
print(ord_s.swapcase)

### FIXED CODE ###

s = input()

if s.isupper():
    print("A")
else:
    print("a")
N = int(input())
H = list(map(int, input().split()))
ans = 0
for i in range(N-1) :
    for k in range(i+1, N):
        if s[i] - s[k] > 1 :
            print('No')
            ans = 1
            break
    else:
        continue
    break
if ans == 0:
    print('Yes')


### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
H[0] -= 1
for i in range(N - 1):
    if H[i] < H[i+1] :
        H[i+1] -= 1

    elif H[i] > H[i+1]:
        print('No')
        exit()

print('Yes')
print(a*b,2*(a+b),'\n')

### FIXED CODE ###

a, b = map(int, input().split())
area = a * b
perimeter = 2 * (a + b)
print(area, perimeter)
H,W,N = [int(input()) for i in range(3)]
o = 1
a = N / o
while a <= H or W:
  if H < W and a > W:
      o += 1
  elif W < H a > H:
      o += 1
print(o)    
    
    
    





	

  
  
  



### FIXED CODE ###

H,W,N = [int(input()) for i in range(3)]
for o in range(1,10000):
  if H <= W and N / o <= W:
    break
  elif H >= W and N / o <= H:
    break
print(o)
a,b=map(int,input().split())
s=[list(map(str,input().split())) for i in range(b)] 
for i in range(b):
    s[i][0]=int(s[i][0])
if b==0:
    print("0 0")
    exit()
aans=0
wans=0
c1=0
for i in range(b-1,-1,-1):
    if s[i][1]=="AC":
        count=i
        break
for i in range(count):
    if s[i][1]=="WA":
        wans+=1

s= list(map(list, set(map(tuple, s))))
for i in range(len(s)):
    if s[i][1]=="AC":
        aans+=1
print(aans,end=" ")
print(wans)

### FIXED CODE ###


a,b=map(int,input().split())

c=[]
for i in range(b):
    d,e=map(str,input().split())
    c.append([int(d),e])

acans=0
waans=0
ac=[0]*(a+1)
wa=[0]*(a+1)
for i in range(b):
    if c[i][1]=="AC":
        if ac[c[i][0]-1]==0:
            acans+=1
            ac[c[i][0]-1]+=1
            waans+=wa[c[i][0]-1]
    else:
        wa[c[i][0]-1]+=1
#print(ac)
#print(wa)
print(acans,waans)
N = int(input())
if N%2 == 1:
  print(((N-1)/2)/((N-1)/2-1))
else:
  print(0.5)

### FIXED CODE ###

N = int(input())
if N%2 == 1:
  print(((N-1)/2+1)/(N))
if N%2 == 0:
  print(0.5)
import collections
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


X = int(input())
if X == 1:
    print("1 0")
else:
    for i in range(X):#i = B
        c = factorization(X+pow(i,5))
        flag = 0
        for j in range(len(c)):
            if c[j][1] % 5 != 0:
                flag = 1
                break
        if flag ==0:
            B = i
            A = 1
            for j in range(len(c)):
                A *= c[j][0]
            break
        c = factorization(X-pow(i,5))
        flag = 0
        for j in range(len(c)):
            if c[j][1] % 5 != 0:
                flag = 1
                break
        if flag ==0:
            B = i
            A = 1
            for j in range(len(c)):
                A *= c[j][0]
            break
    print(A,B)



### FIXED CODE ###

X = int(input())
for A in range(-200,200):
    for B in range(-200,200):
        if pow(A,5)-pow(B,5)==X:
            print(A,B)
            break
    else:
        continue
    break
l=list(map(int,input.split(" ")))
print(l.index("0")+1)

### FIXED CODE ###

l=list(map(int,input().split(" ")))
#print(l)
print(l.index(0)+1)
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

count = [0] * (max(a)+1)

for _a in a:
    if count[_a] == 0:
        count[_a] = 1
    elif count[_a] == 1:
        count[_a] = 0

print(sum(count))


### FIXED CODE ###

from collections import Counter

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

# count = [0] * (max(a)+1)

c = Counter(a)
ans = 0

for _a in list(set(a)):
    if c[_a]%2 != 0:
        ans += 1

print(ans)
import math

X = int(input())

if X == 1:
    print(1)
    exit()

for i in reversed(range(1, X+1)):
    for j in range(2, int(math.sqrt(i))+1):
        if math.isclose(math.log(i, j), round(math.log(i, j)), rel_tol = 0.0000001):
            print(i)
            exit()
    if i == 1:
        print(1)


### FIXED CODE ###

import math

X = int(input())

if X == 1:
    print(1)
    exit()

for i in reversed(range(1, X+1)):
    for j in range(2, int(math.sqrt(i))+1):
        if abs(math.log(i, j) - round(math.log(i, j))) <= 0.0000001:
            print(i)
            exit()
    if i == 1:
        print(1)
H, W = map(int, input().split())
graph = []

for _ in range(H):
    graph.append(list(list(input())))

res = True

for i in range(1, W-1):
    for j in range(1, H-1):
        if graph[i][j] == '#' and graph[i + 1][j] == '.' and graph[i - 1][j] == '.' and graph[i][j + 1] == '.' and graph[i][j - 1] == '.':
            res = False
            break
    if not res:
        break
print('Yes' if res else 'No')


### FIXED CODE ###

H, W = map(int, input().split())
graph = []
for _ in range(H):
    graph.append(list(input()))

res = True

for j in range(1, W-1):
    for i in range(1, H-1):
        if graph[i][j] == '#' and graph[i + 1][j] == '.' and graph[i - 1][j] == '.' and graph[i][j + 1] == '.' and graph[i][j - 1] == '.':
            print('No')
            exit()
print('Yes')
N, X = map(int, input().split()))

for i in range(min(N, X // 10*4) + 1):
  for j in range(min(N-i, (X-10*4*i) // 5000) + 1):
    if (X - 10*4*i - 5000*j) // 1000 == N - i - j:
      print(i,j,N-i-j)
      break
else:
  print(-1,-1,-1)


### FIXED CODE ###

N, X = map(int, input().split())

flag = False
result = [-1,-1,-1]
for i in range(min(N, X // 10**4) + 1):
  for j in range(min(N-i, (X-10**4*i) // 5000) + 1):
    if (X - 10**4*i - 5000*j) // 1000 == N - i - j:
      result = (i,j,N-i-j)
      flag = True
      break
  if flag:
    break
print(*result)
a,b=map(int,input.split())
if a<9&&b<9:
  print("Yay!")
  else:
    print(":(")

### FIXED CODE ###

a,b=map(int,input().split())
if (a<9)&(b<9):
  print("Yay!")
else:
    print(":(")
n,m,k = map(int,input().split())
num = [1 for _ in range(n)]
pre = [i for i in range(n)]
for _ in range(m):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  num[a] += 1
  num[b] += 1
  A = [a]
  B = [b]
  la = 1
  lb = 1
  while a != pre[a]:
    a = pre[a]
    A.append(a)
    la += 1
  while b != pre[b]:
    b = pre[b]
    B.append(b)
    lb += 1
  #print(a,b)
  if a != b:
    if la > lb:
      pre[b] = a
      for aa in A:
        pre[aa] = a
      for bb in B:
        pre[bb] = a
    else:
      pre[a] = b
      for aa in B:
        pre[aa] = b
      for bb in B:
        pre[bb] = b
root = []
cnt = [0 for _ in range(n)]
for i in range(n):
  I = int(i)
  while I != pre[I]:
    I = pre[I]
  root.append(I)
  cnt[I] += 1
#print(pre)
#print(root)
#print(cnt)
ans = []
for i in range(n):
  ans.append(cnt[root[i]]-num[i])
#print(ans)
for _ in range(k):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  if root[a] == root[b]:
    ans[a] -= 1
    ans[b] -= 1
print(' '.join(map(str,ans)))

### FIXED CODE ###

n = int(input())
print((n+1)//2)
a=int(input())
b=int(input())
result=(a*b,2(a+b))
print(result)

### FIXED CODE ###

a,b=list(map(int,input().split()))
print(a*b,2*(a+b))
def digits(num):
    return len(str(num))

N = int(input())
min_d = digits(N)
for i in list(range(2, N, 1)):
    if (N % i == 0):
        min_d = min(digits(i), min_d)

print(min_d)


### FIXED CODE ###

l = input().split()
A = l[0]
B = l[1]
C = int(A) + int(B)
time = C % 24

print(time)
def insertionSort( nums, n, g ):
	cnt = 0
	for i in range( g, n ):
		v = nums[i]
		j = i - g
		while j >= 0 and nums[j] > v:
			nums[ j+g ] = nums[j]
			j -= g
			cnt += 1
		
		nums[ j+g ] = v
	return cnt
		
def shellSort( nums, n ):
	g = []
	v = 1
	while v <= n:
		g.append( v )
		v = 3*v+1     
	g.reverse( )
	m = len( g )
	print( m )
	print( " ".join( map( str, g ) ) )	
	cnt = 0
	for i in range( m ):
		cnt += insertionSort( nums, n, g[i] )
	print( cnt )


n = int( input( ) )
nums = [ int( input( ) ) for i in range( n ) ]
nums.append( 0 )
shellSort( nums, n )
nums.pop( )
for v in nums:
	print( v )

### FIXED CODE ###

import sys
 
def insertionSort( nums, n, g ):
    cnt = 0
    i = g
    while i < n:
        v = nums[i]
        j = i - g
        while 0 <= j and v < nums[j]:
            nums[ j+g ] = nums[j]
            j -= g
            cnt += 1
        nums[ j+g ] = v
        i += 1
    return cnt
         
def shellSort( nums, n ):
    g = []
    val = 1
    while val <= n:
        g.append( val )
        val = 3*val+1
     
    g.reverse( )
    m = len( g )
    print( m )
    print( " ".join( map( str, g ) ) )
    cnt = 0
    for i in range( m ):
        cnt += insertionSort( nums, n, g[i] )
    print( cnt )
     
n = int( sys.stdin.readline( ) )
nums = []
for i in range( n ):
    nums.append( int( sys.stdin.readline( ) ) )
 
shellSort( nums, n )
print( "\n".join( map( str, nums ) ) )
n=input()
satis=[]
 
for i in range(n):
	satis.append(map(int,input().split()))
 
#n=3
#satis=[10, 40, 70, 20, 50, 80, 30, 60, 90]
 
tempA=satis[0]
tempB=satis[1]
tempC=satis[2]
if n > 1:
  for i in range(n-1):
    tempA2=satis[3*i+3]+max([tempB,tempC])
    tempB2=satis[3*i+4]+max([tempA,tempC])
    tempC2=satis[3*i+5]+max([tempA,tempB])
    tempA=tempA2
    tempB=tempB2
    tempC=tempC2
  print(max([tempA,tempB,tempC]))
else:
  print(max([tempA,tempB,tempC]))

### FIXED CODE ###

n=int(input())
satis=[]

for i in range(n):
  A=list(map(int,input().split()))
  satis.extend(A)

tempA=satis[0]
tempB=satis[1]
tempC=satis[2]
if n > 1:
  for i in range(n-1):
    tempA2=satis[3*i+3]+max([tempB,tempC])
    tempB2=satis[3*i+4]+max([tempA,tempC])
    tempC2=satis[3*i+5]+max([tempA,tempB])
    tempA=tempA2
    tempB=tempB2
    tempC=tempC2
  print(max([tempA,tempB,tempC]))
else:
  print(max([tempA,tempB,tempC]))
a,b=map(int, input().split())

print(int(2*b-a))



### FIXED CODE ###

a=int(input())
b=int(input())


print(int(2*b-a))
S = input()

while True:
    if len(S) == 0:
        print('YES')
        break
    else:
        if S[-5:]=='dream':
            S = S[:-5]
        elif S[-7:] == 'dreamer':
            S = S[:-7]
        elif S[-5:]== 'erase':
            S = S[:-5]
        elif S[-6:] == X4:
            S = S[:-6]
        else:
            print('NO')
            break


### FIXED CODE ###

S = input()

while True:
    if len(S) == 0:
        print('YES')
        break
    else:
        if S[-5:]=='dream':
            S = S[:-5]
        elif S[-7:] == 'dreamer':
            S = S[:-7]
        elif S[-5:]== 'erase':
            S = S[:-5]
        elif S[-6:] == 'eraser':
            S = S[:-6]
        else:
            print('NO')
            break
H = int(input())
W = int(input())
h = int(input())
w = int(input())
tate = H-h
yoko = W-w
print(tate*yoko)

### FIXED CODE ###

import numpy as np
H,W = map(int, input().split())
h,w = map(int, input().split())
print((H-h)*(W-w))