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

#!/usr/bin/env python3
# -*- coding: utf-8 -*-*-

from sys import stdin


def main():
    X, Y, A, B, C = list(map(int, stdin.readline().split()))
    p = list(map(int, stdin.readline().split()))
    q = list(map(int, stdin.readline().split()))
    r = list(map(int, stdin.readline().split()))

    p.sort(reverse=True)
    q.sort(reverse=True)
    r.sort(reverse=True)

    oisisa = 0
    x, y, z = 0, 0, 0

    for i in range(0, X + Y):
        m_p = p[0] if len(p) > 0 else 0
        m_q = q[0] if len(q) > 0 else 0
        m_r = r[0] if len(r) > 0 else 0
        m = max( [m_p, m_q, m_r] )

        if m_p == m:
            # pから取る
            oisisa += p.pop(0)
            x += 1

        elif m_q == m:
            # qから取る
            oisisa += q.pop(0)
            y += 1
        else:
            # rから取る
            oisisa += r.pop(0)
            z += 1

        if x >= X:
            p = []
        if y >= Y:
            q = []

        if x + y + z == X + Y:
            print(oisisa)
            return


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-*-

from sys import stdin


def main():
    X, Y, A, B, C = list(map(int, stdin.readline().split()))
    p = list(map(int, stdin.readline().split()))
    q = list(map(int, stdin.readline().split()))
    r = list(map(int, stdin.readline().split()))

    p.sort(reverse=True)
    q.sort(reverse=True)
    r.sort(reverse=True)

    oisii = []
    oisii.extend(p[0:X])
    oisii.extend(q[0:Y])
    oisii.extend(r)
    oisii.sort(reverse=True)
    print( sum( oisii[0:X+Y]) )


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

import math
L,R=map(int,input().split())
x=[]

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

print(min(x))


### FIXED CODE ###

L,R=map(int,input().split())
if R-L>=673:
    print(0)
else:
    x=[]

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

    print(min(x))
### BUGGY CODE ###

h, w= map(int, input().split())
A = [list(map(int, input().split())) for _ in range(h)]
B = [list(map(int, input().split())) for _ in range(h)]

C = [[0]*w for _ in range(h)]
for i in range(h):
    for j in range(w):
        C[i][j] = abs(A[i][j]-B[i][j])

D = 80*80
dp = [[[0]*D for i in range(w)] for j in range(h)]
dp[0][0][C[0][0]] = 1
for i in range(h):
    for j in range(w):
        if i+1< h:
            for k in range(D):
                if dp[i][j][k] != 0:
                    if k+C[i+1][j] < D:
                        dp[i+1][j][k+C[i+1][j]] = 1
                    dp[i+1][j][abs(k-C[i+1][j])] = 1
        if j+1<w:
            for k in range(D):
                if dp[i][j][k] != 0:
                    if k+C[i][j+1] < D:
                        dp[i][j+1][k+C[i][j+1]] = 1
                    dp[i][j+1][abs(k-C[i][j+1])] = 1

for i in range(D):
    if dp[-1][-1][i] != 0:
        print(i)
        exit()

### FIXED CODE ###

import numpy as np

h, w = map(int, input().split())
A = [0]*h
B = [0]*h
for _ in range(h):
  A[_] = list(map(int, input().split()))
  
for _ in range(h):
  B[_] = list(map(int, input().split()))

C = [[0]*w for _ in range(h)]
for i in range(h):
  for j in range(w):
    C[i][j] = abs(A[i][j]-B[i][j])
    
dp = [[0]*w for _ in range(h)]
D = 80 * (h + w)
L = 2*D + 1
dp[0][0] = np.zeros(L, np.bool)
dp[0][0][D+C[0][0]] = 1
for i in range(h):
  for j in range(w):
    if i == 0 and j == 0:
      continue
    x = np.zeros(L, np.bool)
    if i != 0:
      x[C[i][j]:] |= dp[i-1][j][:L-C[i][j]]
      x[:L-C[i][j]] |= dp[i-1][j][C[i][j]:]
    if j != 0:
      x[C[i][j]:] |= dp[i][j-1][:L-C[i][j]]
      x[:L-C[i][j]] |= dp[i][j-1][C[i][j]:]
    dp[i][j] = x
    
temp = np.where(dp[-1][-1]>0)[0]-D
temp = np.abs(temp)
print(np.min(temp))
### BUGGY CODE ###

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

