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

import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

S = S()


result = 0
while True:
    if S.find('01') < 0 and S.find('10') < 0:
        print(result)
        exit()
    if S.find('01') >= 0:
        idx = S.find('01')
        S = S[:idx] + S[idx+2:]
        result += 2

    if S.find('10') >= 0:
        idx = S.find('10')
        S = S[:idx] + S[idx+2:]
        result += 2




### FIXED CODE ###

import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

S = S()
#  S = ''
#  for i in range(10**5):
#      if i % 2 == 0:
#          S += '011'
#      else:
#          S += '1'
#  S = '011'*100000

#  print(S)
result = 0
# 0と1すくない方の数になる絶対
print(min(S.count('1'), S.count('0'))*2)
#  while True:
#      print('loop;')
#      if S.find('01') < 0 and S.find('10') < 0:
#          print(result)
#          exit()
#      if S.find('01') >= 0:
#          idx = S.find('01')
#          S = S[:idx] + S[idx+2:]
#          result += 2

#      if S.find('10') >= 0:
#          idx = S.find('10')
#          S = S[:idx] + S[idx+2:]
#          result += 2
### BUGGY CODE ###

D,G = map(int,input().split())
pc = [list(map(int,input().split())) for _ in range(D)]
from itertools import permutations
#%%
import math
INF = 1<<30
ans = INF
A = [i for i in range(D)]

permu = permutations(A)

for pp in permu:
    points = 0
    count = 0
    for i in pp:
        if points>=G:
            break
        if points+(i+1)*100*pc[i][0]>=G:
            count += math.ceil((G-points)/(100*(i+1)))
            break
        else:
            count += pc[i][0]
            points += (i+1)*100*pc[i][0]+pc[i][1]
        
    ans = min(ans,count)

print(ans)

### FIXED CODE ###

D,G = map(int,input().split())
pc = [list(map(int,input().split())) for _ in range(D)]
from itertools import permutations
#%%
import math
INF = 1<<30
ans = INF
A = [i for i in range(D)]

permu = permutations(A)

for pp in permu:
    points = 0
    count = 0
    for i in pp:
        if points>=G:
            break
        if points+(i+1)*100*pc[i][0]>=G:
            count += math.ceil((G-points)/(100*(i+1)))
            break
        else:
            count += pc[i][0]
            points += (i+1)*100*pc[i][0]+pc[i][1]
        
    ans = min(ans,count)

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

import fractions
n, m = map(int, input().split())
s = input()
t = input()
l = n*m//fractions.gcd(n, m)
a, b = l//n, l//m
x = ["" for i in range(l)]
for i in range(n):
    x[a*i] = s[i]
for j in range(m):
    if x[b*j] != "" and x[b*j] != t[j]:
        print(-1)
        exit()
print(l)

### FIXED CODE ###

import fractions
n, m = map(int, input().split())
s = input()
t = input()
l = fractions.gcd(n, m)
a, b = n//l, m//l
for i in range(l):
    if t[b*i] != s[a*i]:
        print(-1)
        exit()
print(a*b*l)
### BUGGY CODE ###


from heapq import *
from collections import defaultdict

def Dijkstra(s, V, E):
    # https://ja.wikipedia.org/wiki/%E3%83%80%E3%82%A4%E3%82%AF%E3%82%B9%E3%83%88%E3%83%A9%E6%B3%95
    d = defaultdict(lambda:10**30)
    d[s] = 0
    Q = []
    for v in V:
        heappush(Q, (d[v], v))
    while Q:
        x, u = heappop(Q)
        for v, y in E[u].items():
            alt = d[u] + y
            if d[v] > alt:
                d[v] = alt
                heappush(Q, (alt, v))
    return d

N, M, S, T = [int(_) for _ in input().split()]
UVAB = [[int(_) for _ in input().split()] for i in range(M)]

Ea = defaultdict(dict)
Eb = defaultdict(dict)

for u, v, a, b in UVAB:
    Ea[u][v] = a
    Ea[v][u] = a
    Eb[u][v] = b
    Eb[v][u] = b
    
V = list(range(1, N + 1))

Da = Dijkstra(S, V, Ea)
Db = Dijkstra(T, V, Eb)

T = [None] * (N + 1)
t = 10**30

