Harryxun/stf_run huggingface dataset:
N = int(input())
X = input()
p0 = X.count('1')
p1, p2 = p0-1, p0+1
mem = {0:0}
def f(n):
    if n in mem:
        return mem[n]
    else:
        p = bin(n).count('1')
        ret = f(n % p) + 1
        mem[n] = ret
        return ret
r1 = r2 = 0
k1 = k2 = 1
for i in range(N):
    if X[-i-1] == '1':
        r1 = (r1+k1) % p1
        r2 = (r2+k2) % p2
    k1 = k1 * 2 % p1
    k2 = k2 * 2 % p2

ans = [None]*N
k1 = k2 = 1
for i in range(N):
    if X[-i-1] == '0':
        r = (r2 + k2) % p2
    else:
        r = (r1 - k1) % p1
    ans[-i-1] = f(r) + 1
    k1 = k1 * 2 % p1
    k2 = k2 * 2 % p2
for i in range(N):
    print(ans[i])


### FIXED CODE ###

N = int(input())
X = input()
p0 = X.count('1')
p1, p2 = p0-1, p0+1
mem = {0:0}
def f(n):
    if n in mem:
        return mem[n]
    else:
        p = bin(n).count('1')
        ret = f(n % p) + 1
        mem[n] = ret
        return ret
r1 = r2 = 0
k1 = k2 = 1
for i in range(N):
    if X[-i-1] == '1':
        if p1 > 0:
            r1 = (r1+k1) % p1
        r2 = (r2+k2) % p2
    if p1 > 0:
        k1 = k1 * 2 % p1
    k2 = k2 * 2 % p2

ans = [None]*N
k1 = k2 = 1
for i in range(N):
    if X[-i-1] == '0':
        r = (r2 + k2) % p2
        ans[-i-1] = f(r) + 1
    elif p1 > 0:
        r = (r1 - k1) % p1
        ans[-i-1] = f(r) + 1
    else:
        ans[-i-1] = 0
    if p1 > 0:
        k1 = k1 * 2 % p1
    k2 = k2 * 2 % p2
for i in range(N):
    print(ans[i])
while True:
    n = int(raw_input())
    ls = []
    try:
        ls = map(int,raw_input().split())
        mi = min(ls)
        ma = max(ls)
        su = sum(ls)
        print "%d %d %d" %(mi,ma,su)
        
    except EOFError:
        break        

### FIXED CODE ###

n = int(raw_input())

ls = map(int,raw_input().split())
mi = min(ls)
ma = max(ls)
su = sum(ls)
print "%d %d %d" % (mi,ma,su)
S = input()
T = input()

N = len(S)
M = len(T)

ans = 'UNRESTORABLE'

if N < M:
    print(ans)
    exit()

for i in range(N-M,-1,-1):
    b = True
    for j in range(M):
        if S[i+j] == '?' or S[i+j] == T[j]:
            continue
        b = False
    if b:
        ans = S[:i] + T + S[i+j+1:]
        break
ans = list(ans)
for i in range(N):
    if ans[i] == '?':
        ans[i] = 'a'
print(''.join(ans))


### FIXED CODE ###

S = list(input())
T = list(input())
lenS = len(S)
lenT = len(T)
change = 0
for i in range(lenS-lenT,-1,-1):
    a = 1
    for j in range(lenT):
        if S[i+j] != T[j] and S[i+j] != '?':
            a = 0
    if a == 1:
        for j in range(lenT):
            S[i+j] = T[j]
        change = 1
        break

for i in range(lenS):
    if S[i] == '?':
        S[i] = 'a'

if change == 1:
    print(''.join(S))
else:
    print('UNRESTORABLE')
import sys
from collections import deque, defaultdict
import copy
import bisect
#input=sys.stdin.readline
#sys.setrecursionlimit(10 ** 9)
import math
import heapq

for i in range(N - 1):
	print(i*10000, end = "")
	print(" ", end = "")
print(0)





### FIXED CODE ###


a = int(input())
s = input()
if a >= 3200:
	print(s)
else:
	print("red")
from collections import deque
n, m = map(int, input().split())
dat = deque([])
dat_finish = [False] * (n + 1)