for i in range(0, n-1):
    for j in range(i+1, n):
        total += a[i] * a[j]
    
print(total % (10 ** 9 + 7))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
inner_sum, total = 0, 0
for i in range(N):
    inner_sum += A[i]

for i in range(N-1):
    inner_sum -= A[i]
    total += A[i] * inner_sum
    
print(total % (10 ** 9 + 7))
### BUGGY CODE ###

N, Q = map(int, input().split())
S = input()

for i in range(Q):
  c = 0
  l, r = map(int, input().split())
  li = S[l-1:r]
  for j, s in enumerate(li[:-1]):
    if li[j] == 'A' and li[j+1] == 'C':
      c += 1
  
  print(c)

### FIXED CODE ###

#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = int(input())
n, q  = map(int, input().split())
s  = input()
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

nac = []
c = 0
for i, s_ in enumerate(s):
    if s[i] == 'C':
        if s[i-1] == 'A':
            c += 1

    nac.append(c)

#print(nac)

for _ in range(q):
    l, r = map(int, input().split())
    print(nac[r-1] - nac[l-1])
### BUGGY CODE ###

def maximum_profit(rs):
    ans = rs[1] - rs[0]
    for i in range(n):
        for j in range(i + 1, n):
            if ans < rs[j] - rs[i]:
                ans = rs[j] - rs[i]
    return ans


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

print(maximum_profit(rs))


### FIXED CODE ###

n = int(input())
r0 = int(input())
r1 = int(input())
min_r = min(r0, r1)
ans = r1 - r0
for _ in range(2, n):
    r = int(input())
    ans = max(ans, r - min_r)
    min_r = min(r, min_r)
print(ans)
### BUGGY CODE ###

def main():
    mod = 10 ** 9 + 7

    K = list(map(int, list(input())))
    D = int(input())

    s = 0
    dp = [0] * D
    for k in K:
        T = [0] * D
        for i, dpi in enumerate(dp):
            for x in range(10):
                T[(i + x) % D] += dpi
                T[(i + x) % D] % mod
        for x in range(k):
            T[(s + x) % D] += 1

        s = (s + k) % D
        dp = T

    print((dp[0] + (-1 if s != 0 else 0)) % mod)

main()

### FIXED CODE ###

mod = 10 ** 9 + 7

K = input()
D = int(input())

s = 0
dp = [0] * D
for k in K:
    k = int(k)

    T = [0] * D
    for i, dpi in enumerate(dp):
        for x in range(10):
            T[(i + x) % D] = (T[(i + x) % D] + dpi) % mod
    for x in range(k):
        T[(s + x) % D] += 1

    s = (s + k) % D
    dp = T

print((dp[0] + (-1 if s != 0 else 0)) % mod)
### BUGGY CODE ###

from collections import Counter
n = int(input())
D = list(map(int,input().split()))
m = int(input())
T = list(map(int,input().split()))
cntd = Counter(D)
cntt = Counter(T)
ok = True
for t in T:
    if t not in D:
        ok = False
    elif cntt[t] > cntd[t]:
        ok = False
if ok:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

from collections import Counter
n = int(input())
D = list(map(int,input().split()))
m = int(input())
T = list(map(int,input().split()))
sd = set(D)
st = set(T)
cntd = Counter(D)
cntt = Counter(T)
ok = True
for t in T:
    if t not in sd:
        ok = False
    elif cntt[t] > cntd[t]:
        ok = False
if ok:
    print('YES')
else:
    print('NO')
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import itertools
N, K = map(int, input().split())
A = list(map(int, input().split()))
lst = [i[0]*i[1] for i in itertools.combinations(A,2)]
lst.sort()
print(lst[K - 1])

### FIXED CODE ###

import numpy as np

N, K = map(int, input().split())
A = np.array([int(i) for i in input().split()])
A.sort()

A_max = max(np.abs(A))
A_minus = A[A<0]
A_zero = A[A==0]
A_plus = A[A>0]

