Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10 ** 8)

N, W = map(int, input().split())
A = [[int(i) for i in input().split()] for i in range(N)]
memo = [[0] * (W + 1) for i in range(N + 1)]

def dfs(i, j):
    if memo[i][j] != 0:
        ans = memo[i][j]
    elif i == N:
        return 0
    elif A[i][0] > j:
        return dfs(i + 1, j)
    else:
        ans  = max(dfs(i + 1, j), A[i][1] + dfs(i + 1, j - A[i][0]))
        memo[i][j] = ans
    return ans
        
print(dfs(0, W))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 8)

N, W = map(int, input().split())
A = [[int(i) for i in input().split()] for i in range(N)]
memo = {i : {} for i in range(N)}

def dfs(i, j):
    if i == N:
        return 0
    elif j in memo[i]:
        return memo[i][j]
    elif A[i][0] > j:
        ans = dfs(i + 1, j)
    else:
        ans  = max(dfs(i + 1, j), A[i][1] + dfs(i + 1, j - A[i][0]))
    memo[i][j] = ans
    return ans
        
print(dfs(0, W))
int t = 30
if (t >= 30):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

t = int(input())
if (t >= 30):
  print('Yes')
else:
  print('No')
n = int(input())
x = [int(input()) for i in range(n)]
e = sum(x)//len(x)
k = 0
for i in range(len(x)):
    k = k + (x[i] - e)*(x[i] - e)
print(k)

### FIXED CODE ###

n = int(input())
x = [int(x) for x in input().split()]
e = round(sum(x)/len(x))
k = 0
for i in range(len(x)):
    k = k + (x[i] - e)*(x[i] - e)
print(k)
from bisect import bisect_right as br
import heapq
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(N)]

AB.sort()
A=[a for a,b in AB]
B=[b for a,b in AB]
works=[]
heapq.heapify(works)
ans=0
for i in range(1,M+1):
  day=M-i
  latest=i
  #worksにlatest日以内に報酬を貰える仕事を追加する
  if not A or A[0]>latest:
    pass
  else:
    for _ in range(br(A,latest)):
      A=A[1:]
      #index=br(works,B[0])
      #works=works[:index]+B[0]+works[index:]
      heapq.heappush(works,-B[0])
      B=B[1:]
  #if not works:
    #continue
  #ans+=works.pop(-1)
  ans-=heapq.heappop(works)

print(ans)


### FIXED CODE ###

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

AB.sort(reverse=True)
works=[]
heapq.heapify(works)
ans=0
for i in range(1,M+1):
  day=M-i
  latest=i
  while AB and AB[-1][0]<=latest:
    a,b=AB.pop()
    heapq.heappush(works,-b)
  if not works:
    continue
  ans-=heapq.heappop(works)

print(ans)
# AOJ ITP1_7_B