for i in range(N, 0, -1):
    r = Da[i] + Db[i]
    t = min(t, r)
    T[i] = t

ST = 10**15

for i in range(1, N + 1):
    print(ST-T[i])


### FIXED CODE ###


from heapq import *
from collections import defaultdict

def Dijkstra(s, N, E):
    # https://ja.wikipedia.org/wiki/%E3%83%80%E3%82%A4%E3%82%AF%E3%82%B9%E3%83%88%E3%83%A9%E6%B3%95
    d = [10**30] * (N + 1)
    d[s] = 0
    Q = []
    for v in range(1, N + 1):
        heappush(Q, (d[v], v))
    while Q:
        x, u = heappop(Q)
        for v, y in E[u].items():
            alt = d[u] + y
            if d[v] > alt:
                d[v] = alt
                heappush(Q, (alt, v))
    return d

N, M, S, T = [int(_) for _ in input().split()]
UVAB = [[int(_) for _ in input().split()] for i in range(M)]

Ea = defaultdict(dict)
Eb = defaultdict(dict)

for u, v, a, b in UVAB:
    Ea[u][v] = a
    Ea[v][u] = a
    Eb[u][v] = b
    Eb[v][u] = b
    
Da = Dijkstra(S, N, Ea)
Db = Dijkstra(T, N, Eb)

T = [None] * (N + 1)
t = 10**30

for i in range(N, 0, -1):
    r = Da[i] + Db[i]
    t = min(t, r)
    T[i] = t

ST = 10**15

for i in range(1, N + 1):
    print(ST-T[i])
### BUGGY CODE ###

N, WM = map(int, input().split())
W = []
V = []
dp = [[0] * (WM + 1) for _ in range(N + 1)]

for _ in range(N):
    w, v = map(int, input().split())
    W.append(w)
    V.append(v)

for i in range(N):
    for w in range(WM + 1):
        if w - W[i] >= 0:
            dp[i + 1][w] = max(dp[i + 1][w], dp[i][w - W[i]] + V[i])
        dp[i + 1][w] = max(dp[i + 1][w], dp[i][w])

print(dp[N][WM])


### FIXED CODE ###

N, WM = map(int, input().split())
W = []
V = []
dp = [[0] * (WM + 1) for _ in range(N + 1)]

for _ in range(N):
    w, v = map(int, input().split())
    W.append(w)
    V.append(v)

for i in range(N):
    for w in range(WM + 1):
        if w - W[i] >= 0:
            dp[i + 1][w] = max(dp[i + 1][w], dp[i][w - W[i]] + V[i])
        dp[i + 1][w] = max(dp[i + 1][w], dp[i][w])

print(dp[N][WM])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

def solve(N, A, S):
    dp = set()
    dp.add(0)
    for i in reversed(range(N)):
        if S[i] == "0":
            st = set()
            for v in dp:
                st.add(v ^ A[i])
            dp |= st
        else:
            if not A[i] in dp:
                return 1
    return 0

def main():
    T = int(input())
    ans = [None]*T
    for i in range(T):
        N = int(input())
        A = list(map(int, input().split()))
        S = input()
        if S[-1] == "1":
            ans[i] = 1
        else:
            ans[i] = solve(N, A, S)
    for v in ans:
        print(v)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def solve(N, A, S):
    dp = []
    for i in reversed(range(N)):
        x = A[i]
        for v in dp:
            x = min(x, v^x)
        if x > 0:
            if S[i] == "0":
                dp.append(x)
            else:
                return 1
    return 0

def main():
    T = int(input())
    ans = [None]*T
    for i in range(T):
        N = int(input())
        A = list(map(int, input().split()))
        S = input()
        ans[i] = solve(N, A, S)
    for v in ans:
        print(v)

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

N = int(input())

S = input()

ans = 0

for i in range(N - 2):
    #S_i = S[i]
    for j in range(i + 1, N - 1):
        if S[j] != S[i]:
            #S_j = S[j]
            for k in range(j + 1, N):
                if j - i != k - j and S[k] != S[i] and S[k] != S[j]:
                    ans += 1
print(ans)

### FIXED CODE ###

def main():
    N = int(input())
    S = input()
    ans=S.count('R') * S.count('G') * S.count('B')
    for i in range(N):
        for d in range(N - 1):
            j = i + d
            k = j + d
            if k < N and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -= 1
    print(ans)
