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

n=int(input())
lis=list(int(input()) for _ in range(n))
for i in range(n):
    ans=max(max(lis[:i],lis[i+1:n]))
    print(ans)

### FIXED CODE ###

n=int(input())
lis=list(int(input()) for _ in range(n))
lis2=lis
lis2=sorted(lis2)
MAX=lis2[-1]
second=lis2[-2]
if lis.count(MAX) ==1:
    lis3=[MAX for _ in range(n)]
    lis3[lis.index(MAX)]=second
    for i in range(n):
        print(lis3[i])
        
else:
    for _ in range(n):
        print(MAX)
### BUGGY CODE ###

import numpy as np

n,k,q = map(int,input().split())
d = [int(input()) for i in range(q)]
 
p=np.full(n,k)
z=np.full(n,-1)
 
for a in range(0,q):
  p=p+z
  p[d[a]-1]+=1
 
for l in range(0,n):
  if p[l]>0:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

import numpy as np

n,k,q = map(int,input().split())
d = [int(input()) for i in range(q)]
 
p=np.full(n,k)
z=np.full(n,-1*q)

p=p+z

for a in range(0,q):
  p[d[a]-1]+=1
 
for l in range(0,n):
  if p[l]>0:
    print('Yes')
  else:
    print('No')
### BUGGY CODE ###

s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t*=10
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())



### FIXED CODE ###

s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t=t*10%2019
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())
### BUGGY CODE ###

k = int(input())
a, b = [int(i) for i in input().split()]

kk = k

while(k <= 1000):
    kk = kk + k
    if(kk <= b and kk >= a):
        print("OK")
        exit()
    #print(kk)

    #j = j + 1

print("NG")


### FIXED CODE ###

k = int(input())
a, b = [int(i) for i in input().split()]

kk = a // k
kk = k*kk

while(kk <= 1000):
    if(kk <= b and kk >= a):
        print("OK")
        exit()
    #print(kk)
    kk = kk + k
    #j = j + 1

print("NG")
### BUGGY CODE ###

import numpy as np
n, K = map(int, input().split())
a = np.array(list(map(int, input().split())))
f = np.array(list(map(int, input().split())))
a.sort()
f.sort()
b = f[::-1]
p = list(a*f[::-1])

for i in range(K):
    x = max(p)
    y = p.index(x)
    a[y] -= 1
    p[y] -= b[y]
    if sum(a) == 0:
        break

print(max(p))

### FIXED CODE ###

from collections import Counter
n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)

la = 10**6+1
cnt = [0] * la
for u in a:
    cnt[u] += 1
for i in range(1, la):
    cnt[i] += cnt[i-1]


def judge(x):
    y = k
    for i in range(n):
        goal = x//f[i]
        if a[i] > goal:
            y -= a[i] - goal
            if y < 0:
                return False
    return y >= 0


left = -1
right = 10**12 + 1
while left + 1 < right:
    mid = (left + right)//2
    if judge(mid):
        right = mid
    else:
        left = mid

print(right)
### BUGGY CODE ###

x = int(input())

while True:
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            x = x + 1
            break
        else:
            if i == int(x**0.5):
                print(x)
                exit()
            

### FIXED CODE ###

x = int(input())

while True:
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            x = x + 1
            break
    else:
        print(x)
        exit()
### BUGGY CODE ###

# coding: utf-8
# Your code here!
# 幅優先探索（行きがけ）

import sys



def I(): return int(sys.stdin.readline().rstrip())
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())


def main():
    N, K = LI()
    Aarray = LI()

    start = 1
    for i in range(K):
        start *= Aarray[i]

    for i in range(K, N):
        now = start*Aarray[i]/Aarray[i-K]
        if now > start:
            print("Yes")
        else:
            print("No")
        start = now


if __name__ == '__main__':
    main()


### FIXED CODE ###

# coding: utf-8
# Your code here!
# 幅優先探索（行きがけ）

import sys


def I(): return int(sys.stdin.readline().rstrip())
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())


def main():
    N, K = LI()
    Aarray = LI()

    # start = 1
    # for i in range(K):
    #     start *= Aarray[i]

    # for i in range(K, N):
    #     now = start/Aarray[i-K]*Aarray[i]
    #     if now > start:
    #         print("Yes")
    #     else:
    #         print("No")
    #     start = now

    for i in range(K, N):
        now = Aarray[i-K]
        now2 = Aarray[i]
        if now2 > now:
            print("Yes")
        else:
            print("No")


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

