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

N,S=map(int,input().split())
A=list(map(int,input().split()))
mod=998244353
dp=[[0]*(S+1) for _ in range(N+1)]
dp[0][0]=1

for i in range(1,N+1):
  for j in range(S+1):
    dp[i][j]+=dp[i-1][j]*2
    if j-A[i-1]>=0:
      dp[i][j]+=dp[i-1][j-A[i-1]]
    dp[i][j]%=mod
print(dp[N][S])
    

### FIXED CODE ###

N,S=map(int,input().split())
A=list(map(int,input().split()))
mod=998244353
dp=[[0]*(S+1) for _ in range(N+1)]
dp[0][0]=1

for i in range(1,N+1):
  for j in range(S+1):
    dp[i][j]+=dp[i-1][j]*2
    if j-A[i-1]>=0:
      dp[i][j]+=dp[i-1][j-A[i-1]]
    dp[i][j]%=mod
print(dp[N][S])
### BUGGY CODE ###

N = int(input())
a = sorted([int(input()) for _ in range(N)], reverse=True)

s = sum(a)
m = (s + 1) // 2
m1 = m + 1

ab = [[-1] * m1 for _ in range(N)]
ab.append([0] * m1)
ab[N][m] = 1
for j in range(N -1, 0, -1):
    ab[j][m] = (3 * ab[j + 1][m]) % 998244353


def func(n, r):
    if r >= m:
        return ab[n][m]
    else:
        if ab[n][r] > -1:
            return ab[n][r]
        else:
            ret = (func(n + 1, r + a[n]) + 2 * func(n + 1, r)) % 998244353
            ab[n][r] = ret
            return ret


def func1(n, r):
    if n == N - 1:
        if r + a[n] == m:
            return 1
        else:
            return 0
    elif r + a[n] > m:
        return func1(n + 1, r)
    elif r + a[n] == m:
        return 1 + func1(n + 1, r)
    else:
        return (func1(n + 1, r + a[n]) + func1(n + 1, r)) % 998244353


ans1 = func(0, 0)
ans = 3 ** N % 998244353 - 3 * ans1
if s % 2 == 0:
    ans2 = func1(0, 0)
    ans += 3 * ans2

print(ans % 998244353)


### FIXED CODE ###

import numpy as np

N = int(input())
a = sorted([int(input()) for _ in range(N)])

s = sum(a)
m = (s + 1) // 2
m1 = m + 1


def func():
    ab = np.zeros((N + 1, m1), dtype='int64')
    ab[0, m] = 1
    for i in range(N):
        c = a[i]
        ab[i + 1, :-c] = (2 * ab[i, :-c] + ab[i, c:]) % 998244353
        ab[i + 1, -c:] = (2 * ab[i, -c:] + ab[i, m]) % 998244353
    return ab[N, 0]


def func1():
    ab = np.zeros((N + 1, m1), dtype='int64')
    ab[0, m] = 1
    for i in range(N):
        c = a[i]
        ab[i + 1, :-c] = (ab[i, :-c] + ab[i, c:]) % 998244353 
        ab[i + 1, -c:] = ab[i, -c:]
    return ab[N, 0]


ans = 3 ** N % 998244353 - 3 * func()
if s % 2 == 0:
     ans += 3 * func1()
print(ans % 998244353)
### BUGGY CODE ###

N=int(input())
S=input().split()
NS = [int(i) for i in S]
def exist():
    s=0
    for i in range(N):
      cond=True
      for j in range(0,i):
         if NS[i]>NS[j]:
            cond=False
            break
      if cond:
        s+=1   
    return s
if __name__=='__main__':
   print(exist())

### FIXED CODE ###

N=int(input())
S=input().split()
NS = [int(i) for i in S]
def minL():
  ml=[NS[0]]
  for i in range(1,N):
     ml+=[min(ml[i-1],NS[i])]
  return ml  

MINL=minL()
def exist():
    s=0
    for i in range(N):
      if MINL[i]>=NS[i]:
         s+=1
    return s