for i in range(m):
    a, b = map(int, input().split())
    dat.append((a, b))

dat2 = dat.copy()

for i in range(m):
    a, b = dat.pop()
    if b == n:
        dat_finish[a] = True

c = False
for i in range(m):
    a, b = dat2.pop()
    if a == 1:
        if dat_finish[b]:
            c = True

print("POSSIBLE" if c else "IMPOSSIBLE")

### FIXED CODE ###

n, m = map(int, input().split())
dat = []
dat_m = [[]] * (n+1)
dat_finish = [False] * (n+1)

for i in range(m):
    a,b = map(int, input().split())
    dat.append( (a,b) )

#print(dat)
for i in range(m):
    a,b = dat[i]
    if b == n:
        dat_finish[a] = True
#print(dat_finish)

c = False
for i in range(m):
    a,b = dat[i]
    if a == 1:
        if dat_finish[b]:
            c = True

print("POSSIBLE" if c else "IMPOSSIBLE")
L,R = map(int,input().split())

#f = 0
l = []

if R-L>=2019:
    #f = 1
    print(0)
    exit()

for i in range(L,R):
    for j in range(i+1,R+1):
        l.append((i*j)%2019)
else:
    l.sort()

if 3 in l and 673 in l:
    print(0)
elif 3 in l:
    print(min(l),637))
elif 637 in l:
    print(min(l),3))
else:
    print(min(l))



### FIXED CODE ###

L,R = map(int,input().split())

#f = 0
l = []

if R-L>=2019:
    #f = 1
    print(0)
    exit()

for i in range(L,R):
    for j in range(i+1,R+1):
        l.append((i*j)%2019)
else:
    l.sort()

print(l[0])
a,b = map(int,input().split())
outlet = 1
ans = 0
while outlet < B:
  outlet -= 1
  outlet += a
  ans += 1
  
print(ans)

### FIXED CODE ###

a,b = map(int,input().split())
outlet = 1
ans = 0
while outlet < b:
  outlet -= 1
  outlet += a
  ans += 1
  
print(ans)
# -*- coding: utf-8 -*-
import sys
n = int(input());
words = []

for i in range(n):
    words.append(input())

# 単語が重複していたらアウト
                            if (len(words) > len(set(words))):
    print('No')
    sys.exit(0)

before_word = words.pop(0)
while( len(words) > 0 ):
    after_word = words.pop(0)
    # しりとりになっていなかったらアウト
    if (before_word[-1] != after_word[0]):
        print('No')
        sys.exit(0)
    before_word = after_word
print('Yes')

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
n = int(input());
words = []

for i in range(n):
    words.append(input())

if (len(words) > len(set(words))):
    print('No')
    sys.exit(0)

before_word = words.pop(0)
while( len(words) > 0 ):
    after_word = words.pop(0)
    if (before_word[-1] != after_word[0]):
        print('No')
        sys.exit(0)
    before_word = after_word
print('Yes')
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
d=[]
for i in range(n):
  for j in range(n):
    if i!=j:
      d.append((l[i][0]-l[j][0],l[i][1]-l[j][1]))
from collections import Counter as c
print(n-c(d).most_common()[0][1])

### FIXED CODE ###

n=int(input())
if n==1:
  print(1)
  exit()
l=[list(map(int,input().split())) for _ in range(n)]
d=[]
for i in range(n):
  for j in range(n):
    if i!=j:
      d.append((l[i][0]-l[j][0],l[i][1]-l[j][1]))
from collections import Counter as c
print(n-c(d).most_common()[0][1])
import sys
sys.setrecursionlimit(1500)
n=int(input())
arr=list(map(int,input().split()))
vis={}
vis[0] = 0
if n < 2:
  print(0)
if n == 2:
  print(min(arr[0]-arr[1]))
vis[1] = min(arr[0]-arr[1])
def count(n):
  	if n < 0:
      return 0
    if n in vis:
        return vis[n]
    else:
      vis[n]=min(abs(arr[n-1]-arr[n-2])+count(n-1),abs(arr[n-1]-arr[n-3])+count(n-2))
    return vis[n]
print(count(n))

### FIXED CODE ###

n=int(input())
arr=list(map(int,input().split()))
if n < 2:
  print(0)