k=int(input())
s=input()

mod=10**9+7

import sys
sys.setrecursionlimit(2147483647)

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p
p = mod #割る数
N = 10 ** 7  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

ans=0

for i in range(k+1):
    ans = (ans+cmb(i+len(s)-1,i,mod)*pow(26,k-i,mod)*pow(25,i,mod)) % mod

    #print(end,len(s)+k-end,ans,cmb(end,len(s),mod),pow(25,end-len(s),mod),pow(26,len(s)+k-end,mod))

print(ans%mod)





### FIXED CODE ###

k=int(input())
s=input()

mod=10**9+7

import sys
sys.setrecursionlimit(10**9)

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p
p = mod #割る数
N = 2*(10 ** 6)  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

ans=0

for i in range(k+1):
    ans = (ans+cmb(i+len(s)-1,i,mod)*pow(26,k-i,mod)*pow(25,i,mod)) % mod

    #print(end,len(s)+k-end,ans,cmb(end,len(s),mod),pow(25,end-len(s),mod),pow(26,len(s)+k-end,mod))

print(ans%mod)
### BUGGY CODE ###

import numpy as np
from scipy.sparse.csgraph import connected_components
import collections
 
N, M = map(int, input().split())
ab = []
for i in range(M):
    ab.append(list(map(int,input().split())))
 
l = [[0 for _ in range(N)] for _ in range(N)]
 
for i in range(M):
    l[ab[i][0]-1][ab[i][1]-1] = 1
 
a = np.array(l)
n, labels = connected_components(a)
 
print(collections.Counter(labels).most_common()[0][1])

### FIXED CODE ###

from collections import defaultdict
from collections import deque

d = defaultdict(set) #初期中身は空のset

N, M = map(int, input().split())
for i in range(M):
  A, B = map(int, input().split())
  d[A-1].add(B-1)
  d[B-1].add(A-1)
        
check = [0]*N
mans = 0

for i in range(N):
    ans = 0
    if check[i] == 0:
        check[i] = 1
        ans += 1
        sl = deque(list(d[i]))
        while sl:
            s = sl.pop()
            if check[s] == 0:
                check[s] = 1
                ans += 1
                sl.extend(list(d[s]))
    if mans < ans:
        mans = ans

print(mans)
### BUGGY CODE ###

from math import ceil

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

m = 10**6+100
n_map = {}
v_a = []
nn_map = {}
for i in a:
    if i not in n_map:
        n_map[i] = 1
    else:
        n_map[i] += 1
    if i in nn_map:
        continue
    for j in range(2, ceil(m / i) + 1):
        nn_map[i * j] = True

v_a = [k for k, v in n_map.items() if v <= 1]

v_a.sort()
vv_a = []

for i in v_a:
    if i in nn_map:
        continue
    vv_a.append(i)

print(len(vv_a))

### FIXED CODE ###

from math import ceil

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

m = 10 ** 6
n_map = {}
v_a = []
for i in a:
    if i not in n_map:
        n_map[i] = 1
    else:
        n_map[i] += 1
v_a = [(k,v) for k, v in n_map.items()]

v_a.sort(key=lambda x: x[0])
res = 0
nn_map = {}
for i, v in v_a:
    if i in nn_map:
        continue
    for j in range(1, ceil(m / i) + 1):
        nn_map[i * j] = True
    if v == 1:
        res += 1
print(res)
### BUGGY CODE ###

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

dp = [0 for _ in range(N)]
for i in range(1, N):
    min_v = 1050000000
    for j in range(1, K+1):
        if i - j >= 0:
            min_v = min(min_v, dp[i - j] + abs(H[i] - H[i - j]))
    dp[i] = min_v
print(dp[N-1])

### FIXED CODE ###

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

dp = [0 for _ in range(N)]
for i, hi in enumerate(H):
    if i == 0:
        continue
    r = max(0, i - K)
    dp[i] = min(d + abs(hi - h) for d, h in zip(dp[r:i], H[r:i]))
print(dp[N-1])
### BUGGY CODE ###

S = input()
Q = int(input())

