Harryxun/stf_run huggingface dataset:
def insertion(A, n, g):
    c = 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
            c += 1
    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 j in A: print(j)

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()
# -*- coding: utf-8 -*-
s = input()
s = list(s)
x = 0
maxIndex = len(s) - 1
count = 0
while True:
    if maxIndex < x + 1:
        break
    if s[x] != s[x + 1]:
        s.pop(x)
        s.pop(x)
        maxIndex = len(s) - 1
        x = min(maxIndex, x - 1)
        count += 1
    else:
        x += 1
print(count * 2)


### FIXED CODE ###

s = input()
x = 0
for c in s:
    if c == '1':
        x = x + 1
print(min(x, len(s) - x) * 2)
s = list(input())
count = []
x = ["A","T","G","C"]
c = 0
for i in range(len(s)):
    if (s[i] in x) == True:
        c += 1
    else:
        count.append(c)
        c = 0

print(max(count))

### FIXED CODE ###

s = list(input())
ans = 0
x = ["A","T","G","C"]
c = 0
for i in range(len(s)):
    if (s[i] in x) == True:
        c += 1
        if ans < c:
            ans = c
    else:
        c = 0
print(ans)
num = [int(n) for n in line.split()]
sides = [num_a, num_b, num_c]
sides.sort()
area = round(sides[0] * sides[1])/2
print(area)

### FIXED CODE ###

ab, bc, ca = map(int, input().split())

area = int((ab*bc)/2)

print(area)
N = int(input())
s = set()
l = []
for i in range(N):
	a,b,c = map(int,input().split(' '))
	l.append(a,b,c)
	e = sorted(l)
	s.add(e)
	l = 0
print(N - len(s))

### FIXED CODE ###

N = int(input())
l = []
s = set()
for i in range(N):
	a,b,c = map(int,input().split(' '))
	l.append(a)
	l.append(b)
	l.append(c)
	l.sort()
	d = str(l[0])
	e = str(l[1])
	f = str(l[2])
	g = d + e + f
	s.add(g)
	l = []
print(N - len(s))
S = list(input())
if S[0]==S[1]orS[1]==S[2]orS[2]==S[3]:
  print("Bad")
else: print("Good")

### FIXED CODE ###

S=list(input())
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
    print("Bad")
else: print("Good")
import math

a, b, c, d = map(int, input().split())
c_flag = 0
d_flag = 0
cd_flag = 0


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


c_multiple_last = b // c
d_multiple_last = b // d
cd_multiple_last = b // lcm(c, d)

for i in range(a, b+1):
    if i % c == 0 and c_flag == 0:
        c_multiple_first = i // c
        c_flag = 1
    if i % d == 0 and d_flag == 0:
        d_multiple_first = i // d
        d_flag = 1
    if i % lcm(c, d) == 0 and cd_flag == 0:
        cd_multiple_first = i // lcm(c, d)
        cd_flag = 1
    if c_flag == 1 and d_flag == 1 and cd_flag == 1:
        break

c_count = c_multiple_last - c_multiple_first + 1
d_count = d_multiple_last - d_multiple_first + 1
cd_count = cd_multiple_last - cd_multiple_first + 1

a_to_b_count = b - a + 1
ans = a_to_b_count - (c_count + d_count - cd_count)
print(ans)



### FIXED CODE ###

import fractions


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


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

c_multiple_last = b // c
d_multiple_last = b // d
cd_multiple_last = b // lcm(c, d)

c_multiple_first = (a-1) // c
d_multiple_first = (a-1) // d
cd_multiple_first = (a-1) // lcm(c, d)

c_count = c_multiple_last - c_multiple_first
d_count = d_multiple_last - d_multiple_first
cd_count = cd_multiple_last - cd_multiple_first

a_to_b_count = b - a + 1
ans = a_to_b_count - (c_count + d_count - cd_count)
print(ans)
N=input();c=0
for n in range(len(N)-1):
    if N[n]==N[n+1]:
        c+=1
    else:
        c=0
   if c>=3:
    print('Yes')
    exit()
print('No')

### FIXED CODE ###

N=input();cnt=0
for i in range(1,4):
    if N[i-1]==N[i]:
        cnt+=1
        if cnt>=2:
            print('Yes')
            exit()
    else:
        cnt=0