vis = [0] * n
vis[0] = 0
vis[1] = abs(arr[0]-arr[1])
for i in range(2, n):
    step_1 = abs(arr[i]-arr[i-1]) + vis[i-1]
    step_2 = abs(arr[i]-arr[i-2]) + vis[i-2]
    vis[i] = min(step_1, step_2)
print(vis[-1])
s = input().split()[1]
print(s.count("ABC"))

### FIXED CODE ###

s = input()
s = input()
print(s.count("ABC"))
N = int(input())
T=[int(input()) for _ in range(N)]
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
def lcm(a, b):
    return a * b // gcd(a, b)
ans = lcm(T[0], T[1])
for i in range(2,N-1):
    ans = lcm(ans, T[i])
print(ans)

### FIXED CODE ###

N = int(input())
T=[int(input()) for _ in range(N)]
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
def lcm(a, b):
    return a * b // gcd(a, b)
if N>1:
    ans = lcm(T[0], T[1])
    for i in range(2,N):
        ans = lcm(ans, T[i])
else:
    ans=T[0]
print(ans)
l=raw_input()
k=l.split()
a=int(k[0])
b=k[3] 
c=int(k[2])
#
if b='+':
        print a + b
if b='-':
        print a - b
if b='*':
        print a * b
if b='/':
        print a / b

### FIXED CODE ###

l=raw_input()
k=l.split()
a=int(k[0])
op=k[1]
b=int(k[2])
#
while op<>'?':
        if op=='+':
                print a + b
        if op=='-':
                print a - b
        if op=='*':
                print a * b
        if op=='/':
                print a / b
#
        l=raw_input()
        k=l.split()
        a=int(k[0])
        op=k[1]
        b=int(k[2])
def calc(val, unit):
	if unit == 'BTC':
		val *= 380000
	return val

sum41 = 0
n = int(input())
for _ in range(n):
	tmp = input().rstrip('\n').split(' ')
	sum41 += calc(int(tmp[0]), tmp[1])

print(1.0 * sum41)

### FIXED CODE ###

sum41 = 0
n = int(input())
for _ in range(n):
	tmp = input().split(' ')
	sum41 += float(tmp[0]) if tmp[1] == 'JPY' else float(tmp[0]) * 380000