flag = 1
for i in range(Q):
    q =  [ i for i in input().split(' ')]
    if q[0] == '1':
        flag = flag * -1
    else:
        if flag == 1: 
            if q[1] == '1':
                S = q[2] + S
            else:
                S = S + q[2]
        else:
            if q[1] == '1':
                S = S + q[2]
            else:
                S = q[2] + S
            
if flag ==1:
    print(S)
else:
    print(S[::-1])

### FIXED CODE ###

S = input()
Q = int(input())
front = ""
flag = 1
for i in range(Q):
    q =  [ i for i in input().split(' ')]
    if q[0] == '1':
        flag = flag * -1
    else:
        if flag == 1: 
            if q[1] == '1':
                front+=q[2]
            else:
                S += q[2]
        else:
            if q[1] == '1':
                S +=q[2]
            else:
                front+= q[2]
            
if flag ==1:
    print(front[::-1] + S)
else:
    print(S[::-1] + front)
### BUGGY CODE ###

import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    input = readline
    mod = 10 ** 9 + 7
    H, W, M = map(int, input().split())
    Hlist = [0] * H
    Wlist = [0] * W
    hwmatrix = [[0 for _ in range(W)] for _ in range(H)]

    for _ in range(M):
        h, w = map(int, input().split())
        Hlist[h-1] += 1
        Wlist[w-1] += 1
        hwmatrix[h-1][w-1] = 1

    hmax = [i for i, x in enumerate(Hlist) if x == max(Hlist)]
    wmax = [i for i, x in enumerate(Wlist) if x == max(Wlist)]

    flag = False
    for h in hmax:
        for w in wmax:
            if hwmatrix[h][w] == 0:
                flag = True
                break

    if flag:
        print(Hlist[h] + Wlist[w])
    else:
        print(Hlist[h] + Wlist[w] - 1)





if __name__ == '__main__':
    solve()

### FIXED CODE ###

import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    input = readline
    mod = 10 ** 9 + 7
    H, W, M = map(int, input().split())
    Hlist = collections.defaultdict(int)
    Wlist = collections.defaultdict(int)
    hw = []

    for _ in range(M):
        h, w = map(int, input().split())
        Hlist[h-1] += 1
        Wlist[w-1] += 1
        hw.append([h, w])

    #hmax = [i for i, x in enumerate(Hlist) if x == max(Hlist)]
    #wmax = [i for i, x in enumerate(Wlist) if x == max(Wlist)]

    Hlist = sorted(Hlist.items(), key=lambda x: x[1], reverse=True)
    Wlist = sorted(Wlist.items(), key=lambda x: x[1], reverse=True)

    hmaxset = set()
    wmaxset = set()

    maxH = Hlist[0][1]
    for k, v in Hlist:
        if v != maxH:
            break
        else:
            hmaxset.add(k)

    maxW = Wlist[0][1]
    for k, v in Wlist:
        if v != maxW:
            break
        else:
            wmaxset.add(k)


    flag = False
    count = 0
    for hh in hw:
        h = hh[0] - 1
        w = hh[1] - 1
        if h in hmaxset and w in wmaxset:
            count += 1

    lenhmax = len(hmaxset)
    lenwmax = len(wmaxset)

    if count != lenhmax * lenwmax:
        flag = True

    if flag:
        print(maxH + maxW)
    else:
        print(maxH + maxW - 1)





if __name__ == '__main__':
    solve()
### BUGGY CODE ###

import random
import time

t1=time.time()
d=int(input())
c=input()
cl=[int(n) for n in c.split()]
sl=list()
for i in range(d):
    s=input()
    sl=sl+[int(n) for n in s.split()]
tl=[1]*d
sat=0
for i in range(d):
    sat+=sl[i*26+tl[i]-1]

def decr(tl,cl):
    dec=0
    for i in range(26):
        last=[a for a, x in enumerate(tl) if x==i+1]
        if last==list():
            dec+=(d*(d+1)/2)*cl[i]
        else:
            for v in range(len(last)):
                if v!=len(last)-1:    
                    dec+=cl[i]*(last[v+1]-last[v]-1)*(last[v+1]-last[v])/2
                else:
                    dec+=cl[i]*(d-last[v]-1)*(d-last[v])/2
            dec+=cl[i]*(last[0])*(last[0]+1)/2
    return(int(dec))