print('No')
from functools import reduce
from math import gcd

def main():
    n = int(input())
    a = sorted(int(i) for i in input().split())
    a0 = a[0]
    if a0 == 1:
        print(reduce(gcd, a[1:]))
        return
    c = []
    for i in range(2, int(a0**0.5) + 1):
        while a0 % i == 0:
            c.append(i)
            a0 //= i
    if a0 != 1:
        c.append(a0)
    d = [0] * len(c)
    for ai in a[1:]:
        for i, ci in enumerate(c):
            if ai % ci == 0:
                ai //= ci
            else:
                d[i] += 1
    e = []
    g = 1
    for k, v in zip(c, d):
        if v == 0:
            g *= k
        elif v == 1:
            e.append(k)
    f = [1] * (n - 1)
    for i, ai in enumerate(a[1:]):
        for ei in e:
            if ai % ei == 0:
                ai //= ei
            else:
                f[i] *= ei
    print(max(g * max(f), reduce(gcd, a[1:])))

if __name__ == '__main__':
    main()

### FIXED CODE ###

from functools import reduce
from fractions import gcd

def main():
    n = int(input())
    a = sorted(int(i) for i in input().split())
    a0 = a[0]
    if a0 == 1:
        print(reduce(gcd, a[1:]))
        return
    c = []
    for i in range(2, int(a0**0.5) + 1):
        while a0 % i == 0:
            c.append(i)
            a0 //= i
    if a0 != 1:
        c.append(a0)
    d = [0] * len(c)
    for ai in a[1:]:
        for i, ci in enumerate(c):
            if ai % ci == 0:
                ai //= ci
            else:
                d[i] += 1
    e = []
    g = 1
    for k, v in zip(c, d):
        if v == 0:
            g *= k
        elif v == 1:
            e.append(k)
    f = [1] * (n - 1)
    for i, ai in enumerate(a[1:]):
        for ei in e:
            if ai % ei == 0:
                ai //= ei
            else:
                f[i] *= ei
    print(max(g * max(f), reduce(gcd, a[1:])))

if __name__ == '__main__':
    main()
n=int(input())
h=list(map(input().split()))
ans=0
for i in range(0,n-1):
  if h[i]<=h[i+1]:
    ans+=0
  elif h[i]>=h[i+1]+2:
    ans+=1
  else:
    if i<n-2:
      if h[i+1]<=h[i+2]:
        ans+=0
      else:
        ans+=1    
    else:
      ans+=0
        
if ans==0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
max=h[0]
for i in range(n):
    if h[i]>max:
        max=h[i]-1
    elif h[i]<max:
        print("No")    
        exit()
print("Yes")
a = input()
sn = list(str(a))

for i in sn:
    x = int(i)
    y = y + x

a = int(a)
if a%y == 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a = input()
sn = list(str(a))
y=0
 
for i in sn:
    x = int(i)
    y = y +x

a = int(a)
if a%y == 0:
    print('Yes')
else:
    print('No')
import math
A,B,C,D = list(map(int, input().split()))
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
lcm = lcm(C,D)
nbc = B//C
nbd = B//D
nbl = B//lcm 
nac = (A-1)//C
nad = (A-1)//D
nal = (A-1)//lcm 
ans = B - A + 1-((nbc+nbd-nbl)-(nac+nad-nal))
print(int(ans))

### FIXED CODE ###

from fractions import gcd
A,B,C,D = list(map(int, input().split()))
def lcm(x, y):
    return (x * y) // gcd(x, y)
lcm = lcm(C,D)
nbc = B//C
nbd = B//D
nbl = B//lcm 
nac = (A-1)//C
nad = (A-1)//D
nal = (A-1)//lcm 
ans = B - A + 1-((nbc+nbd-nbl)-(nac+nad-nal))
print(int(ans))
x = input().split()
y = [int(input()) in i in range(int(x[2]))]
member = [int(x[1])] * int(x[0])

for l in y:
  for i,point in enumerate(member):
    if (l-1) != i:
      member[i] = (point -1)
      
for z in member:
  if z > 0:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

x = input().split()
member = [int(x[1])] * int(x[0])

for l in range(int(x[2])):
  y = input()
  member[int(y) - 1] += 1
      