if __name__=='__main__':
   print(exist())
### BUGGY CODE ###

n = list(map(int, input().split()))
re = True
num = n[0]
if n[1] == 1:
  print(0)
else:
  while re:
    k = num - n[1]
    if num > abs(k):
      num = abs(k)
    else:
      re = False
  print(num)

### FIXED CODE ###

n = list(map(int, input().split()))
k = n[0] % n[1]

if abs(k - n[1]) > k:
  print(k)
else:
  print(abs(k - n[1]))
### BUGGY CODE ###

L, N = (int(i) for i in input().split())
X = [int(input()) for _ in range(N)]
X.insert(0, 0)

d = {("S", 0, 0, 0): 0}
for _ in range(N):
    d_ = {}
    for (root, p, l, r), w in d.items():
        d_[(root+"L", X[l+1], l+1, r)] = w + X[l+1] - p
        d_[(root+"R", X[-(r+1)] - L, l, r+1)] = w + (L - X[-(r+1)]) + p
    max_d = max(d_.items(), key=lambda x: x[1])[1]
    d = {k: v for k, v in d_.items() if max_d >= v}
#     print(d)
# print(max(d.items(), key=lambda x: x[1]))
print(max(d.items(), key=lambda x: x[1])[1])


### FIXED CODE ###

import math

L, N = (int(i) for i in input().split())
X = [int(input()) for _ in range(N)]
X.insert(0, 0)

X_r = [L - i for i in reversed(X)]
X_r.insert(0, 0)
X_r.pop()

def lsum(l):
    s = 0
    for i in l:
        s += i
        yield s

X_sum = list(lsum(X))
X_r_sum = list(lsum(X_r))

def f_l(p, n):
    N_tmp = N - n
    a = N_tmp // 2
    if N_tmp == 0:
        return 0
    elif N_tmp % 2 == 0:
        return 2 * X_sum[a] + X_r_sum[a + n] + X_r_sum[a + n - 1] - 2 * X_r_sum[n] + p
    else:
        return X_sum[a+1] + X_sum[a] + 2 * X_r_sum[a + n] - 2 * X_r_sum[n] + p


def f_r(p, n):
    N_tmp = N - n
    a = N_tmp // 2
    if N_tmp == 0:
        return 0
    elif N_tmp % 2 == 0:
        return 2 * X_r_sum[a] + X_sum[a + n] + X_sum[a + n - 1] - 2 * X_sum[n] + p
    else:
        return X_r_sum[a+1] + X_r_sum[a] + 2 * X_sum[a + n] - 2 * X_sum[n] + p

max_l = max(X[i] + f_r(X[i], i) for i in range(1, N+1))
max_r = max(X_r[i] + f_l(X_r[i], i) for i in range(1, N+1))

print(max(max_l, max_r))
### BUGGY CODE ###

def f(n):
    ps = list(map(float, input().split()))
    ans = 0
    for b in range(2 ** n):
        if format(b, "b").count("1") > n // 2:
            pi = 1
            for i in range(n):
                if b & 1:
                    pi *= ps[i]
                else:
                    pi *= 1 - ps[i]
                b = b >> 1
            ans += pi
    print(ans)

n = int(input())
f(n)


### FIXED CODE ###

n=int(input())
ps=list(map(float,input().split()))
lim=(n+1)//2
dp=[0]*(lim+1)
dp[0]=1
for pi,p in enumerate(ps):
    if pi+1>=lim:
        st=lim-1
        dp[lim]=dp[lim]+dp[lim-1]*p
    else:
        st=pi+1
    for i in range(st,0,-1):
        dp[i]=dp[i-1]*p+dp[i]*(1-p)
    dp[0]=dp[0]*(1-p)
print(dp[-1])
### BUGGY CODE ###

import sys