def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    while True:
        a = numinput()
        n = a[0]; x = a[1]
        if n == 0 and x == 0: break
        # 1からnまでの異なる3つの数の和がxになる数の組の個数。
        count = 0
        for i in range(1, (x // 3) + 1):
            for j in range(i + 1, (x // 3) + 1):
                if j < x - i - j: count++
        print(count)

if __name__ == "__main__":
    main()


### FIXED CODE ###

# AOJ ITP1_7_B

def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    while True:
        a = numinput()
        n = a[0]; x = a[1]
        if n == 0 and x == 0: break
        # 1からnまでの異なる3つの数の和がxになる数の組の個数。
        count = 0
        for i in range(1, (x // 3) + 1):
            for j in range(i + 1, n + 1):
                if j < x - i - j <= n:
                    count += 1
                    # print(str(i) + " " + str(j) + " " + str(x - i - j))
        print(count)

if __name__ == "__main__":
    main()
import numpy as np
A, B = map(int,input().split())

print(np.lcm(A,B))


### FIXED CODE ###

from fractions import gcd
a, b = map(int, input().split())

print(a*b//gcd(a,b))
import sys
n=int(input())
alphabet="abcdefghijklmnopqrstuvwxyz"
l=[]
a=1
sm=0
for i in range(15):
    a*=26
    sm+=a
    l.append(sm)

for i in range(len(l)):
    if n<=l[i]:
        cl=i
        break

if cl==0:
    print(alphabet[n-1])
    sys.exit()
ans=""
n-=l[cl-1]

for i in range(cl):
    num=n//(26**(cl-i))
    ans=ans+alphabet[num]
    n-=((26**(cl-i))*num)

ans=ans+alphabet[n-1]
print(ans)

### FIXED CODE ###

import sys
n=int(input())
alphabet="abcdefghijklmnopqrstuvwxyz"
l=[]
a=1
sm=0
for i in range(15):
    a*=26
    sm+=a
    l.append(sm)

for i in range(len(l)):
    if n<=l[i]:
        cl=i
        break

if cl==0:
    print(alphabet[n-1])
    sys.exit()
ans=""
n-=l[cl-1]

#最後の１文字以外を決める
for i in range(cl):
    num=(n-1)//(26**(cl-i))
    ans=ans+alphabet[num]
    n-=(26**(cl-i))*num

if n!=0:
    ans=ans+alphabet[n-1]
else:
    ans=ans+"z"
print(ans)
a = int(input())
b = int(input())
if a<10 and b<10:
  print(a*b)
  
else:
  print('-1')

### FIXED CODE ###

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

if a<10 and b<10:
  print(a*b)
  
else:
  print('-1')
n = int(input())
s = [int(input()) for i range(n)]
summ = sum(s)
ans = [0]*summ
for i in range(n):
  ans[i] -= a[i]
ans.sort(reverse = True)
for i in ans:
  if i % 10 != 0:
    print(i)
    break

### FIXED CODE ###

N = int(input())
s = [int(input()) for i in range(N)]
s_shadow = [i for i in s if i % 10 != 0]
ans = sum(s)

if ans % 10 == 0:
    if len(s_shadow) == 0:
        ans = 0
    
    else:
        s_can = sorted([ans-i for i in s_shadow])
        ans = s_can[-1]
print(ans)
import math

while True:
    n = input()
    score = list(map(float, input().split()))
    
    if n == "0":
        break
    else:
        m = sum(score)/len(score)
        for i in range(len(score)):
            score[i] = (score[i]-m)**2
    answer = math.sqrt(sum(score)/len(socre))
    print(answer)

### FIXED CODE ###

import math

while True:
    n = input()
    
    if n == "0":
        break
    else:
        score = list(map(float, input().split()))
        m = sum(score)/len(score)
        for i in range(len(score)):
            score[i] = (score[i]-m)**2
    answer = math.sqrt(sum(score)/len(score))
    print(answer)
num = list(map(int,input().split()))
list = []

for i in num:
    if(i == 0): list.append(num[i])
    else: 
        if(list[i-1] > num[i]):
            list.append = list[i]
            list[i-1] = num[i]


### FIXED CODE ###

num = list(map(int,input().split()))
num.sort()
print("%d %d %d" %(num[0],num[1],num[2]))
x, n = map(int, input().split())
if n==0:
  print(x)
else:
    l1 = list(map(int,input().split()))	
    l2 = list(range(1, 100))
    diff = set(l1) ^ set(l2)
    diff = list(diff)
    def sorting(numbers_array):
    return sorted(numbers_array, key=abs)

    sl = map(lambda a: a - x, diff)
    print(sorting(sl)[0])

### FIXED CODE ###

x, n = map(int, input().split())
if n==0:
  print(x)
else:
    l1 = list(map(int,input().split()))	
    l2 = list(range(-150, 200))
    diff = set(l1) ^ set(l2)
    diff = list(diff)
    def sorting(numbers_array):
      return sorted(numbers_array, key=abs)
    sl = map(lambda a: a - x, diff)
    print(sorting(sl)[0]+x)
# B - Five Dishes

n = []
for _ in range(5):
    n.append(int(input()))

mini = 10
for y, x in enumerate(n):
    rest = x % 10 
    if rest != 0:
        if rest < mini:
            mini = rest
            mini_num = y 
            
time = n.pop(mini_num)
for x in n:
    if x % 10 != 0:
        item = math.ceil(x/10)*10
        time += item
    else:
        item = x
        time += item
    
print(time)

### FIXED CODE ###

# B - Five Dishes

n = []
for _ in range(5):
    n.append(int(input()))

time = 0
mini = 10
for x in n:
    rest = x%10
    if rest != 0:
        mini = min(rest, mini)
    while x%10 != 0:
        x += 1
    time += x
print(time-10+mini)
N = int(input())
List = list(map(int, input().split()))
s_l = set(List)
if len(s_l) == 3:
  print("Three")
else:
  print("Four")

### FIXED CODE ###

N = int(input())
List = list(map(str, input().split()))
s_l = set(List)
if len(s_l) == 3:
  print("Three")
else:
  print("Four")
argv=sys.argv

x=[0]*2
for i in range(10):
	x[i]=(int)(argv[i+1])
    
MAX=x[0]+x[1]
MIN=x[0]-x[1]
MUL=x[0]*x[1]

print(max(MAX,MIN,MUL))

### FIXED CODE ###

x=input().split()

for i in range(2):
    x[i]=int(x[i])

y=[0]*3
y[0]=x[0]+x[1]
y[1]=x[0]-x[1]
y[2]=x[0]*x[1]
 
print(max(y))
n, m, k = map(int, input().split())

mod = 10**9+7
N = 10**5+50
fac = [1]*(N+1)
finv = [1]*(N+1)
for i in range(N):
    fac[i+1] = fac[i] * (i+1) % mod
finv[-1] = pow(fac[-1], mod-2, mod)
for i in reversed(range(N)):
    finv[i] = finv[i+1] * (i+1) % mod

def cmb1(n, r, mod):
    if r <0 or r > n:
        return 0
    r = min(r, n-r)
    return fac[n] * finv[r] * finv[n-r] % mod

ans = 0
for i in range(n*m):
    x, y = divmod(i, m)
    # x
    ans += x*m*cmb1(n*m-2, k-2, mod)*x
    ans -= (n-1-x)*m*cmb1(n*m-2, k-2, mod)*x
    # y
    ans += y*n*cmb1(n*m-2, k-2, mod)*y
    ans -= (m-1-y)*n*cmb1(n*m-2, k-2, mod)*y

ans %= mod
print(ans)

### FIXED CODE ###

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

mod = 10**9+7
N = 2*10**5+50
fac = [1]*(N+1)
finv = [1]*(N+1)
for i in range(N):
    fac[i+1] = fac[i] * (i+1) % mod
finv[-1] = pow(fac[-1], mod-2, mod)
for i in reversed(range(N)):
    finv[i] = finv[i+1] * (i+1) % mod

def cmb1(n, r, mod):
    if r <0 or r > n:
        return 0
    r = min(r, n-r)
    return fac[n] * finv[r] * finv[n-r] % mod

ans = 0
for i in range(n*m):
    x, y = divmod(i, m)
    # x
    ans += x*m*cmb1(n*m-2, k-2, mod)*x
    ans -= (n-1-x)*m*cmb1(n*m-2, k-2, mod)*x
    # y
    ans += y*n*cmb1(n*m-2, k-2, mod)*y
    ans -= (m-1-y)*n*cmb1(n*m-2, k-2, mod)*y

ans %= mod
print(ans)
N,M = map(int,input().split())
s = []
c = []
for i in range(M):
    s1,c1=[int(i) for i in input().split()]
    s.append(s1)
    c.append(c1)

ans = [10 for i in range(N)]
x = ''

for j in range(M):
  if ans[s[j]-1] == 10:
     ans[s[j]-1] = c[j]
  elif ans[s[j]-1] != 10 and  ans[s[j]-1] != c[j]:
    print('-1')
    exit()
  
for k in range(N):
  if ans[k] == 10:
    ans[k] = 0
if N == 1:
  for l in range(N):
    x += str(ans[l])
  print(x)
  exit()
else:
  if ans[0] == 0 :
  print('-1')
  else :
  for l in range(N):
    x += str(ans[l])
  print(x)
   
  

### FIXED CODE ###

N,M = map(int,input().split())
s = []
c = []
for i in range(M):
    s1,c1=[int(i) for i in input().split()]
    s.append(s1)
    c.append(c1)

ans = [10 for i in range(N)]
x = ''

for j in range(M):
  if ans[s[j]-1] == 10:
     ans[s[j]-1] = c[j]
  elif ans[s[j]-1] != 10 and  ans[s[j]-1] != c[j]:
    print('-1')
    exit()
  
for k in range(N):
  if k == 0 and ans[k] == 10 and N != 1:
    ans[k] = 1
  elif k == 0 and ans[k] == 10 and N == 1:
    ans[k] = 0
  elif ans[k] == 10:
     ans[k] = 0
if N == 1:
  print(ans[0])
  exit()
else:
  if ans[0] == 0 :
    print('-1')
  else :
    for l in range(N):
      x += str(ans[l])
    print(x)
n, m = map(int, input().split())
a = map(int, input().split())
ans = 0

for i in range(n):
  if a[i] >= sum(a)*(1/(4*m)):
    ans += 1
    
if ans >= m:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

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

for i in range(n):
  if a[i] >= sum(a)*(1/(4*m)):
    ans += 1
    
if ans >= m:
  print("Yes")
else:
  print("No")
K,N=int(map(int,input().split()))
A=list(map(int,input().split()))
m=K
for j in range(len(N)):
  m=min(m,min(K-abs(N[j]-N[j-1]),K-abs(N[j]-N[j+1])))
print(m)
              
                                              

### FIXED CODE ###

K,N=map(int,input().split())
A=list(map(int,input().split()))
m=K
for i in range(N):
  if i==0:
    m=min(m,A[N-1]-A[0])
  else:
    b=A[N-1]-A[i]+K-A[N-1]+A[i-1]
    m=min(m,b)
print(m)
dp = [1000000000] * N

### FIXED CODE ###

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

dp = [1000000000] * N
dp[0] = 0

for i in range(N - 1):
    for j in range(1, K + 1):
        if i + j < N:
            if dp[i + j] > abs(h[i + j] - h[i]) + dp[i]:
                dp[i + j] = abs(h[i + j] - h[i]) + dp[i]
        else:
            break

print(dp[N - 1])
n, q = map(int, input().split(' '))
     
inf = [[] for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split(' '))
    inf[a-1].append(b-1)
    inf[b-1].append(a-1)
point = [0 for _ in range(n)]
for i in range(q):
    p, x = map(int, input().split(' '))
    point[p-1] += x
visit = [0 for _ in range(n)]
def add(num):
    if len(inf[num]) == 1 and visit[num] == 1:
        return 0
    visit[num] = 1
    for k in inf[num]:
        if visit[k] == 0:
            point[k] += point[num]
            add(k)
    return 0
add(0)
print(' '.join(map(str, point)))

### FIXED CODE ###

def main():
    n, q = map(int, input().split(' '))
    import sys
    from collections import deque
    sys.setrecursionlimit(10**7)

    visit = [True for _ in range(n)]
    point = [0 for _ in range(n)]
    dic = [[] for _ in range(n)]
    for _ in range(n-1):
        a, b = map(int, input().split(' '))
        dic[a-1].append(b-1)
        dic[b-1].append(a-1)
    for _ in range(q):
        p, x = map(int, input().split(' '))
        point[p-1] += x
    next_visit = deque()
    next_visit.append(0)
    visit[0] = False
    counter = 1
    while counter < n:
        t = next_visit.pop()
        for s in dic[t]:
            if visit[s]:
                point[s] += point[t]
                visit[s] = False
                counter += 1
                next_visit.append(s)
    print(*point)
if __name__ == '__main__':
    main()
N = int(input())
A = list(map(int,input().split()))

DP = [0,0,0]
m = N//2*2
if N%2 == 0:
    for i in range(0,m,2):
        DP[0] += A[i]
        DP[1] += A[i+1]
        DP[1] = max(DP[0],DP[1])

    print(DP[1])

else:
    for i in range(0,m,2):
        DP[0] += A[i]
        DP[1] += A[i+1]
        DP[2] += A[i+2]

        DP[1] = max(DP[0],DP[1])
        DP[2] = max(DP[1],DP[2])

    print(DP[2])


### FIXED CODE ###

N = input()

if "7" in N:
    print('Yes')
else:
    print('No')
import numpy as np
N, M, X = map(int,input().split())
l = []
li = np.array([])
for i in range(N):
  l.append(list(map(int,input().split())))

li = np.array(l)

skill_sum = []
for j in range(2**N):
  sum = np.zeros([M+1])
  for k in range(N):
    if ((j >> k) & 1):
        sum += li[k] 
  skill_sum.append(list(sum))      
pricelist = []
for l in range(2**N):
  cnt = 0
  for m in range(M):
    if skill_sum[l][m+1] >= X:
      cnt += 1
  if cnt ==  M:
    pricelist.append(int(skill_sum[l][0]))
    
print(min(pricelist))

### FIXED CODE ###

import numpy as np
N, M, X = map(int,input().split())
l = []
li = np.array([])
for i in range(N):
  l.append(list(map(int,input().split())))

li = np.array(l)

skill_sum = []
for j in range(2**N):
  sum = np.zeros([M+1])
  for k in range(N):
    if ((j >> k) & 1):
        sum += li[k] 
  skill_sum.append(list(sum))      
pricelist = []
for l in range(2**N):
  cnt = 0
  for m in range(M):
    if skill_sum[l][m+1] >= X:
      cnt += 1
  if cnt ==  M:
    pricelist.append(int(skill_sum[l][0]))

if pricelist == []:
  print('-1')
else:
  print(min(pricelist))
N=int(input())
lamps=[]
for a in range(N):
    _=int(input())
    lamps.append(_)
lamps.insert(0,"aaa")

PressedButtons=[False]*N

a=1
count=0

while True:
    if PressedButtons[a]==False:
        PressedButtons[a]=True
        count+=1
        a=lamps[a]
        if a==2:
            print(count)
    elif PressedButtons[a]==True:
        print("-1")
        exit()
    else:
        print("-1")

### FIXED CODE ###

N=int(input())
lamps=[]
for a in range(N):
    _=int(input())
    lamps.append(_)
lamps.insert(0,"aaa")

PressedButtons=[False]*int(N+1)

a=1
count=0

if lamps.count(2)==0:
    print("-1")
    exit()

while PressedButtons[a]==False :
    PressedButtons[a]=True
    count+=1
    a=lamps[a]
    if a==2:
        print(count)
        exit()
print('-1')
import math
a,b=map(int,input().split())
print(math.gcd(a,b))

### FIXED CODE ###

a,b=map(int,input().split())
i=min(a,b)
j=max(a,b)
while not(i==0) and not(j==0):
  x=i
  i=j%i
  j=x
print(int(a*b/j))
a,b=map(int,input()split())
g=b
while a<b:
  g=g*a
  a+=1
print(g)

### FIXED CODE ###

def calculate(A):
  c=(int((A+1)/2))%2
  if A%2==0:
    c=c^A
  return c

A,B=map(int,input().split())
print(calculate(A-1)^calculate(B))
N,A = input().split()

if (N % 500) >= A:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = int(input())
A = int(input())

if N%500 <= A:
  print("Yes")
else:
  print("No")
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

X = n()

dp = [0] * (X+1)
dp[1] = 1
for i in range(2, X+1):
    if dp[i - dp[i-1]] < dp[i-1]:
        dp[i] = dp[i-1]
    else:
        dp[i] = dp[i-1]+1
print(dp[X])


### FIXED CODE ###

nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

X = n()

for x in range(1, X):
    if x * (x + 1) // 2 >= X:
        print(x)
        import sys
        sys.exit()

print(X)
# -*- coding: utf-8 -*-

'''
111
abcdbbdtyyuhgjhguytuhgjhguyrtyetrdhggjutftfuyfyyabcdbbdtyyuhgjhguytuhgjhguyrtyetrdhggjutftfuyfyyabcdbbdtyyuhgjh
6
2 3 6
1 5 z
2 1 50000
1 4 a
1 7 d
2 1 1000000
'''

'''
7
abcdbbd
6
2 3 6
1 5 z
2 1 1
1 4 a
1 7 d
2 1 7
'''

from helper import elapsed_time
from bisect import bisect_left, insort_left


N = int(input())
s = list(input())
Q = int(input())

# s = s * 5000
# print()
# print(len(s))

# a-zまでの26文字に対して、s文字列の各文字に該当するindexを格納しておく
d = {i: [] for i in range(26)}
for i, c in enumerate(s):
    d[ord(c) - ord("a")].append(i)
# print(d)


@elapsed_time
def convert(d: dict, s: list, q1: int, q2: str):
    if s[q1] == q2:
        return d, s

    didx_before = ord(s[q1]) - ord("a")
    didx_after = ord(q2) - ord("a")

    idx = bisect_left(d[didx_before], q1)
    d[didx_before].pop(idx)
    s[q1] = q2
    insort_left(d[didx_after], q1)

    # return s[:q1] + q2 + s[q1+1:]
    # s[q1] = q2
    return d, s


@elapsed_time
def calc(d: dict, q1: int, q2: int):
    ans = 0
    for i in range(26):
        idx = bisect_left(d[i], q1)
        if d[i] and q1 <= d[i][-1] and d[i][idx] < q2:
            ans += 1
    '''
    st = time.time()
    temp1 = s[q1:q2 + 1]
    print(f'>>- extract: {time.time()-st}')

    st = time.time()
    temp2 = set(temp1)
    print(f'>>- to set: {time.time()-st}')
    ans = len(list(temp2))
    '''

    return ans


for _ in range(Q):
    q, q1, q2 = input().split()
    q = int(q)
    if q == 1:
        d, s = convert(d, s, int(q1) - 1, q2)
    if q == 2:
        print(calc(d, int(q1) - 1, int(q2) - 1))


### FIXED CODE ###

# -*- coding: utf-8 -*-

'''
7
abcdbbd
6
2 3 6
1 5 z
2 1 1
1 4 a
1 7 d
2 1 7
'''

# from helper import elapsed_time
from bisect import bisect_left, insort_left


N = int(input())
s = list(input())
Q = int(input())

# a-zまでの26文字に対して、s文字列の各文字に該当するindexを格納しておく
d = {i: [] for i in range(26)}
for i, c in enumerate(s):
    d[ord(c) - ord("a")].append(i)


# @elapsed_time
def convert(d: dict, s: list, q1: int, q2: str):
    if s[q1] == q2:
        return d, s

    didx_before = ord(s[q1]) - ord("a")
    didx_after = ord(q2) - ord("a")

    idx = bisect_left(d[didx_before], q1)
    d[didx_before].pop(idx)
    s[q1] = q2
    insort_left(d[didx_after], q1)

    return d, s


# @elapsed_time
def calc(d: dict, q1: int, q2: int):
    ans = 0
    for i in range(26):
        idx = bisect_left(d[i], q1)
        if d[i] and q1 <= d[i][-1] and d[i][idx] < q2 + 1:
            ans += 1

    return ans


for _ in range(Q):
    q, q1, q2 = input().split()
    q = int(q)
    if q == 1:
        d, s = convert(d, s, int(q1) - 1, q2)
    if q == 2:
        print(calc(d, int(q1) - 1, int(q2) - 1))
def kaidan(n):
    if n >= 1:
        return n+kaidan(n- 1)
    else:
        return 0
    
    
n,k = map(int,input().split())
num_list = list(map(int , input().split()))
candidate = []
tmp = [0]
num = 0
for i in range(n):
    i += num
    
    if sum(tmp) < sum(num_list[i:i+k]):
        tmp = num_list[i:i+k]
    else:
        candidate.append(tmp)
        num += 2
        
    if i == n-k:
        candidate.append(tmp)
        break
        
ans = 0
for i in candidate:
    tmp = 0
    for j in i:
        tmp += kaidan(j)/j
    if tmp > ans:
        ans = tmp

### FIXED CODE ###

n,k = map(int,input().split())
num_list = list(map(int , input().split()))
candidate = 0
for i in range(n-k+1):
    if i == 0:
        for j in range(k):
            candidate += (num_list[j]+1)/2
        tmp = candidate
    else:
        tmp += -(num_list[i-1]+1)/2 + (num_list[i+k-1]+1)/2
        if tmp > candidate:
            candidate = tmp
        
print(candidate)
s=input()
a=s[:len(s)//2]
b=s[(len(s)//2)+1:]
if a==a.reverse() and b==b.reverse():
  print('Yes')
else:
  print('No')


### FIXED CODE ###

s=input()
ans='No'
if s==s[::-1]:
  t=s[:len(s)//2]
  if t==t[::-1]:
    u=s[len(s)//2+1:]
    if u==u[::-1]:
      ans='Yes'
print(ans)
from math import pi
r = int(input())
print("%.6f %.6f" % (pi*r** 2, 2*pi*r))


### FIXED CODE ###

from math import pi
r = float(input())
print("%.6f %.6f" % (pi*r** 2, 2*pi*r))
N,K = map(int, input().split())
P = list(map(int, input().split()))

for i in range(K):
    S += (P[i]+1)/2
ans = S
for i in range(N-K)
    S += (P[i+k]-P[i])/2
    ans = S if S>ans 

print(ans)

### FIXED CODE ###

N,K = map(int, input().split())
P = list(map(int, input().split()))
S=0
for i in range(K):
    S += (P[i]+1)/2.
ans = S
for i in range(N-K):
    S += (P[i+K]-P[i])/2.
    ans = S if S > ans else ans 

print(ans)
N , L= map(int,input().split())
lst = []
Str = ''
for i in range(N):
    lst.append(input())
for k in range(N):
    for M in range(M-1):
        if lst[M] > lst[M+1]:
            lst[M],lst[M+1]  ==lst[M+1] , lst[M]
for j in range(N):
    Str += lst[j]
print(Str)


### FIXED CODE ###

N,L=map(int, input().split())
S=[]
for i in range(N):
    S.append(input())
S.sort()
result=''
for j in range(N):
    result+=S[j]     
print(result)
S = input()

S.replace("dream",'')
S.replace("dreamer",'')
S.replace("erase",'')
S.replace("eraser",'')

if len(S)==0:
    YES
else:
    NO


### FIXED CODE ###

S = input()
S = S.replace('eraser', '')
S = S.replace('erase', '')
S = S.replace('dreamer', '')
S = S.replace('dream', '')
if len(S) == 0:
    print('YES')
else:
    print('NO')
l = list(map(int, input().split()))
s = 3
for i in range(3):
    for j in range(i + 1, 3):
        if l[i] == l[j]:
            s = s - 1
if l[0] = l[1] and l[1] = l[2]:
    s = s + 1
print(s)

### FIXED CODE ###

l = list(map(int, input().split()))
s = 3
for i in range(3):
    for j in range(i + 1, 3):
        if l[i] == l[j]:
            s = s - 1
if l[0] == l[1] and l[1] == l[2]:
    s = s + 1
print(s)
if ("".join(sorted(input())) == "abc):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

if ("".join(sorted(input())) == "abc"):
    print("Yes")
else:
    print("No")
n = int(input())
p=1

for i in range(1,n+1):
    p*=i

print(a%(10**9+7))

### FIXED CODE ###

#55a
n = int(input())
x = 800*n
y = (n//15)*200
print(x-y)
from collections import Counter
import fractions
N = int(input())
s=[0]*N
S = []
for i in range(N):
    s_sorted =''.join(map(str, sorted(str(input()))))
    S.append(s_sorted)
c = Counter(S)
dic = {k: v for k, v in c.items() if v != 1}
if dic == {}:
    print(0)
else:
    ans = 0
    for i in range(len(list(dic.values()))):
        ans = ans+math.factorial(list(dic.values())[i])/math.factorial(2)/math.factorial(list(dic.values())[i]-2)
    print(int(ans))

### FIXED CODE ###

n = int(input())
strings_list = [list(input()) for i in range(n)]
counter = 0
dict = {}
 
for strings in strings_list:
    strings = "".join(sorted(strings))
    if strings in dict.keys():
        counter += dict[strings]
        dict[strings] += 1
    else:
        dict[strings] = 1
print(counter)
import math
a,b,x=map(int,input().split())
if a*a*b/2>x:
  print(math.degrees(math.atan(a*a*b/2*x)))
else:
  print(math.degrees(math.atan(2-2*x/a*a*b))

### FIXED CODE ###

import math
a,b,x=map(int,input().split())
if (a*a*b)/2>x:
  print(math.degrees(math.atan(a*b*b/(2*x))))
else:
  print(math.degrees(math.atan(2*(a*a*b-x)/(a*a*a))))
import itertools
import collections
n=int(input())
l=[input() for i in range(n)]
ans=0
for k in itertools.combinations:
  c1=collections.Counter(k[0])
  c2=collections.Counter(k[1])
  if c1.most_common()==c2.most_common():
    ans+=1
print(ans)

### FIXED CODE ###

from collections import Counter
n=int(input())
l=[''.join(sorted(input())) for _ in range(n)]
ans=0
for i in Counter(l).values():
  ans+=i*(i-1)//2
print(ans)