oldscore=sat
oldans=oldscore-decr(tl,cl)
oldtl=[int(x) for x in tl]
t2=time.time()
while t2-t1<1.9:
    da=random.randint(1,d)
    q=random.randint(1,26)
    cha=sl[(da-1)*26+q-1]-sl[(da-1)*26+tl[da-1]-1]
    tl[da-1]=q
    newscore=oldscore+cha
    newans=newscore-decr(tl,cl)
    if newans<oldans:
        tl=[int(x) for x in oldtl]
    else:
        oldans=newans
        oldtl=[int(x) for x in tl]
        oldscore=newscore
    t2=time.time()
for i in range(d):
    print(tl[i])
        


### FIXED CODE ###

import random

d=int(input())
c=input()
cl=[int(n) for n in c.split()]
sl=list()
for i in range(d):
    s=input()
    sl=sl+[int(n) for n in s.split()]
tl=[1]*d
sat=0
for i in range(d):
    sat+=sl[i*26+tl[i]-1]

def decr(tl,cl):
    dec=0
    for i in range(26):
        last=[a for a, x in enumerate(tl) if x==i+1]
        if last==list():
            dec+=(d*(d+1)/2)*cl[i]
        else:
            for v in range(len(last)):
                if v!=len(last)-1:    
                    dec+=cl[i]*(last[v+1]-last[v]-1)*(last[v+1]-last[v])/2
                else:
                    dec+=cl[i]*(d-last[v]-1)*(d-last[v])/2
            dec+=cl[i]*(last[0])*(last[0]+1)/2
    return(int(dec))

oldscore=sat
oldans=oldscore-decr(tl,cl)
oldtl=[int(x) for x in tl]
for k in range(10000):
    da=random.randint(1,d)
    q=random.randint(1,26)
    cha=sl[(da-1)*26+q-1]-sl[(da-1)*26+tl[da-1]-1]
    tl[da-1]=q
    newscore=oldscore+cha
    newans=oldscore-decr(tl,cl)
    if newans<oldans:
        tl=[int(x) for x in oldtl]
    else:
        oldans=newans
        oldtl=[int(x) for x in tl]
        oldscore=newscore
for i in range(d):
    print(tl[i])
### BUGGY CODE ###

N = int(input())
S = input()
cnt = 0
for k in range(N):
    for j in range(k):
        for i in range(j):
            if S[k] == S[j] or S[j] == S[i] or S[k] == S[i] or k - j == j - i:
                cnt = cnt + 1
            else:
                cnt = cnt + 0

total = int(N * (N-1) * (N-2) / 6)

print(total - cnt)



### FIXED CODE ###

n = int(input())
s = input()

r_cnt = s.count('R')
g_cnt = s.count('G') 
b_cnt = s.count('B')

ans = r_cnt * g_cnt * b_cnt
cnt = 0

for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            cnt += 1

ans = ans - cnt
print(ans)
### BUGGY CODE ###

import collections
n=int(input())
a=[int(input()) for i in range(n)]
c=collections.Counter(a)
l=[]
for j in range(len(set(a))):
  l.append(c.most_common()[j][1])
ct=0
for k in range(len(l)):
  if l[k]%2==1:ct+=1
print(ct)

### FIXED CODE ###

n=int(input())
a=[int(input()) for i in range(n)]
a=sorted(a)
x=a[0]
c=1
ct=0
for i in range(1,n):
  if a[i]==x:
    c+=1
    if i==n-1:
      if c%2==1:
        ct+=1
  else:
    if c%2==1:
      ct+=1
    x=a[i]
    c=1
    if i==n-1:
      ct+=1
print(ct)
### BUGGY CODE ###

k, s = map(int, input().split())

count = 0
for x in range(k + 1):
  if x > k:
    continue
  for y in range(k + 1):
    if y > k:
      continue
    z = s - x - y
    if z < 0:
      continue
    if z > k:
      continue
    if (x + y + z) == s:
      count += 1

print(count)

### FIXED CODE ###

k, s = map(int, input().split())

count = 0
for x in range(k + 1):
  for y in range(k + 1):
    z = s - x - y
    if z >= 0 and z <= k:
      count += 1

print(count)
### BUGGY CODE ###

N, Q = map(int,input().split())
S = str(input())
S_list = []
for i in range(0,N,1):
    S_list.append(S[i:i+2])