while (True):
    L = map(float, sys.stdin.readline().split())
    if L:
        (a, b, c, d, e, f) = L
        x = (e * c - b * f) / (a * e - b * d)
        y = (a * f - d * c) / (a * e - b * d)

        print x, y

### FIXED CODE ###

import sys

eps = float(pow(10,-7))

while (True):
    L = map(float, sys.stdin.readline().split())
    if L:
        (a, b, c, d, e, f) = L
        x = (e * c - b * f) / (a * e - b * d)
        y = (a * f - d * c) / (a * e - b * d)

        if (abs(x) < eps):
            x = 0.0
        if (abs(y) < eps):
            y = 0.0

        print "{0:.3f} {1:.3f}".format(x, y)

    else:
        break
### BUGGY CODE ###

from collections import deque
d = deque()
n = int(input())
for i in range(n):
    s = input().split()
    if str(s[0]) == 'insert': d.appendleft(int(s[1]))
    elif str(s[0]) =='delete': 
        if int(s[1]) in d:
            d.remove(int(s[1]))
        else: pass
    elif str(s[0]) =='deleteFirst': d.popleft()
    else: d.pop()

print(*d)



### FIXED CODE ###

import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)
### BUGGY CODE ###

n, m = map(int, input().split())
d = {i+1 : [] for i  in range(n)}
for _ in range(m):
    u, v = map(int, input().split())
    d[u].append(v)
s, t = map(int, input().split())
q = set([s])
visited = set([s])
c = 1
def solve():
    global visited, c, q
    while True:
        for v in list(q):
            q.remove(v)
            es =set([e3 for e1 in d[v] for e2 in d[e1] for e3 in d[e2] if not e3 in visited])
            if t in es:
                return c
            else:
                visited |= es
                q |= es
        if not len(q):
            return -1
        c += 1
print(solve())


### FIXED CODE ###

n, m = map(int, input().split())
d = {i+1 : [] for i  in range(n)}
for _ in range(m):
    u, v = map(int, input().split())
    d[u].append(v)

visited1 = [False for i in range(n+1)]
visited2 = [False for i in range(n+1)]
visited3 = [False for i in range(n+1)]

s, t = map(int, input().split())
q = set([s])
c = 1
def solve():
    global visited1, visited2,visited3,  c, q
    while True:
        q2 = list(q)
        q = set([])
        for v in q2:
            for e1 in d[v]:
                if visited1[e1]:
                    continue
                visited1[e1] = True
                for e2 in d[e1]:
                    if visited2[e2]:
                        continue
                    visited2[e2] = True
                    for e3 in d[e2]:
                        if visited3[e3]:
                            continue
                        visited3[e3] = True
                        if e3 == t:
                            return c
                        else:
                            q.add(e3)
        if not len(q):
            return -1
        c += 1
print(solve())
### BUGGY CODE ###

import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort(reverse=True)
#print(L)
for x in range(K):
    #print(x)
    if (len(L) != 0):
        del L[0]
   # print(L)
print(sum(L))

### FIXED CODE ###

import math
N,K = map(int,(input().split()))
#print(N,K)
L = list(map(int,(input().split())))
L.sort()
#print(L)
num = N-K
if(num < 0):
    num = 0
L = L[0:num]
#print(L)
print(sum(L))
### BUGGY CODE ###

#!/usr/bin/python3

import itertools

def main():
    X, Y, Z, K = map(int, input().split())
    data = [list(map(int, input().split())) for _ in range(3)]

    a_add_b = [[i + j for i in data[0]] for j in data[1]]
    a_add_b = list(itertools.chain(*a_add_b))
    a_add_b.sort()
    e_add_c = [[i + j for i in a_add_b[-K:]] for j in data[2]]
    e_add_c = list(itertools.chain(*e_add_c))
    e_add_c.sort()

    e_add_c = e_add_c[::-1]

    for abc in e_add_c[:K]:
        print(abc)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/python3

import numpy as np
import itertools