for z in member:
  if (z - int(x[2])) > 0:
    print("Yes")
  else:
    print("No")
# coding: utf-8

n = int(input())
d = len(str(n))
ans = 0

for i in range(1, d+1):
  if i % 2 == 0:
    continue
  
  if i == d:
    print(i)
    print((n % div) + 1)
    div = 10 if (i == 1) else 10**(i-1)
    ans += (n % div) + 1
    break;

  m = 0 if (i == 1) else (10**(i-1))
  mm = 1 if (i == 1) else 0
  ans += (10**(i)) - mm - m

print(ans)

### FIXED CODE ###

# coding: utf-8

n = int(input())
d = len(str(n))
ans = 0

if d == 1:
  print(n)
else:
  for i in range(1, d+1):
    if i % 2 == 0:
      continue

    if i == d:
      ans += n - (10**(i-1)) + 1
      break;

    if i == 1:
      ans += 9
    else:
      ans += (10**i) - (10**(i-1))

  print(ans)
s = input()
n = len(s)
list0 = list()
list2 = list()
ans = 0
for i in range(n-1):
    if s[i:i+2] == '><':
        list0.append(i+1)
    elif s[i:i+2] == '<>':
        list2.append(i+1)

if s[0] == '<':
    list0.insert(0, 0)
else:
    p1 = list0[0]
    ans += 1/2 * p1 * (p1 + 1)


if s[-1] == '>':
    list0.append(n)
else:
    p1 = n - list0[-1]
    ans += 1/2 * p1 * (p1 + 1)

for i in range(len(list2)):
    p1 = max(list2[i] - list0[i], list0[i+1] - list2[i])
    p2 = min(list2[i] - list0[i], list0[i+1] - list2[i])
    ans += 1/2 * p1 * (p1 + 1) + 1/2 * p2 * (p2 - 1)

print(int(ans))


### FIXED CODE ###

s = input()
n = len(s)
list0 = list()
list2 = list()
ans = 0
for i in range(n-1):
    if s[i:i+2] == '><':
        list0.append(i+1)
    elif s[i:i+2] == '<>':
        list2.append(i+1)

if s[0] == '<':
    list0.insert(0, 0)
else:
    if len(list0):
        p1 = list0[0]
    else:
        p1 = n
    ans += 1/2 * p1 * (p1 + 1)



if s[-1] == '>':
    list0.append(n)
else:
    if len(list0):
        p1 = n - list0[-1]
    else:
        p1 = n
    ans += 1/2 * p1 * (p1 + 1)

for i in range(len(list2)):
    p1 = max(list2[i] - list0[i], list0[i+1] - list2[i])
    p2 = min(list2[i] - list0[i], list0[i+1] - list2[i])
    ans += 1/2 * p1 * (p1 + 1) + 1/2 * p2 * (p2 - 1)

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

pirnt('Yes' if a+b >= c else 'No')

### FIXED CODE ###

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

print('Yes' if a+b >= c else 'No')
def main2():
    n = int(input())
    x = int(math.ceil(n / 1.08))
    
    if x == n:
        print(x)
    else:
        print(":(")

if __name__ == "__main__":
    main2()

### FIXED CODE ###

def main():
    n = int(input())

    x = int(n/1.08)
    if int(x * 1.08) == n:
        print(x)
    elif int((x + 1) * 1.08) == n:
        print(x + 1)
    elif int((x - 1) * 1.08) == n:
        print(x - 1)
    else:
        print(":(")

if __name__ == "__main__":
    main()
# coding: utf-8
# Your code here!

#n = int(input())
import sys

sys.setrecursionlimit(100000)

h,W = [int(i) for i in input().split()]
#b = [i for i in input().split()]
board = []
for _ in range(h):
    board.append(input())

checked = [[0]*W for i in range(h)]

dx=[ 0, 1, 0,-1]
dy=[ 1, 0,-1, 0]

ans = 0

def dfs(x,y,b,w):
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
#        print(nx,ny)
#        print(checked)
        if nx < 0 or nx >= h or ny < 0 or ny >= W or checked[nx][ny]==1:
            continue
        if board[x][y] == board[nx][ny]:
            continue