main()
### BUGGY CODE ###

# D - Knapsack Queries on a tree

import bisect

n = int(input())

v = [0] * n
w = [0] * n
for i in range(n):
    v[i], w[i] = map(int, input().split())

# dp table (for some amount)
dp = [None] * min(n, 2 ** 15)

# dp[vertex] = list of (weight, value)
dp[0] = [(0, 0), (w[0], v[0])]

for u in range(1, len(dp)):
    parent = (u - 1) // 2
    dp[u] = dp[parent].copy()
    for ww, vv in dp[parent]:
        dp[u].append((ww + w[u], vv + v[u]))
    dp[u].sort()

    # remove unnecessary entries
    tail = 0
    for i in range(1, len(dp[u])):
        if dp[u][tail][1] < dp[u][i][1]:
            tail += 1
            dp[u][tail] = dp[u][i]
    del dp[u][tail + 1:]

dpkeys = [[ww for ww, vv in dp[u]] for u in range(len(dp))]

def solve(u, l):
    if u < len(dp):
        x = bisect.bisect_right(dpkeys[u], l) - 1
        return dp[u][x][1]

    parent = (u - 1) // 2
    s = solve(parent, l) if u > 0 else 0
    if l >= w[u]:
        s = max(s, v[u] + (solve(parent, l - w[u]) if u > 0 else 0))
    return s

q = int(input())
for i in range(q):
    u, l = map(int, input().split())
    print(solve(u - 1, l))


### FIXED CODE ###

# D - Knapsack Queries on a tree

from sys import stdin
import bisect

readline = stdin.readline
bisect_right = bisect.bisect_right

n = int(readline())

v = [0] * n
w = [0] * n
for i in range(n):
    v[i], w[i] = map(int, readline().split())

max_l = 10 ** 5
vshift = 21
mask = (1 << vshift) - 1

# dp table (for some amount)
dp = [None] * min(n, 2 ** 12)

# dp[vertex] = list of (weight, value)
dp[0] = [(0 << vshift) + 0, (w[0] << vshift) + v[0]]

for u in range(1, len(dp)):
    parent = (u - 1) // 2

    ls = dp[parent][:]
    ls.extend(x + (w[u] << vshift) + v[u] for x in dp[parent]
              if (x >> vshift) + w[u] <= max_l)
    ls.sort()

    # remove unnecessary entries
    tail = 0
    for i in range(1, len(ls)):
        if (ls[tail] >> vshift) == (ls[i] >> vshift):
            ls[tail] = ls[i]
        elif (ls[tail] & mask) < (ls[i] & mask):
            tail += 1
            ls[tail] = ls[i]
    del ls[tail + 1:]
    dp[u] = ls

def solve(u, l):
    if u < len(dp):
        x = bisect_right(dp[u], (l << vshift) + mask) - 1
        return dp[u][x] & mask

    parent = (u - 1) // 2
    s = solve(parent, l)
    if l >= w[u]:
        s = max(s, v[u] + solve(parent, l - w[u]))
    return s

q = int(readline())
for i in range(q):
    u, l = map(int, readline().split())
    print(solve(u - 1, l))
### BUGGY CODE ###