def main():
    X, Y, Z, K = map(int, input().split())
    A = np.array(list(map(int, input().split())))
    B = np.array(list(map(int, input().split())))
    C = np.array(list(map(int, input().split())))

    a_add_b = np.array(list(A + j for j in B))
    a_add_b = np.sort(a_add_b, axis=None)

    e_add_c = np.array(list(C + j for j in a_add_b[:-K-1:-1]))
    e_add_c = np.sort(e_add_c, axis=None)


    for abc in e_add_c[:-K-1:-1]:
        print(abc)


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

N = int(input())
visited = [False] * N
colors = [-1] * N
dist = [float('inf')] * N

def dfs(u):
    if visited[u]:
        return

    visited[u] = True
    for i, v in enumerate(edges[u]):
        if v == -1:
            continue
        if visited[i]:
            continue
        if colors[i] != -1:
            continue

        dist[i] = dist[u] + v
        if dist[i] % 2 == 0:
            colors[i] = 0
        else:
            colors[i] = 1
        dfs(i)


edges = [[-1 for _ in range(N)] for _ in range(N)]
for _ in range(N-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    edges[u][v] = w
    edges[v][u] = w


colors[0] = 0
dist[0] = 0
dfs(0)
for c in colors:
    print(c)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

N = int(input())
visited = [False] * N
colors = [-1] * N
dist = [float('inf')] * N

def dfs(u):
    if visited[u]:
        return

    visited[u] = True
    for (v, w) in edges[u]:
        if visited[v]:
            continue
        if colors[v] != -1:
            continue

        dist[v] = dist[u] + w
        if dist[v] % 2 == 0:
            colors[v] = 0
        else:
            colors[v] = 1
        dfs(v)


edges = [[] for _ in range(N)]
for _ in range(N-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    edges[u].append((v, w))
    edges[v].append((u, w))


colors[0] = 0
dist[0] = 0
dfs(0)
for c in colors:
    print(c)
### BUGGY CODE ###

n = int(input())
orig_n = n
res=[]
i = 2
half_n = n // 2
root_n = int(n ** (1/2))
is_prime = True
while i <= (root_n):
    if orig_n % i == 0:
        is_prime = False
        break

while i <= half_n and not(is_prime):
    if n ==1:
        break
    if n % i == 0:
        n = n // i
        res.append(i)
        i = 1
    i += 1

print("{0}: {1}".format(orig_n, " ".join(map(str, res))))

### FIXED CODE ###

n = int(input())
orig_n = n
res=[]
i = 2
half_n = n // 2
root_n = int(n ** (1/2))
is_prime = True
while i <= (root_n):
    if orig_n % i == 0:
        is_prime = False
        break
    i += 1
if is_prime: res.append(orig_n)

while i <= half_n and not(is_prime):
    if n ==1:
        break
    if n % i == 0:
        n = n // i
        res.append(i)
        i = 1
    i += 1

print("{0}: {1}".format(orig_n, " ".join(map(str, res))))
### BUGGY CODE ###

def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return list(map(str, input().split()))

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

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

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

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

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  n,k = input_list()
  p = input_list()
  kaku = []
  for v in p:
    kaku.append((1+v)/2)
  ans = []
  for i in range(len(p)-k+1):
    ans.append(sum(kaku[i:i+k]))
  print(max(ans))
  
import math
import fractions
import collections
import itertools
from functools import reduce
main()

### FIXED CODE ###

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

def kitai(x):
  return (1+int(x))/2

p = list(map(kitai, input().split()))

pre = psum = sum(p[0:k])

for i in range(1, n):
  if i+k > n:
    break
  pre = pre - p[i-1] + p[i+k-1]
  psum = max(psum, pre)

print(psum)
### BUGGY CODE ###

s_l = list(input())
n = len(s_l)

ans = 0
flag = -1
for i in range(n-1,3,-1):
    for j in range(i-4,-1,-1):
        if flag > 0:
            flag -= 1
            continue
        val = int(''.join(s_l[j:i+1]))
        if val%2019 == 0 and val != 0:
            ans += 1
            flag = 4
        else:
            flag = -1

print(ans)

### FIXED CODE ###

s_l = list(input())
n = len(s_l)

# 公式解説参照
dp_dict = {0:1}
t = 0
for i in range(n):
    a = int(s_l[-(i+1)])
    t = (t + a*(pow(10,i,2019)))%2019
    dp_dict[t] = dp_dict.get(t,0) + 1

ans = 0
for val in dp_dict.values():
    ans += val*(val-1)//2

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

from collections import deque
from itertools import chain

INF = 10**18

H, W = map(int, input().split())
A = [input() for _ in range(H)]

q = deque([])
dist = [[INF for _ in range(W)]for _ in range(H)]
for y, A_line in enumerate(A):
    for x, a in enumerate(A_line):
        if a == "#":
            dist[y][x] = 0
            q.append((x, y))

while q:
    t_pos = tx, ty = q.popleft()
    dist_t = dist[ty][tx]

    for dx, dy in ((0, 1), (1, 0), (0, -1), (-1, 0)):
        pos = x, y = tx+dx, ty+dy
        if not (0 <= x < W and 0 <= y < H):
            continue
        elif A[y][x] == "#":
            continue
        elif dist[y][x] <= dist_t + 1:
            continue
        dist[y][x] = dist_t + 1
        q.append(pos)
# print(dist)

r = max(chain(*dist))
print(r)

### FIXED CODE ###

from collections import deque
from itertools import chain

INF = 10**18

H, W = map(int, input().split())
A = [input() for _ in range(H)]

q = deque([])
dist = [[INF for _ in range(W)]for _ in range(H)]
for y, A_line in enumerate(A):
    for x, a in enumerate(A_line):
        if a == "#":
            dist[y][x] = 0
            q.append((x, y))

while q:
    t_pos = tx, ty = q.popleft()
    dist_t = dist[ty][tx]

    for dx, dy in ((0, 1), (1, 0), (0, -1), (-1, 0)):
        pos = x, y = tx+dx, ty+dy
        if not (0 <= x < W and 0 <= y < H):
            continue
        elif A[y][x] == "#":
            continue
        elif dist[y][x] <= dist_t + 1:
            continue
        dist[y][x] = dist_t + 1
        q.append(pos)
# print(dist)

r = max(chain(*dist))
print(r)
### BUGGY CODE ###

while True:
    H,W = map(int, raw_input().split(" "))
    if (H,W) == (0,0):
        break
    field = [raw_input() for _ in xrange(H)]
    space = [[0]*(W+1) for _ in xrange(H)]
    for x in xrange(W-1,-1,-1):
        for y in xrange(H):
            if field[y][x]==".":
                space[y][x] = space[y][x+1]+1 
    ans = 0
    for x in xrange(W):
        for y in xrange(H):
            for h in xrange(y+1,H+1):
                ans = max(ans, min(s[x] for s in space[y:h])*(h-y))
    print ans        

### FIXED CODE ###

def re_push(stack,num):#re_push and return max
    count = 0
    pre = num
    ma = 0
    while True:
        count += 1
        cur = stack.pop()
        if cur <= num:
            ma = max(ma,(count-1) * pre)
            stack += [cur]
            stack += [num]*(count-1)
            break
        if cur < pre:
            ma = max(ma,(count-1) * pre)
            stack += [cur]*count
            count = 0
        pre = cur
    return ma
            
while True:
    H,W = map(int, raw_input().split(" "))
    if (H,W) == (0,0):
        break
    field = [raw_input() for _ in xrange(H)]
    table = [[0]*(W+1) for _ in xrange(H)]
    for y in xrange(H-1,-1,-1):
        for x in (x for x in xrange(W-1,-1,-1) if field[y][x] != "*"):
            table[y][x] = table[y][x+1] + 1
    ma = 0
    for x in xrange(W):
        stack = [0,table[0][x]]
        for y in xrange(1,H):
            if table[y-1][x] > table[y][x]:
                ma = max(ma, re_push(stack,table[y][x]))
            stack.append(table[y][x])
        ma = max(ma, re_push(stack,0))
    print ma
### BUGGY CODE ###

H, W = (int(i) for i in input().split())
#m = [[int(i) for i in input().split] for i in range(1)]
m = []
for i in range(10):
    m.append(list(map(int, input().split())))
wall = []
for i in range(H):
	wall.append(list(map(int, input().split())))
# wall = [[int(i) for i in input().split] for i in range(H)]
cost = 0

def search(i,current_cost,min_cost):
	for j in range(10):
		if i != j:
			if current_cost + m[i][j] < min_cost:
				if j == 1:
					min_cost = current_cost + m[i][j]
					# return current_cost + m[i][j]
				else:
					tmp = search(j, current_cost + m[i][j], min_cost)
					if tmp < min_cost:
						min_cost = tmp
	return min_cost
for i in range(H):
	for j in range(W):
		if wall[i][j] != 1 and wall[i][j] != -1:
			cost += search(wall[i][j], 0, m[wall[i][j]][1])

print(cost)

### FIXED CODE ###

H, W = (int(i) for i in input().split())
#m = [[int(i) for i in input().split] for i in range(1)]
m = []
for i in range(10):
    m.append(list(map(int, input().split())))
wall = []
for i in range(H):
	wall.append(list(map(int, input().split())))
# wall = [[int(i) for i in input().split] for i in range(H)]
cost = 0

for k in range(10):
    for i in range(10):
        for j in range(10):
            if m[i][j] > m[i][k] + m[k][j]:
                m[i][j] = m[i][k] + m[k][j]

for i in range(H):
	for j in range(W):
		if wall[i][j] != 1 and wall[i][j] != -1:
			cost += m[wall[i][j]][1]

print(cost)
### BUGGY CODE ###

N = int(input())
a = [int(input()) for i in range(N)]
A = max(a)
if a.count(A) > 1:
    for i in range(len(a)):
        print(A)
else:
    for i in range(len(a)):
        if i == a.index(A):
            print(sorted(a)[-2])
        else:
            print(A)

### FIXED CODE ###

N = int(input())
a = [int(input()) for i in range(N)]
A = max(a)
b = sorted(a)[-2]
if a.count(A) > 1:
    for i in range(len(a)):
        print(A)
else:
    for i in range(len(a)):
        if a[i] == A:
            print(b)
        else:
            print(A)
### BUGGY CODE ###

H, W = list(map(int, input().split()))
S = []
for i in range(H):
  S.append(input())
  
L = [[0] * W for i in range(H)]
R = [[0] * W for i in range(H)]
U = [[0] * W for i in range(H)]
D = [[0] * W for i in range(H)]

for i in range(H):
  work = 0
  for j in range(W):
    if S[i][j] == '#':
      work = 0
    else:
      work += 1
    R[i][j] = work
    
for i in range(H):
  work = 0
  for j in range(W-1,-1,-1):
    if S[i][j] == '#':
      work = 0
    else:
      work += 1
    L[i][j] = work
    
for i in range(W):
  work = 0
  for j in range(H):
    if S[j][i] == '#':
      work = 0
    else:
      work += 1
    D[j][i] = work
    
for i in range(W):
  work = 0
  for j in range(H-1,-1,-1):
    if S[j][i] == '#':
      work = 0
    else:
      work += 1
    U[j][i] = work
    
ans = 0
for i in range(H):
  for j in range(W):
    ans = max(ans, U[i][j] + D[i][j] + L[i][j] + R[i][j] - 3)
    
print(ans)

### FIXED CODE ###

H, W = list(map(int, input().split()))
S = []
for i in range(H):
  S.append(input())
  
L = [[0] * W for i in range(H)]
R = [[0] * W for i in range(H)]
U = [[0] * W for i in range(H)]
D = [[0] * W for i in range(H)]

for i in range(H):
  work = 0
  for j in range(W):
    if S[i][j] == '#':
      work = 0
    else:
      work += 1
    R[i][j] = work
    
for i in range(H):
  work = 0
  for j in range(W-1,-1,-1):
    if S[i][j] == '#':
      work = 0
    else:
      work += 1
    L[i][j] = work
    
for i in range(W):
  work = 0
  for j in range(H):
    if S[j][i] == '#':
      work = 0
    else:
      work += 1
    D[j][i] = work
    
for i in range(W):
  work = 0
  for j in range(H-1,-1,-1):
    if S[j][i] == '#':
      work = 0
    else:
      work += 1
    U[j][i] = work
    
ans = 0
for i in range(H):
  for j in range(W):
    ans = max(ans, U[i][j] + D[i][j] + L[i][j] + R[i][j] - 3)
    
print(ans)
### BUGGY CODE ###

import collections

N,X,Y=map(int,input().split())
if X > Y:
    exc=X
    X=Y
    Y=exc
L=[]
for i in range(N-1):
    for j in range(i+1,N):
        if i >= Y-1 or j <= X-1:
            L.append(j-i)
        elif j-i == 1:
            L.append(1)
        elif i <= X-1 and j >= Y-1:
            L.append(1+abs(X-1-i)+abs(Y-1-j))
        elif i >= X-1 and i-(X-1) > (Y-1)-i:
            L.append(j-i)            
        else:
            L1=j-i
            L2=min(j-i,1+abs(X-1-i)+abs(Y-1-j))
            L.append(min(L1,L2))

c=collections.Counter(L)

for i in range(1,N):
    print(c[i])




### FIXED CODE ###

N,X,Y=map(int,input().split())
if X > Y:
    exc=X
    X=Y
    Y=exc
L=[0]*N
for i in range(N-1):
    for j in range(i+1,N):
        if i >= Y-1 or j <= X-1 or j-i ==1:
            L[j-i]+=1
        elif i <= X-1 and j >= Y-1:
            L[1+abs(X-1-i)+abs(Y-1-j)]+=1
        elif i >= X-1 and i-(X-1) > (Y-1)-i:
            L[j-i]+=1
        else:
            L1=j-i
            L2=min(j-i,1+abs(X-1-i)+abs(Y-1-j))
            L[min(L1,L2)]+=1

for i in range(1,N):
    print(L[i])
### BUGGY CODE ###

import math
N = int(input())
X = []
for _ in range(N):
  x, l = map(int,input().split())
  X.append([x+l, x, l])
sorted_X = sorted(X, key=lambda x:(x[1], x[2]))
ans = 1
for i in range(N-1):
  temp = 1
  cnt = sorted_X[i][0]
  for j in range(i+1,N):
    if sorted_X[j][1] - sorted_X[j][2] >= cnt:
      temp += 1
      cnt = sorted_X[j][0]
  if temp > ans:
    ans = temp
print(ans)

### FIXED CODE ###

import math
N = int(input())
X = []
for _ in range(N):
  x, l = map(int,input().split())
  X.append([x+l, x-l])
sorted_X = sorted(X, key=lambda x:(x[0], x[1]))
ans = 1
cnt = sorted_X[0][0]
for i in range(N):
  if sorted_X[i][1] >= cnt:
    ans += 1
    cnt = sorted_X[i][0]
print(ans)
### BUGGY CODE ###

import numpy
k=int(input())
a=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
      a=a+numpy.gcd.reduce([i,j,l])
print(a)

### FIXED CODE ###

import math
k=int(input())
a=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
      if i<=j<=l:
        if i==j==l:
          a=a+i
        elif i==j and j!=l:
          a=a+3*math.gcd(i,l)
        elif i!=j and j==l:
          a=a+3*math.gcd(i,l)
        elif i!=j and j!=l:
          a=a+6*math.gcd(i,math.gcd(j,l))
      else:
        a=a+0
print(a)