del S_list[-1]
for j in range(Q):
    tmp = []
    l, r = map(int,input().split())
    for k in range(l,r,1):
        tmp.append(S_list[k-1])
    print(tmp.count("AC"))


### FIXED CODE ###

N, Q = map(int,input().split())
S = str(input())
count = 0
li = [0]
for i in range(N-1):
    if S[i:i+2] == "AC":
        count += 1
    li.append(count)
for i in range(Q):
    l,r = map(int,input().split())
    print(li[r-1]-li[l-1])
### BUGGY CODE ###

H,W,D=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(H)]
Q=int(input())
B=[list(map(int,input().split())) for _ in range(Q)]
C=[[]for i in range(H*W)]
for i in range(H):
  for j in range(W):
    a=A[i][j]
    C[a-1].append((j+1,i+1))

for a,b in B:
  cnt=0
  m=(b-a)//D
  for i in range(m):
    start=a+D*(i)
    goal=start+D
    s=C[start-1][0][0]
    t=C[start-1][0][1]
    u=C[goal-1][0][0]
    v=C[goal-1][0][1]
    cnt+=abs(s-u)+abs(t-v)
  print(cnt)

### FIXED CODE ###

H,W,D=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(H)]
Q=int(input())
B=[list(map(int,input().split())) for _ in range(Q)]
L,R=zip(*B)
C=[[]for i in range(H*W)]
for i in range(H):
  for j in range(W):
    a=A[i][j]
    C[a-1]=((j+1,i+1))
X=[0]*(H*W+1)
for i in range(D):
  x=H*W-D-i
  count=0
  while x>0:
    count+=abs(C[x-1][0]-C[x+D-1][0])+abs(C[x-1][1]-C[x+D-1][1])
    X[x]+=count
    x-=D
for i in range(Q):
  print(X[L[i]]-X[R[i]])
### BUGGY CODE ###

n = int(input())
l = [int(x) for x in input().split()]

ret = 0

for i in range(len(l)):
	a = l[i]
	for j in range(i + 1, len(l)):
		b = l[j]
		for k in range(j+1, len(l)):
			c = l[k]
			if a<b+c and b<a+c and c<a+b:
				ret += 1

print(ret)

### FIXED CODE ###

n = int(input())
a = sorted([int(x) for x in input().split()])
ret = 0
for i in range(n-1, 0, -1):
	l = 0
	r = i-1
	while l<r:
		if a[l]+a[r]>a[i]:
			ret += r - l
			r -= 1
		else:
			l += 1

print(ret)
### BUGGY CODE ###

import fractions #最小公倍数などはこっち
import math
import sys
 
mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
 
H,W = map(int,input().split())
S = [[] for i in range(H)]
for i in range(H):
    S[i] = list(str(input()))
 
lights = [[(0,0) for j in range(W)] for i in range(H)]
 
 
def count_ver(i,j):
    cnt = 0
    for x in range(i,W):
        if S[j][x] == ".":
            cnt += 1
        else:
            break
    for x in range(i,W):
        if S[j][x] == ".":
            ver,hor = lights[j][x]
            lights[j][x] = (cnt,hor)
        else:
            break
    return cnt
 
 
def count_hor(i,j):
    cnt = 0
    for y in range(j,H):
        if S[y][i] == ".":
            cnt += 1
        else:
            break
    for y in range(j,H):
        if S[y][i] == ".":
            ver,hor = lights[y][i]
            lights[y][i] = (ver,cnt)
        else:
            break
    return cnt
 
ans = -1
for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            ver,hor = lights[i][j]
            if ver == 0:
                ver = count_ver(j,i)
                # print("ver",ver)
            if hor == 0:
                hor = count_hor(j,i)
                # print("hor",hor)
            ans = max(ans,hor+ver-1)
        # print("y,x:",i,j)
        # print("ver,hor",ver,hor)
 
# print(lights)
print(ans)

### FIXED CODE ###

import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

H,W = map(int,input().split())
S = [[] for i in range(H)]
for i in range(H):
    S[i] = list(str(input()))

lights = [[(0,0) for j in range(W)] for i in range(H)]

def count_ver(i,j):
    cnt = 0
    for x in range(i,W):
        if S[j][x] == ".":
            cnt += 1
        else:
            break
    for x in range(i,i+cnt):
        ver,hor = lights[j][x]
        lights[j][x] = (cnt,hor)
    return cnt