print(1.0 * sum41)
a1, a2, a3 = map(int, input().split())
if a1 + a2 + a3 <= 21:
  print("win)
else:
        print("bust")

### FIXED CODE ###

a1, a2, a3 = map(int, input().split())
if a1 + a2 + a3 <= 21:
  print("win")
else:
  print("bust")
n = input()
m = input()
m = list(m)
m = [int(i) for i in m]
mx = max(m)
ind = m.index(mx)

c = 0
j = len(m)
for i in reversed(m[ind:]):
    if i < mx:
        d = mx - i
        c += d
ind_i = 0
for i in m[1:ind]:
    if m[ind_i] > i:
        num = m[ind_i] - i
        c+= num
    ind_i += 1
    
print(c)

### FIXED CODE ###

n = input()
m = input().split()
m = [int(i) for i in m]
mx = max(m)
ind = m.index(mx)
 
c = 0
j = len(m)
for i in reversed(m[ind:]):
    if i < mx:
        d = mx - i
        c += d
        
ind_i = 0
for i in m[1:ind]:
    #print(i)
    if m[ind_i] > i:
        num = m[ind_i] - i
        m[ind_i+1] += num
        c+= num
    
    ind_i += 1
    
print(c)
A=["k","e","y","e","n","c","e"]
f=-1;p=0;q=0;r=0
S=list(map(str,input()))
if S[0:7]==A or S[len(S)-7:len(S)]==A:
  f=1
else:
  if S[0]!=A[0]:
    f=0
  else:    
    for i in range(len(S)):
      if S[i]==A[i-q]:
        p=p+1
        r=0
      else:
        if q>0 and r==0:
          f=0
          q=q+1
          
        else:
          r=1
          q=q+1
if f==0:
  print("NO")
  
elif f==1:
  print("YES")
  
else:
  if p==7 and (p+q)==len(S):
    print("YES")
    
  else:
    print("NO")

### FIXED CODE ###

A=["k","e","y","e","n","c","e"]
f=-1;p=0;q=0;r=0
S=list(map(str,input()))
if S[0:7]==A or S[len(S)-7:len(S)]==A:
  f=1
else:
  if S[0]!=A[0]:
    f=0
  else:    
    for i in range(len(S)):
      if S[i]==A[i]:
        p=p+1
      else:
        if A[0:p]+S[len(S)-(len(A)-p):len(S)]==A:
          #print(A[0:p]+S[len(S)-(len(A)-p):len(S)])
          f=1
          break
        else:
          f=0
          break
print("YES" if f==1 else "NO")
# coding:utf-8
A,B = [int(i) for i in input().split]
if (1 <= A <= 9) and (1 <= B <= 9):
    print(A*B)
else:
    print(-1)


### FIXED CODE ###

# coding:utf-8
[A, B] = [int(i) for i in input().split(" ")]
if (1 <= A <= 9) and (1 <= B <= 9):
    print(A*B)
else:
    print(-1)
n = int(input())
s = input()
k = int(input())
for i in range(length(s))
	if s[i] != s[k]
  		s[i] = *
print(s)


### FIXED CODE ###

input()
S=input()
k=int(input())
for s in S:print(s if s==S[k-1] else "*",end="")
a = int(input())
l = list(map(int,input().split()))
s = 0 
for i ,j in zip(l,l[1:]):
  if i + j == "#.":s+=1
print(s)

### FIXED CODE ###

input()
S=input()
dot=S.count(".")
ans=dot
count=0
for s in S:
    if s=="#":count+=1
    else:dot-=1
    ans=(min(ans,count+dot))
print(ans)
a, b = map(lambda x: int(x), input().split())

lis = [a+b, a-b, a*c]
print(max(lis))

### FIXED CODE ###

a, b = map(lambda x: int(x), input().split())

lis = [a+b, a-b, a*b]
print(max(lis))
import sys
n=int(input())
lrp=[]
lrm=[]
def g(s):
    i = 0
    l = [0]
    for j in s:
        if j =="(":
            i += 1
        else:
            i -= 1
        l.append(i)
    return min(l),max(l)
for _ in range(n):
    s = input()
    l = s.count("(")
    r = len(s) - l
    mi,ma =g(s)
    if l>r:
        lrp.append((l,r))
    else:
        lrm.append((l,r))
    lr.append((mi,ma,l,r))
    
lrp.sort(key=lambda x:x[0])
lrm.sort(key=lambda x:-x[1])
lr=lrp+lrm
cnt = 0
for l,r in lr:
    cnt -= r
    if cnt >=0:
        cnt += l
    else:
        print("No")
        sys.exit()
if cnt !=0:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

import sys
n = int(input())
ss =[]
for _ in range(n):
    ss.append(input())
cnt_p = []
cnt_m = []
for i in range(n):
    left = 0
    right = 0
    for s in ss[i]:
        if(s == '('):
            left += 1
        elif(s == ')'):
            if(left > 0):
                left -= 1
            else:
                right += 1
    if(left-right > 0):
        cnt_p.append((right,left))
    else:
        cnt_m.append((right,left))
 
 
cnt_p = sorted(cnt_p, key=lambda x: (x[0]))
cnt_m = sorted(cnt_m, key=lambda x: (x[1]*-1))
cnt = cnt_p + cnt_m
num = 0
for right,left in cnt:
    num -= right
    if(num < 0):
        print('No')
        sys.exit()
    num += left
if(num==0):
    print('Yes')
else:
    print('No')
import numpy as np

S = input()
mod = int(10**9 + 7)
dp = np.zeros(13)
dp[0] = 1

M = np.zeros((13, 13))
for i in range(13):
    for d in range(10):
        M[i][(i * 10 + d) % 13] += 1

for i in range(len(S)):
    ndp = np.zeros(13)
    if S[i] == '?':
        ndp = np.matmul(dp, M)
    else:
        d = int(S[i])
        for j in range(13):
            ndp[(j * 10 + d) % 13] += dp[j]
    dp = np.mod(ndp, 1000000007)

print(int(dp[5]))

### FIXED CODE ###

import numpy as np
 
s = input()
p = np.array([0]*13)
p[0] = 1
 
amari = [[0]*13 for _ in range(13)]
for j in range(10):
  for i in range(13):
    amari[i][(i*10+j)%13] += 1
M = np.array(amari)
 
for si in range(len(s)):
  a = np.array([0]*13)
  if s[si] == '?':
    a = np.dot(p,M)
  else:
    c = int(s[si])
    for i in range(13):
      a[(i*10+c)%13] += p[i]
  p = np.mod(a,1000000007)
print(p[5])
n,x=map(int,input().split())
a=list(map(int,input().split()))
dp=[-1]*n
dp[0]=0
if n<x:
    x=n
for i in range(1,x+1):
    dp[i]=abs(a[i]-a[0])

for i in range(x+1,n):
    min1=10**9
    for j in range(i-(x),i):  
        if min1>dp[j]+abs(a[j]-a[i]):               
            min1=dp[j]+abs(a[j]-a[i])
    dp[i]=min1
print(dp[-1])


### FIXED CODE ###

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

dp=[-1]*n
dp[0]=0
dp[1]=abs(a[0]-a[1])

for i in range(2,n):
    dp[i]=min(
        dp[i-2]+abs(a[i]-a[i-2]),
        dp[i-1]+abs(a[i]-a[i-1])
    )
    
print(dp[-1])
import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()

# Aでxの根を求める
def find(A, x):
    p = A[x]
    if p == x:
        return x
    a = find(A, p)
    A[x] = a
    return a

# Aでxとyの属する集合の併合
def union(A, x, y):
    if find(A, x) > find(A, y):
        bx, by = find(A, y), find(A, x)
    else:
        bx, by = find(A, x), find(A, y)
    # 根をbx(値の小さい方)に統一 
    A[by] = bx

V = [i for i in range(N)]
for i in range(M):
    x, y, z = lr()
    if find(V, x-1) != find(V, y-1):
        union(V, x-1, y-1)

answer = [find(x) for x in set(V)]
print(len(answer))
# 36


### FIXED CODE ###

import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()

# Aでxの根を求める
def find(A, x):
    p = A[x]
    if p == x:
        return x
    a = find(A, p)
    A[x] = a
    return a

# Aでxとyの属する集合の併合
def union(A, x, y):
    if find(A, x) > find(A, y):
        bx, by = find(A, y), find(A, x)
    else:
        bx, by = find(A, x), find(A, y)
    # 根をbx(値の小さい方)に統一 
    A[by] = bx

V = [i for i in range(N)]
for i in range(M):
    x, y, z = lr()
    if find(V, x-1) != find(V, y-1):
        union(V, x-1, y-1)

answer = [find(V, x) for x in set(V)]
print(len(set(answer)))
# 36
import collections
n,m = map(int, raw_input().split(' '))
matrix = [raw_input() for _ in range(n)]
dpleft = [[0 for j in range(m)] for i in range(n)]
dpright = [[0 for j in range(m)] for i in range(n)]
dpup = [[0 for j in range(m)] for i in range(n)]
dpdown = [[0 for j in range(m)] for i in range(n)]

for i in range(len(matrix)):
	cumul = 0
	for j in range(len(matrix[i])):
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpleft[i][j] = cumul
			cumul +=1

	cumul = 0
	for j in range(len(matrix[i]))[::-1]:
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpright[i][j] = cumul
			cumul +=1

for j in range(len(matrix[0])):
	cumul = 0
	for i in range(len(matrix)):
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpup[i][j] = cumul
			cumul +=1

	cumul = 0
	for i in range(len(matrix))[::-1]:
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpdown[i][j] = cumul
			cumul +=1
r = 0
for i in range(len(matrix)):
	for j in range(len(matrix)):
		if matrix[i][j] == '.':
			r = max(r, 1 + dpleft[i][j] + dpright[i][j] + dpdown[i][j] + dpup[i][j])
print r

### FIXED CODE ###

import collections
n,m = map(int, raw_input().split(' '))
matrix = [list(raw_input()) for _ in range(n)]
dpleft = [[0 for j in range(m)] for i in range(n)]
dpright = [[0 for j in range(m)] for i in range(n)]
dpup = [[0 for j in range(m)] for i in range(n)]
dpdown = [[0 for j in range(m)] for i in range(n)]

for i in range(n):
	cumul = 0
	for j in range(m):
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpleft[i][j] = cumul
			cumul +=1

	cumul = 0
	for j in range(m-1,-1,-1):
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpright[i][j] = cumul
			cumul +=1

for j in range(m):
	cumul = 0
	for i in range(n):
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpup[i][j] = cumul
			cumul +=1

	cumul = 0
	for i in range(n-1,-1,-1):
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpdown[i][j] = cumul
			cumul +=1
r = 0
for i in range(len(matrix)):
	for j in range(len(matrix[0])):
		if matrix[i][j] != '#':
			r = max(r, 1 + dpleft[i][j] + dpright[i][j] + dpdown[i][j] + dpup[i][j])

print r
n, k = map(int, input().split())
p = [int(x) for x in input().split()]

M = 0
for i in range(k):
    M += (1 + p[i]) / 2

e = M
for i in range(n-k):
    e -= (1 + p[i]) / 2
    e += (1 + p[i+k]) / 2
    if e > M:
        M = e
print(f'{M:.12f}')

### FIXED CODE ###

n, k = map(int, input().split())
p = [int(x) for x in input().split()]

M = 0
for i in range(k):
    M += (1 + p[i]) / 2

e = M
for i in range(n-k):
    e -= (1 + p[i]) / 2
    e += (1 + p[i+k]) / 2
    if e > M:
        M = e
print('{:.12f}'.format(M))
from fractions import gcd
N, M = map(int, input().split())
an = list(map(int, input().split()))

a = an[0]
for i in range(1, len(an)):
    GCD = gcd(a, A[i])
    x, y = a // GCD, A[i] // GCD
    if x % 2 == y % 2 == 1:
        a = x*y*z
    else:
        print(0)
        break
else:
    print(-(-M//a))

### FIXED CODE ###

import fractions
from functools import reduce
import numpy as np
import sys

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


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


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


def listdivide(list):
    numpy = np.array(list)
    numpy = numpy//2
    return numpy.tolist()


def divide2(x):
    res = 0
    while x % 2 == 0:
        x /= 2
        res += 1
    return res


# while gcd_list(an) % 2 == 0:
#     print(gcd_list(an))
an = listdivide(an)

t = divide2(an[0])
for i in range(1, N):
    if divide2(an[i]) != t:
        print(0)
        sys.exit()

for i in range(t):
    an = listdivide(an)
    M = M // 2

LCM = lcm_list(an)

if LCM > M == 0:
    print(0)
else:
    print(-(-(M // LCM)//2))
n, k = map(int, input().split())
p = list(map(int, input().split()))
  
s = []
sump = 0
for i in range(n):
  sump += (p[i] + 1) / 2
  s.append(sump)
  
ans = set()
for i in range(k, n):
  ans.add(s[i]-s[i-k])
  
if n == 1:
  print(s[0])
else:
  print(max(ans))

### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
m = sum(p[0: k])
sump = m

for i in range(1, n-k+1):
  sump = sump - p[i-1] + p[i+k-1]
  if m < sump:
    m = sump

ans = (m + k) / 2

print(ans)
pass = input()
if pass[0] == pass[1] or pass[1] == pass[2] or pass[2] == pass[3]: print("Bad")
else: print("Good")

### FIXED CODE ###

passw = input()
if passw[0] == passw[1] or passw[1] == passw[2] or passw[2] == passw[3]: print("Bad")
else: print("Good")
N = input()
List = map(int, input().split())
newList = sorted(List)[::-1]
print(sum(newList)[::2] - sum(newList)[1::2])

### FIXED CODE ###

N = input()
List = map(int, input().split())
nList = sorted(List)[::-1]
print(sum(nList[::2]) - sum(nList[1::2]))
n = int(input())
h = list(map(int, input().split()))
high = h[0]
ans = 1
for i in range(1,n):
    if high <= h[i]:
        ans += 1
        high = h[i]

print(ans)

### FIXED CODE ###

a, b = map(int, input().split())
print(max(a, b)*2-(a!=b))
S = list(input())
a = S[0] + S[1]
b = S[2] + S[3]
A = int(a)
B = int(b)

if (0 < A < 13 and 0 < B < 13):
  print("AMBIGUOUS")
elif (0 < A < 13 and 12 < B < 100):
  print("MMYY")
elif (0 < A < 13 and B == 0):
  print("MMYY")
elif (0 < B < 13 and 12 < A < 100):
  print("YYMM")
elif (0 < B < 13 and A == 0):
  print("YYMM")
  
else:
  print("NA")


### FIXED CODE ###

N, K = map(int, input().split())
S = list(input())

           
if(S[K-1] == "A"):
  S[K-1] = "a"
elif(S[K-1] == "B"):
  S[K-1] = "b"
elif(S[K-1] == "C"):
  S[K-1] = "c"
           
"".join(S)

S_1 = S[0]
for i in range(1,N):
  S_1 = S_1 + S[i]
print(S_1)
import numpy as np
n,d,a=map(int,input().split())
flag=np.zeros(10**9+1)
XH=[list(map(int,input().split())) for _ in range(n)]
XH.sort(key=lambda A:A[0])
cnt=0
for i in range(n):
    kaisu=0
    x,h=XH[i]
    if flag[x]==0:
        kaisu=(h+a-1)//a
        flag[x:min((x+2*d+1),10**9+1)]+=kaisu*a
        cnt+=kaisu
    else:
        if flag[x]<h:
            h-=flag[x]
            kaisu=(h+a-1)//a
            flag[x:min((x+2*d+1),10**9+1)]+=kaisu*a
            cnt+=kaisu
print(int(cnt))

### FIXED CODE ###

from heapq import heappush, heappop

n, d, a = map(int, input().split())
actions = []
for _ in range(n):
    x, h = map(int, input().split())
    heappush(actions, (x, 0, (h + a - 1) // a))
cnt = 0
bomb = 0
current_bomb = 0
while cnt < n:
    a, c, b = heappop(actions)
    if c:
        current_bomb -= b
        continue
    else:
        HP = b
        if HP <= current_bomb:
            cnt += 1
            continue
        else:
            HP -= current_bomb
            cnt += 1
            current_bomb += HP
            bomb += HP
            heappush(actions, (a + 2 * d, 1, HP))
print(bomb)
S = input()

red = 0  # 0
blue = 0 # 1
m = 0
for s in S:
	if s = '0':
		if blue != 0:
			blue -= 1
			m += 2
		else:
			red += 1
	elif s = '1':
		if red != 0:
			red -= 1
			m += 2
		else:
			blue += 1

print(m)

### FIXED CODE ###

S = input()

red = 0  # 0
blue = 0 # 1
m = 0
for s in S:
	if s == '0':
		if blue != 0:
			blue -= 1
			m += 2
		else:
			red += 1
	elif s == '1':
		if red != 0:
			red -= 1
			m += 2
		else:
			blue += 1

print(m)
N = int(input())
testimony = [[-1]*N for i in range(N)]
count = 0
for i in range(N):
  A = int(input())
  for j in range(A):
    x,y = map(int,input().split())
    testimony[i][x-1]=y
fro i in range(2**N):
  honest = [0]*N
  for j in range(N):
    if(i>>j)&1:
      honest[j]=1
  flag=True
  for j in range(N):
    if honest[j]==1:
      for k in range(N):
        if testimony[j][k]==-1:
          continue
        if testimony[j][k]!=honest[k]:
          flag=False
  if flag==True:
    count=max(count,hones.count(1))
print(count)

### FIXED CODE ###

N = int(input())
testimony = [[-1]*N for i in range(N)]
count = 0
for i in range(N):
  A = int(input())
  for j in range(A):
    x,y = map(int,input().split())
    testimony[i][x-1]=y
for i in range(2**N):
  honest = [0]*N
  for j in range(N):
    if(i>>j)&1:
      honest[j]=1
  flag=True
  for j in range(N):
    if honest[j]==1:
      for k in range(N):
        if testimony[j][k]==-1:
          continue
        if testimony[j][k]!=honest[k]:
          flag=False
  if flag==True:
    count=max(count,honest.count(1))
print(count)