def check(x):
    ret = 0
    if x >= 0:
        ret += N * len(A_zero)
    ret += np.searchsorted(A, x // A_plus, side='right').sum()
    ret += (N - np.searchsorted(A, -(x // -A_minus))).sum()
    ret -= np.count_nonzero(A * A <= x)
    return ret // 2

right = A_max * A_max
left = -right - 1
while (right - left > 1):
    middle = (right + left) >> 1
    if check(middle) < K:
        left = middle
    else:
        right = middle
print(right)
### BUGGY CODE ###

n,m = map(int,input().split())
a = list(map(int,input().split()))
for i in range(m):
  a.sort(reverse=True)
  a[a.index(max(a))]//=2
print(sum(a))

### FIXED CODE ###

from heapq import *
n,m = map(int,input().split())
a = list(map(lambda x:-int(x),input().split()))
heapify(a)
for i in range(m):
  heappush(a,-(-heappop(a)//2))
print(-sum(a))
### BUGGY CODE ###

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

groups = [-1 for i in range(N + 1)] #0番目は使わない
sizes = [1 for _ in range(N + 1)]
Ai.reverse()

value = N * (N - 1) // 2
answers = []
answers.append(value)

def parent(n):
    if groups[n] < 0:
        return n
    return parent(groups[n])

for a in Ai:
    p1 = parent(a[0])
    p2 = parent(a[1])

    if p1 != p2:
        if p1 > p2:
            t = p1
            p1 = p2
            p2 = t
        value -= sizes[p1] * sizes[p2]
        if value < 0:
            value = 0
        sizes[p1] += sizes[p2]
        groups[p2] = p1
    answers.insert(0, value)
answers = answers[1:]
for a in answers:
    print(a)

### FIXED CODE ###

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

for i in range(0, m):
    a, b = map(int, input().split())
    bridge.append([a - 1, b - 1])

bridge = bridge[1:]
bridge = reversed(bridge)
result = []


parent = [-1] * n
size = [1] * n
def root(v):
    p = parent[v]
    if p >= 0:
        return root(p)
    return v

value = n * (n - 1) // 2
result.append(value)

for b in bridge:
    if value <= 0:
        result.append(0)
        continue
    p0 = root(b[0])
    p1 = root(b[1])
    if p0 == p1:
        result.append(value)
        continue
    s0 = size[p0]
    s1 = size[p1]
    if p0 < p1:
        parent[p1] = p0
        size[p0] += size[p1]
    else:
        parent[p0] = p1
        size[p1] += size[p0]
    value -= s0 * s1
    result.append(max(value, 0))

result = reversed(result)
for r in result:
    print(r)
### BUGGY CODE ###

N = int(input())
S = input()

rlist, glist, blist = [], [], []
for i in range(N):
    if S[i] == "R":
        rlist.append(i)
    elif S[i] == "G":
        glist.append(i)
    else:
        blist.append(i)

rnumber = len(rlist)
gnumber = len(glist)
bnumber = N - rnumber - gnumber
total = rnumber * gnumber * bnumber

overcount = 0
for r in rlist:
    for g in glist:
        if (2*r-g) in blist: 
            overcount +=1
        if (2*g-r) in blist:
            overcount +=1
        if (r+g)/2 in blist:
            overcount +=1            
print(total - overcount)

### FIXED CODE ###

N = int(input())
S = input()

x = S.count("R")
y = S.count("G")

total = x*y*(N-x-y)

count = 0
for i in range(N):
    texta = S[i]
    for j in range(i,int((N-1+i)/2)+1):
        if S[j] != texta:
            textb = S[j]
            if S[2*j-i] != texta and S[2*j-i] !=textb:
                count += 1

print(total - count)
### BUGGY CODE ###

import sys
import numpy as np
def main():
    input = sys.stdin.readline
    def gen_pattern(x):
        if x < K-1:
            return [[0, x+1], [x+K+1, 2*K]]
        else:
            return [[x-K+1, x+1]]
    def inputs():
        return [int(x) for x in input().split()]
    def inputstr():
        return list(input().split())
    N,K = inputs()
    BB = np.zeros((2*K+1,2*K+1))
    for i in range(N):
        x,y,c = inputstr()
        if c=="W":
            y = int(y)+K
        x = int(x)%(2*K)
        y = int(y)%(2*K)
        #BB[x,y] += 1
        for shift in [0,K]:
            for b,t in gen_pattern((y+shift)%(2*K)):
                for l,r in gen_pattern((x+shift)%(2*K)):
                    BB[b,l] +=1
                    BB[b,r] -=1
                    BB[t,l] -=1
                    BB[t,r] +=1
    ans = (np.max(np.cumsum(np.cumsum(BB, axis=1), axis=0)))
    #print(BB)
    print(int(ans))
main()

### FIXED CODE ###

import sys
import numpy as np
def main():
    input = sys.stdin.readline
    def gen_pattern(x):
        if x < K-1:
            return [[0, x+1], [x+K+1, 2*K]]
        else:
            return [[x-K+1, x+1]]
    def inputs():
        return [int(x) for x in input().split()]
    def inputstr():
        return list(input().split())
    N,K = inputs()
    BB = [[0]*(2*K+1) for _ in range(2*K+1)]
    for i in range(N):
        x,y,c = inputstr()
        if c=="W":
            y = int(y)+K
        x = int(x)%(2*K)
        y = int(y)%(2*K)
        #BB[x,y] += 1
        for shift in [0,K]:
            for b,t in gen_pattern((y+shift)%(2*K)):
                for l,r in gen_pattern((x+shift)%(2*K)):
                    BB[b][l] +=1
                    BB[b][r] -=1
                    BB[t][l] -=1
                    BB[t][r] +=1
    ans = (np.max(np.cumsum(np.cumsum(BB, axis=1), axis=0)))
    #print(BB)
    print(int(ans))
main()
### BUGGY CODE ###

N = int(input())
fact = 1
mod = 10**9 + 7

for i in range(1,N+1):
    fact *= i

s = 0
R = fact
I = fact

tmp = 1
cnt = 1
ans = 1
while s==0:
    for i in range(2,R+1):

        if I%i==0:
            I=I//i
            if I==1:
                s=1
#            soinsu.append(i)
            if i == tmp:
                cnt += 1
            else:
                ans *= (cnt + 1)
                ans %= mod
                cnt  = 1
                tmp = i
            break

#dic = collections.Counter(soinsu)
# ans = 1
# for v in dic.values():
#     ans *= v + 1
#     ans %= mod


print(ans)


### FIXED CODE ###

N = int(input())
fact = 1
mod = 10**9 + 7

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

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]


for i in range(1,N+1):
    fact *= i

s = 0
R = primes(N)
#print(R)
I = fact

soinsu = []
tmp = 1
cnt = 1
ans = 1
while s==0:
    for i in R:

        if I%i==0:
            I=I//i
            if I==1:
                s=1
#            soinsu.append(i)
            if i == tmp:
                cnt += 1
            else:
                ans *= (cnt + 1)
                ans %= mod
                cnt  = 1
                tmp = i
            break

#dic = collections.Counter(soinsu)
# ans = 1
# for v in dic.values():
#     ans *= v + 1
#     ans %= mod


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

import sys
sys.setrecursionlimit(10**6)

INF = 10**11


def main(input, print):
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    at = [0] * (n+1)
    bt = [0] * (m+1)
    for i in range(1, n+1):
        at[i] = at[i-1]+a[i-1]
    for i in range(1, m+1):
        bt[i] = bt[i-1]+b[i-1]

    ans = 0
    for i in range(n+1):
        if at[i] > k:
            break
        for j in reversed(range(m+1)):
            if k >= at[i] + bt[j]:
                break
        ans = max(ans, i+j)

    print(ans)


if __name__ == '__main__':
    main(sys.stdin.readline, print)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

INF = 10**11


def main(input, print):
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    at = [0] * (n+1)
    bt = [0] * (m+1)
    for i in range(1, n+1):
        at[i] = at[i-1]+a[i-1]
    for i in range(1, m+1):
        bt[i] = bt[i-1]+b[i-1]

    ans = 0
    j = m
    for i in range(n+1):
        if at[i] > k:
            break
        while k < at[i] + bt[j]:
            j -= 1
        ans = max(ans, i+j)

    print(ans)


if __name__ == '__main__':
    main(sys.stdin.readline, print)
### BUGGY CODE ###

# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

#n,k,*a = map(int,read().split())
n, = map(int,readline().split())
vw = [[0,0]]+[list(map(int,readline().split())) for _ in range(n)]

#print(vw)
A = 11
N = min(1<<A,n+1)

memo = [[0] for _ in range(N)]
L = 10**5+1
memo[0] = [0]*L

from itertools import accumulate

for i in range(1,N):
    m = memo[i>>1][:]
    v,w = vw[i]    
    for j in range(L-1,w-1,-1):
        if m[j] < m[j-w]+v:
            m[j] = m[j-w]+v
    memo[i] = list(accumulate(m,max))


q, = map(int,readline().split())
for _ in range(q):
    u,l = map(int,readline().split())

    dic = [(0,0)]
    while u >= N:
        dic += [(vw[u][1]+w1,vw[u][0]+v1) for w1,v1 in dic]
        u >>= 1
    
    ans = 0
    for w,v in dic:
        if w <= l:
            ans = max(ans,memo[u][l-w]+v)
    print(ans)

        


### FIXED CODE ###

# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

#n,k,*a = map(int,read().split())

n, = map(int,readline().split())
vw = [[0,0]]+[list(map(int,readline().split())) for _ in range(n)]

def merge(av,aw,bv,bw):
    la,lb = len(aw),len(bw)
    rv = [0]*(la+lb)
    rw = [0]*(la+lb)
    ia = ib = 0
    for i in range(la+lb):
        if ib==lb or (ia < la and aw[ia] < bw[ib]):
            rv[i] = av[ia]
            rw[i] = aw[ia]
            ia += 1
        else:
            rv[i] = bv[ib]
            rw[i] = bw[ib]
            ib += 1
    return rv,rw

A = 10
N = min(1<<A,n+1)
memov = [[] for _ in range(N)]
memow = [[] for _ in range(N)]

memov[0] = [0]
memow[0] = [0]

#from itertools import acumulate
for i in range(1,N):
    v,w = vw[i]
    m2v = [v+v1 for v1 in memov[i>>1]]
    m2w = [w+w1 for w1 in memow[i>>1]]
    memov[i],memow[i] = merge(memov[i>>1],memow[i>>1],m2v,m2w)

    #memov[i] = list(accumulate(memov[i],max))
    for j in range(1,len(memov[i])):
        memov[i][j] = max(memov[i][j-1],memov[i][j])
    
def solve(lstv,lstw,dv,dw,l):
    ans = 0
    idx = len(lstw)-1
    #print(lstv,lstw,dv,dw,l)
    for v,w in zip(dv,dw):
        while idx >= 0 and lstw[idx] + w > l:
            idx -= 1
        if idx >= 0 and v+lstv[idx] > ans:
            ans = v+lstv[idx]
    print(ans)        
 
 

q, = map(int,readline().split())
for _ in range(q):
    u,l = map(int,readline().split())

    dv = [0]
    dw = [0]
    while u >= N:
        v,w = vw[u]
        m2v = [v+v1 for v1 in dv]
        m2w = [w+w1 for w1 in dw]
        dv,dw = merge(dv,dw,m2v,m2w)
        u >>= 1
    
    #for j in range(1,len(dv)):
    #    dv[j] = max(dv[j-1],dv[j])
    
    solve(memov[u],memow[u],dv,dw,l)

#print(memov)
#print(memow)
### BUGGY CODE ###

N = int(input())
S = input()

s = []
for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            c = S[i] + S[j] + S[k]
            if c in s:
                continue
            else:
                s.append(c)

print(len(s))


### FIXED CODE ###

N = int(input())
S = input()

ans = 0
l1 = []
for i in range(N):
    l2 = []
    if S[i] in l1:
        continue
    else:
        l1.append(S[i])
    for j in range(i + 1, N):
        if S[j] in l2:
            continue
        else:
            l2.append(S[j])
        s = S[j + 1:]
        ans += len(set(s))

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

from collections import Counter
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


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

ans = float('inf')
sports_cand = set([v for v in range(M)])


def rec(sports_cand, ans):
    if not sports_cand:
        return ans
    else:
        attend_i = [0]*N  # iの参加したいポイント
        attend_sports = [-1]*N  # iの参加するスポーツ
        for s in sports_cand:
            for p in range(N):
                if attend_i[p] < mat[p][s]:  # 今までに見たスポーツよりも参加したい
                    attend_i[p] = mat[p][s]
                    attend_sports[p] = s
        C = Counter(attend_sports)
        num = 0
        for id, tmp_val in C.most_common():
            if tmp_val >= num and id == -1:
                num = tmp_val
            elif tmp_val >= num:
                num = tmp_val
                ans = min(ans, tmp_val)
                ans = min(ans, rec(sports_cand, ans))
                sports_cand.remove(sports_cand - {id})
            else:
                break
    return ans


print(rec(sports_cand, ans))


### FIXED CODE ###

from collections import Counter
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


N, M = map(int, input().split())
mat = [list(map(lambda x:int(x)-1, input().split())) for _ in range(N)]

ans = N
Q = [set([v for v in range(M)])]
while Q:
    C = Counter()
    sports_cand = Q.pop(0)
    for n in range(N):
        for m in range(M):
            if mat[n][m] in sports_cand:
                C[mat[n][m]] += 1
                break
    tmp = 0
    for key, val in C.most_common():
        if val > tmp:
            tmp = val
            ans = min(ans, val)
            if len(sports_cand) > 2:
                Q.append(sports_cand-{key})
        else:
            break
print(ans)
### BUGGY CODE ###

S, T = input(), input()

def lcs(S, T):
  LS = len(S)
  LT = len(T)
 
  dps=[["" for _ in range(LT + 1)] for _j in range(LS + 1)]
  dpl=[[0 for _ in range(LT + 1)] for _j in range(LS + 1)]
  # dp[Sのi番目][Tのj番目] := それまでの最大長
 
  for i in range(LS):
    for j in range(LT):
      if S[i] == T[j]:
        dpl[i + 1][j + 1] += dpl[i][j] + 1
        dps[i + 1][j + 1] += dps[i][j] + S[i]
      else:
        if dpl[i + 1][j] >= dpl[i][j + 1]:
          dpl[i + 1][j + 1] = dpl[i + 1][j]
          dps[i + 1][j + 1] = dps[i + 1][j]
        else:
          dpl[i + 1][j + 1] = dpl[i][j + 1]
          dps[i + 1][j + 1] = dps[i][j + 1]
  return dps[-1][-1]

print(lcs(S, T))

### FIXED CODE ###

S = input()
T = input()
 
lenS = len(S)
lenT = len(T)
 
lcs = [[0 for i in range(lenT + 1)] for j in range(lenS + 1)]
 
for i in range(lenS):
  for j in range(lenT):
    if S[i] == T[j]:
      lcs[i + 1][j + 1] = lcs[i][j] + 1
    else:
      lcs[i + 1][j + 1] = max(lcs[i + 1][j], lcs[i][j + 1])
#for i in range(lenS + 1):
#  print(lcs[i])

i, j = lenS, lenT
answer = ""
while i != 0 and j != 0:
  if lcs[i - 1][j] == lcs[i][j] - 1:
    if lcs[i][j - 1] == lcs[i][j] - 1:
      answer += S[i - 1]
      i -= 1
    j -= 1
  else:
    i -= 1
  #print(i, j, lcs[i][j], answer)
print(answer[::-1])
### BUGGY CODE ###

import sys,math
#DEBUG=True
DEBUG=False
if DEBUG:
    f=open("202007_2nd/C_input.txt")
else:
    f=sys.stdin
# Find the number of triples of integers (x,y,z) such that
# (x+y)**2 + (y+z)**2 + (x+z)**2 = 2*N
N=int(f.readline().strip())
for _ in range(N):
    A=(_+1)*2
    I=int(math.sqrt(A/3))
    cnt=0
    for __ in range(I):
        for ___ in range(I):
            for ____ in range(I):
                if ((__+___+2)**2)+((___+____+2)**2)+((__+____+2)**2)==A:
                    cnt+=1
    print(cnt)

### FIXED CODE ###

import sys,math
#DEBUG=True
DEBUG=False
if DEBUG:
    f=open("202007_2nd/C_input.txt")
else:
    f=sys.stdin
# Find the number of triples of integers (x,y,z) such that
# (x+y)**2 + (y+z)**2 + (x+z)**2 = 2*N
N=int(f.readline().strip())
ans=[0 for _ in range(N)]
I=int(math.sqrt(N))
for __ in range(I):
    A2=N-((__+1)**2)
    if A2<=0:
        break
    I2=int(math.sqrt(A2))
    for ___ in range(I2):
        A3=A2-((___+1)**2)
        if A3<=0:
            break
        I3=int(math.sqrt(A3))
        for ____ in range(I3):
            tmp=((__+___+2)**2)+((___+____+2)**2)+((__+____+2)**2)
            if tmp<=2*N:
                ans[int(tmp/2)-1]+=1
            else:
                break
for _ in range(N):
    print(ans[_])
f.close()
### BUGGY CODE ###

import numpy as np
N,K = map(int,input().split())
p = list(map(int,input().split()))

m = p[0:K]
for i in range(1,N-K+1):
    if sum(m) < sum(p[i:K+i]):
        m = p[i:K+i]
e = np.array(m)
a = (1+e)/2
n = sum(a) 
print(n)

### FIXED CODE ###

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

s = 0
for i in range(0,K):
    s = s + p[i]
t = s
for j in range(0,N-K):
    u = s + p[j+K] - p[j]
    if u > t:
        t = u
    s = u
print((t+K)/2)