#        print("ok")
        checked[nx][ny]=1
        if board[nx][ny] == '#':
            b+=1
        else:
            w+=1
        b1,w1 = dfs(nx, ny,0,0)
        b+=b1
        w+=w1
#    print(x,y,b,w)
    return b,w

#print(dfs(0,0,0,0))

for i in range(h):
    for j in range(W):
        if checked[i][j] == 1:
            continue
        checked[i][j] = 1
        if board[i][j] == '#':
            b2 = 1; w2=0
        else:
            b2 = 0; w2=1
        b1,w1 = dfs(i,j,b2,w2)
#        print(b1,w1)
        ans += b1*w1

print(ans)        
        

### FIXED CODE ###

# coding: utf-8
# Your code here!

#n = int(input())
import sys

sys.setrecursionlimit(1000000)

h,W = [int(i) for i in input().split()]
#b = [i for i in input().split()]
board = []
for _ in range(h):
    board.append(input())

checked = [[0]*W for i in range(h)]

dx=[ 0, 1, 0,-1]
dy=[ 1, 0,-1, 0]

ans = 0

def dfs(x,y,b,w):
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
#        print(nx,ny)
#        print(checked)
        if nx < 0 or nx >= h or ny < 0 or ny >= W or checked[nx][ny]==1:
            continue
        if board[x][y] == board[nx][ny]:
            continue
#        print("ok")
        checked[nx][ny]=1
        if board[nx][ny] == '#':
            b+=1
        else:
            w+=1
        b1,w1 = dfs(nx, ny,0,0)
        b+=b1
        w+=w1
#    print(x,y,b,w)
    return b,w

#print(dfs(0,0,0,0))

for i in range(h):
    for j in range(W):
        if checked[i][j] == 1:
            continue
        checked[i][j] = 1
        if board[i][j] == '#':
            b2 = 1; w2=0
        else:
            b2 = 0; w2=1
        b1,w1 = dfs(i,j,b2,w2)
#        print(b1,w1)
        ans += b1*w1

print(ans)
n = input()
A = list(map(int, input().split()))

def Chk(a, pos):
    cnt = 0
    tmp = 0
    
    for a in A:
        tmp += a
        
        if pos and tmp < 1:
            cnt += 1 - tmp
            tmp = 1
        elif not pos and tmp > -1:
            cnt += 1 + tmp
            tmp = -1
        
        pos = not pos
    return cnt

print(min(Chk(A, True), Chk(a, False)))

### FIXED CODE ###

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

def Chk(a, pos):
    cnt = 0
    tmp = 0

    for a in A:
        tmp += a

        if pos and tmp < 1:
            cnt += 1 - tmp
            tmp = 1
        elif not pos and tmp > -1:
            cnt += 1 + tmp
            tmp = -1

        pos = not pos
    return cnt

print(min(Chk(A, True), Chk(A, False)))
def main():
    n = int(input())
    a = ord("a")
    orda = lambda x: ord(x)-a
    s = list(map(orda, list(input())))
    q = int(input())
    bits = [BIT(n) for _ in range(26)]
    for i, si in enumerate(s, 1):
        bits[si].add(i, 1)
    for _ in range(q):
        t, i, c = input().split()
        i = int(i)
        if t == "1":
            bits[s[i-1]].add(i, -1)
            bits[ord(c)-a].add(i, 1)
            si[i-1] = ord(c)-a
        else:
            c = int(c)
            cnt = 0
            for bit in bits:
                is_in = bit.sum_(c) - bit.sum_(i-1)
                if is_in:
                    cnt += 1
            print(cnt)
            
            
class BIT:
    __slots__ = ["length", "data"]
    def __init__(self, length):
        self.data = [0]*(length+1)
        self.length = length
    
    def add(self, i, x):
        while i < self.length+1:
            self.data[i] += x
            i += i&-i
    
    def sum_(self, i):
        x = 0
        while i > 0:
            x += self.data[i]
            i -= i&-i
        return x


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n = int(input())
    a = ord("a")
    orda = lambda x: ord(x)-a
    s = list(map(orda, list(input())))
    q = int(input())
    bits = [BIT(n) for _ in range(26)]
    for i, si in enumerate(s, 1):
        bits[si].add(i, 1)
    for _ in range(q):
        t, i, c = input().split()
        i = int(i)
        if t == "1":
            bits[s[i-1]].add(i, -1)
            bits[ord(c)-a].add(i, 1)
            s[i-1] = ord(c)-a
        else:
            c = int(c)
            cnt = 0
            for bit in bits:
                is_in = bit.sum_(c) - bit.sum_(i-1)
                if is_in:
                    cnt += 1
            print(cnt)
            
            