import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import deque
from collections import defaultdict
def main():
    N, P = MI()
    S_ = S()
    mod_list = defaultdict(int)
    ans = 0
    if P == 2 or P == 5:
        for i in range(N):
            num = int(S_[i])
            if num % P == 0:
                ans += i + 1

    else:
        for i in range(N):
            num = S_[i:N]
            mod = int(num) % P
            if mod == 0:
                ans += 1
            mod_cnt = mod_list[mod]
            if mod_cnt >= 1:
                ans += mod_cnt
                mod_list[mod] += 1
                continue
            mod_list[mod] += 1

    print(ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import deque
from collections import defaultdict
def main():
    N, P = MI()
    S_ = S()
    mod_list = defaultdict(int)
    ans = 0
    if P == 2 or P == 5:
        for i in range(N):
            num = int(S_[i])
            if num % P == 0:
                ans += i + 1

    else:
        num = 0
        point = 1
        for i in S_[::-1]:
            num += int(i) * point
            mod = int(num) % P
            mod_list[mod] += 1
            point *= 10
            point %= P
    values_ = mod_list.values()
    ans += mod_list[0]
    for value in values_:
        ans += (value - 1) * value // 2

    print(ans)

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

import numpy as np

N = int(input())

def prime_factorize(n):
    answers = []
    while n % 2 == 0:
        answers.append(2)
        n //= 2
    f = 3
    while f**2 <= n:  # instead of f <= n**0.5
        if n % f == 0:
            answers.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        answers.append(n)
    return answers

factors = np.array(prime_factorize(N))
selectors = [np.array(list(map(bool, map(int, list("{0:b}".format(i).zfill(len(factors))))))) for i in range(2**len(factors))]
combinations = [(factors[selector].prod(), N//factors[selector].prod()) for selector in selectors]
distances = [combination[0]-1 + combination[1]-1 for combination in combinations]
print(min(distances))


### FIXED CODE ###

N = int(input())
minstep = 9999999999999999999999999999999
for i in range(1, int(N**0.5+1)):
  if N%i == 0:
    minstep = min(minstep, i+N//i-2)
print(minstep)
### BUGGY CODE ###

k = int(input())
a = []
if(k%2 == 0):
  print(-1)
else:
    while(1):
        a.append(7)
        b = ''.join(map(str,a))
        b = int(b)
        #print(b)
        if(b%k == 0):
            break
    print(len(a))


### FIXED CODE ###

k = int(input())
n = 7
c = 1
if(k%2 == 0):
  print(-1)
else:
  while(True):
    if(n%k == 0):
      break
    if(c > k):
      c = -1
      break
    r = n%k
    n = 10*r+7
    c += 1
  print(c)
### BUGGY CODE ###

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

ans = 0
for k in range(N):
    A[N-1-k][0] += ans
    while A[N-1-k][0]%A[N-1-k][1]!=0:
        A[N-1-k][0] += 1
        ans += 1

print(ans)

### FIXED CODE ###

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

ans = 0
for k in range(N):
    A[N-1-k][0] += ans
    if A[N-1-k][0]%A[N-1-k][1]!=0:
        d = A[N-1-k][1]*(1+A[N-1-k][0]//A[N-1-k][1])-A[N-1-k][0]
        ans += d
        A[N-1-k][0] += d

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

N=int(input())
P=list(map(int,input().split()))
count=0
for i in range(N):
    if P[i]==min(P[:i+1]):
        count+=1
print(count)


### FIXED CODE ###

N=int(input())
P=list(map(int,input().split()))
count=0
minimum=max(P)
for i in range(N):
    if P[i]<=minimum:
        count+=1
        minimum=P[i]
print(count)
### BUGGY CODE ###

import math
import copy

n = int(input())
l = list(map(int, input().split()))
d = {}
s_sum = {}
s = list(set(l))
for i in range(len(s)):
    d[s[i]] = l.count(s[i])
for i in range(len(l)):
    if l[i] in s_sum:
        print(s_sum[l[i]])
    else:
        ans = 0
        e = copy.deepcopy(d)
        e[l[i]] -= 1
        for v in e.values():
            if v > 1:
                ans += math.factorial(v) // math.factorial(v -
                                                           2) // math.factorial(2)
        s_sum[l[i]] = ans
        print(ans)

### FIXED CODE ###

import collections

def count_defaultdict(it):
    counter = collections.defaultdict(int)
    for x in it:
        counter[x] += 1
    return dict(counter)

_ = int(input())
l = list(map(int, input().split()))
all_sum = 0
count = count_defaultdict(l)
for _, v in count.items():
    all_sum += v * (v - 1) // 2
for i in range(len(l)):
    if count[l[i]] > 1:
        v = count[l[i]]
        print(all_sum - v * (v-1) // 2 + (v-1) * (v-2)//2)
    else:
        print(all_sum)
### BUGGY CODE ###

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

demands= []

for i in range(m):
    demands.append(list(map(int,input().split())))

demands.sort()

cut = []

for d in demands:
    flag = True
    for c in cut:
        if c[0] < d[1] and c[1] > d[0]:
            flag = False
            c[0] = max(c[0],d[0])
            c[1] = min(c[1],d[1])
            break
    if flag:
        cut.append(d)

print(len(cut))

### FIXED CODE ###

N,M=map(int,input().split())
d = [list(map(int,input().split())) for _ in range(M)]

d.sort(key=lambda x:x[1])
ans=0
c=0
for i in range(M):
    a,b=d[i]
    if a>=c:
        ans+=1
        c=b
print(ans)
### BUGGY CODE ###

n, m = map(int, input().split())
a, b = [], []
for i in range(m):
  _, __ = map(int, input().split())
  _ -= 1
  __ -= 1
  a.append(_)
  b.append(__)
  
# union-find

# 誰の肩に手を置いているか（先頭の場合は-1）
parent = [-1 for i in range(n)]

# 列車の深さ
depth = [0 for i in range(n)]

# kさんの「運転手」が誰かを調べる関数
def find_root(k):
  while parent[k] != -1:
    k = parent[k]
  return k 

for i in range(m):
  # a[i] と b[i] の合併
  root_a = find_root(a[i])
  root_b = find_root(b[i])
  if root_a == root_b: continue
  
  # # 浅い列車を持っている方が負けるようにする
  # if depth[root_a] > depth[root_b]:
  #   root_a, root_b = root_b, root_a
  parent[root_a] = root_b
  depth[root_b] = max(depth[root_a]+1, depth[root_b])
  
group = [find_root(i) for i in range(n)]

from collections import Counter
print(Counter(group).most_common()[0][1])


### FIXED CODE ###

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

# 隣接リストをつくる 
adj_list = [[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  adj_list[a].append(b)
  adj_list[b].append(a)
  
# どの連結成分に属してるかを把握するための配列
group = [-1 for i in range(n)]

# 各頂点 i から探索をする
for i in range(n):
  if group[i] != -1: continue
  # i から DFS
  newly_visited = [i]
  group[i] = i
  while len(newly_visited) > 0:
    now = newly_visited.pop()
    for j in adj_list[now]:
      if group[j] != -1: continue
      newly_visited.append(j)
      group[j] = i

hist = [0 for i in range(n)]
for g in group:
  hist[g] += 1
print(max(hist))
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 0
r_wa = list()
for i in range(n+1) :
  r_wa.append(sum(a[:i+1]))

for i in range(n-1) :
  ans += a[i]*(r_wa[n]-r_wa[i])
  ans = ans%1000000007
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 0
r_wa = [a[0]]
for i in range(n) :
  if i>0 :
    r_wa.append(r_wa[i-1]+a[i])

for i in range(n-1) :
  ans += a[i]*(r_wa[n-1]-r_wa[i])
  ans = ans%1000000007
print(ans)
### BUGGY CODE ###

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

### FIXED CODE ###

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

N, Q = map(int, input().split())
S = input()
L = []
R = []
# ans = []
for _ in range(Q):
	l, r = map(int, input().split())
	L.append(l)
	R.append(r)
flag = [0, 0]
for i in range(N-1):
	if S[i] == 'A' and S[i+1] == 'C':
		flag.append(1)
	else:
		flag.append(0)
# print(flag)
ans = [[0 for i in range(N+1)] for j in range(N+1)]
for i in range(N):
	for j in range(1,N+1):
		ans.append(0)
		
for i in range(N):
	for j in range(N):
		ans[i][j+1] = ans[i][j] + flag[j+1]
		ans[i+1][j] = ans[i][j] - flag[i+1]

for i in range(Q):
	print(ans[L[i]][R[i]])

# for i in range(Q):
# 	print(ans[i])

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
L = []
R = []
# ans = []
for _ in range(Q):
	l, r = map(int, input().split())
	L.append(l)
	R.append(r)
sum = [0] * (N+1)
for i in range(1, N):
	if S[i-1] == 'A' and S[i] == 'C':
		sum[i+1] = sum[i] + 1
	else:
		sum[i+1] = sum[i]
# print(sum)


for i in range(Q):
	print(sum[R[i]] - sum[L[i]])
### BUGGY CODE ###

import math
import bisect

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

for i in range(M):
    n = A.pop() / 2
    bisect.insort(A, n)

answer = 0
for j in range(N):
    answer += math.floor(A[j])

print(answer)

### FIXED CODE ###

from heapq import heapify, heappop, heappush

N, M = map(int, input().split())
A = list(map(int, input().split()))
A_minus = [-x for x in A]
heapify(A_minus)

for i in range(M):
    n = -heappop(A_minus) // 2
    heappush(A_minus, -n)

print(-sum(A_minus))
### BUGGY CODE ###

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

j=0
d=[]
d.append(X)
for i in range(X+1,Y+1):
    if i%d[j]==0:
        d.append(i)
        j+=1

print(len(d))

### FIXED CODE ###

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

i=1
A=[]
A.append(X)

while(1):
    T=A[i-1]*2
    if T<=Y:
        A.append(T)
    elif T>Y:
        break
    i+=1

print(len(A))
### BUGGY CODE ###

N, K = (int(x) for x in input().split())
Plot = [tuple(int(x) for x in input().split()) for _ in range(N)]
X = [p[0] for p in Plot]
Y = [p[1] for p in Plot]
#全2点間で長方形の辺を作り、その内内部点がK個のものだけ面積を比較する。
#2点p,qが頂点にある長方形は確かに最小の長方形を成す
#2点が頂点でない場合、内部点の個数が変わらないように適当な2点p,qを取って頂点とすることでより小さい長方形を形成できる
ans = 10e20
for x1 in X:
    for x2 in X:
        if x1 < x2:
            minx, maxx = x1, x2
        else:
            minx, maxx = x2, x1
        for y1 in Y:
            for y2 in Y:
                if y1 < y2:
                    miny, maxy = y1, y2
                else:
                    miny, maxy = y2, y1
                S = (maxx-minx)*(maxy-miny)
                cnt = 0
                for r in Plot:
                    if minx <= r[0] <= maxx and miny <= r[1] <= maxy:
                        cnt += 1
                if cnt == K and S != 0:
                    ans = min(ans, S)
print(ans)

### FIXED CODE ###

N, K = (int(x) for x in input().split())
Plot = [tuple(int(x) for x in input().split()) for _ in range(N)]
X = [p[0] for p in Plot]
Y = [p[1] for p in Plot]
X.sort()
Y.sort()
#全2点間で長方形の辺を作り、その内内部点がK個のものだけ面積を比較する。
ans = 10e20
from itertools import combinations
for x1, x2 in combinations(X, 2):
    for y1 in Y:
        y2 = [y for x,y in Plot if x1 <= x <= x2 and y1 <= y]
        if len(y2) < K:
            break
        y2.sort()
        S = (x2-x1)*(y2[K-1]-y1)
        ans = min(ans, S)
print(ans)
### BUGGY CODE ###

a, b, c, d = map(int, input().split())
res = []
for i in range(a, b+1):
  for j in range(c, d+1):
    res.append(i*j)
print(max(res))

### FIXED CODE ###

a, b, c, d = map(int, input().split())
 
if a>=0 and c>=0:
  print(b*d)
elif b<=0 and d<=0:
  print(a*c)
elif b<=0 and c>=0:
  print(b*c)
elif a>=0 and d<=0:
  print(a*d)
elif a<=0 and b>=0 and c<=0 and d>=0:
  print(max([a*c, b*d]))
elif b<=0 and c<=0 and d>=0:
  print(a*c)
elif a<=0 and b>=0 and d<=0:
  print(a*c)
elif a<=0 and b>=0 and c>=0:
  print(b*d)
elif a>=0 and c<=0 and d>=0:
  print(b*d)
### BUGGY CODE ###

N,K=list(map(int,input().split()))
p=list(map(int,input().split()))
counter=0
ans=0
for i in range(len(p)-K+1):
    count=0
    for j in range(K):
        count+=p[i+j]
    if counter<=count:
        counter=count
        ans=i
p2=[]
for i in range(K):
    p2.append(p[ans+i])
p3=[]
for i in p2:
    p3.append((sum(range(1,i+1))/i))
print(sum(p3))

### FIXED CODE ###

from itertools import accumulate
from collections import deque
N,K=list(map(int,input().split()))
p=list(map(int,input().split()))
p2=list(accumulate(p))
p2=deque(p2)
p2.appendleft(0)
p3=[]
ans=0
counter=0
ans2=0
for i in range(N-K+1):
    if counter<p2[i+K]-p2[i]:
        counter=p2[i+K]-p2[i]
        ans=i
for i in range(K):
    ans2+=sum(list(range(1,p[ans+i]+1)))/p[ans+i]
    
print(ans2)