def count_hor(i,j):
    cnt = 0
    for y in range(j,H):
        if S[y][i] == ".":
            cnt += 1
        else:
            break
    for y in range(j,j+cnt):
        ver,hor = lights[y][i]
        lights[y][i] = (ver,cnt)
    return cnt

ans = -1
for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            ver,hor = lights[i][j]
            if ver == 0:
                ver = count_ver(j,i)
            if hor == 0:
                hor = count_hor(j,i)
            ans = max(ans,hor+ver-1)

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

import math
 
N,M = map(int, input().split())
L = list(map(int, input().split()))
 
L = sorted(L,reverse=True)
 
 
for i in range(0,M):
	L[0] = int(math.floor(L[0] / 2))
	L = sorted(L,reverse=True)
	
print(sum(L))

### FIXED CODE ###

import heapq

N,M = map(int, input().split())
L = [-int(i) for i in input().split()]
heapq.heapify(L)



for i in range(M):
    h = -(-heapq.heappop(L) // 2)
 
    heapq.heappush(L,h)

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

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

d = {}
for i in range(n):
  if a[i] in d:
    d[a[i]] += 1
  else:
    d[a[i]] = 1

for i in range(n):
  ans = 0
  d[a[i]] -= 1
  for j in d.values():
    ans += j*(j-1)//2
  print(ans)
  d[a[i]] += 1

### FIXED CODE ###

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

d = {}
for i in range(n):
  if a[i] in d:
    d[a[i]] += 1
  else:
    d[a[i]] = 1
ans = 0
for j in d.values():
  ans += j*(j-1)//2
for i in range(n):
  x = d[a[i]]
  print(ans-(x*(x-1)//2)+((x-1)*(x-2)//2))
### BUGGY CODE ###

input()
A=list(map(int,input().split()))
ans=0
while all(a%2==0 for a in A):
  ans+=1
print(ans)

### FIXED CODE ###

input()
A=list(map(int,input().split()))
ans=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  ans+=1
print(ans)
### BUGGY CODE ###

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

for _ in range(min(K, 50)):
    lamp = [0 for i in range(N + 1)]
    for i in range(N):
        lamp[max(0, i - A[i])] += 1
        lamp[min(N, i + A[i] + 1)] -= 1

    ans = 0
    for i in range(N):
        ans += lamp[i]
        A[i] = min(ans, N)

[print(A[i], end=' ') if i != N - 1 else print(A[i]) for i in range(N)]


### FIXED CODE ###

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

for i in range(min(K, 50)):
    B = [0 for i in range(N)]
    for j in range(0, N):
        l = max(0, j - A[j])
        r = min(N - 1, j + A[j])
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1

    for j in range(1, N):
        B[j] += B[j - 1]
        
    A = B

[print(i, end=' ') for i in B]
print()
### BUGGY CODE ###

def search(n):
    while A[n-1] != n:
        n = A[n-1]

    return n

N, M = list(map(int, input().split()))
A = [i for i in range(1, N+1)]
ans = 0

for i in range(M):
    X, Y, Z = list(map(int, input().split()))
    X_root, Y_root = search(X), search(Y)

    if X_root != Y_root:
        A[X_root-1] = Y_root
        ans += 1

print(N-ans)

### FIXED CODE ###

def search(n):
    idx = n
    while A[n-1] != n:
        n = A[n-1]
    A[idx-1] = n

    return n

N, M = list(map(int, input().split()))
A = [i for i in range(1, N+1)]
ans = 0

for i in range(M):
    X, Y, Z = list(map(int, input().split()))
    X_root, Y_root = search(X), search(Y)

    if X_root != Y_root:
        A[X_root-1] = Y_root
        ans += 1

print(N-ans)
### BUGGY CODE ###

N, K = map(int, input().split())
p = tuple(map(int, input().split()))
ans = []
f = N-K+1
for i in range(f):
    ans.append(sum(p[i : i + K]))
print((max(ans) + K) / 2)

### FIXED CODE ###

N, K = map(int, input().split())
p = [int(x) for x in input().split()]
s = sum(p[0 : K])
ans = sum(p[0 : K])
f = N-K+1
for i in range(1, f):
    s = s - p[i-1] + p[i + K - 1]
    if ans <= s:
        ans = s
print((ans + K) / 2)