class BIT:
    __slots__ = ["length", "data"]
    def __init__(self, length):
        self.data = [0]*(length+1)
        self.length = length
    
    def add(self, i, x):
        while i < self.length+1:
            self.data[i] += x
            i += i&-i
    
    def sum_(self, i):
        x = 0
        while i > 0:
            x += self.data[i]
            i -= i&-i
        return x


if __name__ == "__main__":
    main()
i = input()
train = min(i[0], i[1])
bus = min(i[2], i[3])
total = train + bus
print(total)


### FIXED CODE ###

train_normal = int(input())
train_unlimited = int(input())
bus_normal = int(input())
bus_unlimited = int(input())
train = min(train_normal, train_unlimited)
bus = min(bus_normal, bus_unlimited)
total = train + bus
print(total)
n=int(input())
l=[]
for i in range(n):
  x=int(input())
  if x in set(l):
    l.append(x)
  if not x in set(l):
    l.remove(x)
print(len(l))

### FIXED CODE ###

n=int(input())
s=set([])
for i in range(n):
  x=int(input())
  if not x in s:
    s.add(x)
  else:
    s.remove(x)
print(len(s))
n = int(input())

if n % 2 = 0:

    print(1 / 2)

else:

    print((n + 1) / 2n)

### FIXED CODE ###

n = int(input())

if n % 2 == 0:

    print(1 / 2)

else:

    print((n + 1) / 2 / n)
m = int(input())
n = list(map(int,input().split))
print("YES" if len(set(n)) == m else "NO")

### FIXED CODE ###

m = int(input())
n = list(map(int,input().split()))
print("YES" if len(set(n)) == m else "NO")
N = int(input())
S = input()

for i in range(N-1):
  if i == 0:
    count = 1
  else:
    if S[i] != S[i+1]:
      count += 1
print(count)

### FIXED CODE ###

N = int(input())
S = input()
ans = 0

for i in range(N-1):
  if S[i] != S[i+1]:
    ans += 1
ans += 1
print(ans)
x,n = map(int,input().split(" "))
if n == 0:
  print(x)
else:
  num = list(map(int, input().split(" ")))
  num.sort()

  if x not in num:
    print(x)
  else:
    y = num.index(x)
    if y == (n-1):
      if num[y-1] == x-1:
        print(x+1)
      else:
        print(x-1)
    elif y == 0:
      print(x-1)
    else:
      for i in range(x):
        y = x-i
        if y not in num:
          under = y
          count_under = i
          break
      for j in range(x):
        y = x + j
        if y not in num:
          upper = y
          count_upper = j
          break
      
      if count_under <= count_upper:
        print(under)
      else:
        print(upper)
   

### FIXED CODE ###

x,n = map(int,input().split(" "))
if n == 0:
  print(x)
else:
  num = list(map(int, input().split(" ")))
  num.sort()

  if x not in num:
    print(x)
  else:
    y = num.index(x)
    if y == (n-1):
      if num[y-1] == x-1:
        print(x+1)
      else:
        print(x-1)
    elif y == 0:
      print(x-1)
    else:
      for i in range(100):
        y = x-i
        if y not in num:
          under = y
          count_under = i
          break
      for j in range(100):
        y = x + j
        if y not in num:
          upper = y
          count_upper = j
          break
      
      if count_under <= count_upper:
        print(under)
      else:
        print(upper)
x,a,b=map(int,input().split())
if q-b>=0:
  print("delicious")
elif -x<=a-b<0:
  print("safe")
else:
  print("dangerous")

### FIXED CODE ###

x,a,b=map(int,input().split())
if a-b>=0:
  print("delicious")
elif -x<=a-b<0:
  print("safe")
else:
  print("dangerous")
import numpy as np
def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    
    ia = 0
    ib = 0
    cost = 0
    while True:
        if ia < len(A) and ib < len(B):
            if A[ia] < B[ia]:
                if cost + A[ia] > K:
                    break
                ia += 1
                cost += A[ia]
            else:
                if cost + B[ib] > K:
                    break
                ib += 1
                cost += B[ib]
        elif ia < len(A):
            if cost + A[ia] > K:
                break
            ia += 1
            cost += A[ia]
        elif ib < len(B):
            if cost + B[ib] > K:
                break
            ib += 1
            cost += B[ib]
        else:
            break
    
    count = ia + ib
    print(count)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from bisect import bisect_right
import numpy as np
def main():
    N, M, K = map(int, input().split())
    A = np.array([0] + list(map(int, input().split())), dtype=np.int64)
    B = np.array([0] + list(map(int, input().split())), dtype=np.int64)

    As = np.cumsum(A)
    Bs = np.cumsum(B)

    count = 0

    for i, a in enumerate(As):
        if a > K:
            break
        j = bisect_right(Bs, K-a)
        #print(f"i={i} j={j} Bs={Bs} cost={K-a}")
        count = max(count, (i+j-1))

    print(count)

if __name__ == '__main__':
    main()
A, B = map(int, raw_input().split())
print(A*B)

### FIXED CODE ###

A, B = map(int,input().split())
print(A*B)
n = int(input())
h = list(map(int,input().split()))
counter = 0
ans = []
for i in range(n-1):
    if h[i] >= h[i+1]:
        counter +=1
    else:
        ans.append(counter)
        counter = 0

print(max(ans,counter))

### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
counter = 0
ans = []
for i in range(n-1):
    if h[i] >= h[i+1]:
        counter +=1
    else:
        ans.append(counter)
        counter = 0
ans.append(counter)
print(max(ans))
import numpy as np

N, K = map(int, input().split())
p = np.array(list(map(int, input().split())))

def ave(v):
    return np.mean(np.arange(1, v + 1))

vave = np.vectorize(ave)
s = vave(p)

answer = np.sum(s[:K])
current = answer
for i in range(1, N - K + 1):
    current = current - s[i - 1] + s[i + K - 1]
    answer = max(answer, current)

print(answer)

### FIXED CODE ###

N, K = map(int, input().split())
p = list(map(int, input().split()))
s = [0] * N

for i in range(N):
    s[i] = (1 + p[i]) / 2

answer = sum(s[:K])
current = answer
for i in range(1, N - K + 1):
    current = current - s[i - 1] + s[i + K - 1]
    answer = max(answer, current)

print(answer)
a, b = input().split()
if a < b:
    print('<')
elsif a > b:
 	print('>')
else:
  	print('=')

### FIXED CODE ###

a, b = input().split()

if a < b:
  print('<')
elif a>b:
  print('>')
else:
  print('=')
n,m,x = map(int,input().split())

A=[0]*n
c=[0]*n

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

for i in range(n):
    c[i]= A[i][0]
    A[i] = A[i][1:]

import numpy as np
import sys

a = np.array(A)

ans = 10**5+1

for s in range(1<<n):
    cost = 0
    d = np.array([0]*m)
    for i in range(n):
        if s>>i&1:
            cost += c[i]
            d += a[i]
    if all(d >= x):
        ans = min(ans,cost)

print(ans if ans != 10**5+1 else '-1')

### FIXED CODE ###

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

A=[0]*n
c=[0]*n

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

for i in range(n):
    c[i]= A[i][0]
    A[i] = A[i][1:]

import numpy as np
import sys

a = np.array(A)

ans = np.inf

for s in range(1<<n):
    cost = 0
    d = np.array([0]*m)
    for i in range(n):
        if s>>i&1:
            cost += c[i]
            d += a[i]
    if all(d >= x):
        ans = min(ans,cost)

print(ans if ans != np.inf else '-1')
import math
N=int(input())
print(math.factorial(N)/math.factorial(N-3)

### FIXED CODE ###

N=int(input())
print(N**3)
while True:
	a, b = map(int, input().split())
	if a < b:
		print(a, b)
	elif b <= a:
		print(b, a)
	elif a == 0 and b ==0:
		print(a, b)
		break;

### FIXED CODE ###

while True:
	a, b = map(int, input().split())
	if a == 0 and b ==0:
		break;
	elif a <= b:
		print(a, b)
	elif b < a:
		print(b, a)