Harryxun/stf_run huggingface dataset:
N, K = map(int, input().split())
MOD = 10 ** 9 + 7

# guchoku case

# dp = [[0 for _ in range(N+1)] for _ in range(K+1)]

# for i in range(N+1):
#     dp[1][i] = 1
# for i in range(K):
#     for j in range(1,N+1):
#         for k in range(1, N // j + 1):
#             dp[i+1][j] += dp[i][k]
#             dp[i+1][j] %= MOD

JN = [0]  # N//j table
j = 1
while j*j<N:
    if j not in JN:
        JN.append(j)
    if N//j not in JN:
        JN.append(N//j)
    j += 1

JN.sort()
PJN = {JN[i]: JN[i-1] for i in range(1, len(JN))}  # prev jn

dp = [{0: 0} for _ in range(K)]
cdp = [{0: 0} for _ in range(K)]
w = dict()

# init dp
prv = 0
for i, jn in enumerate(JN):
    dp[0][jn] = 1
    w[jn] = jn - prv
    cdp[0][jn] = jn
    prv = JN[i]

for i in range(K-1):
    for jn in JN[1:]:
        dp[i+1][jn] = cdp[i][N//jn]
        dp[i+1][jn] %= MOD
        cdp[i+1][jn] = cdp[i+1][PJN[jn]] + dp[i+1][jn] * w[jn]
        cdp[i+1][jn] %= MOD

print(cdp[-1][N])


### FIXED CODE ###

from collections import deque
N, K = map(int, input().split())
MOD = 10 ** 9 + 7

# guchoku case

# dp = [[0 for _ in range(N+1)] for _ in range(K+1)]

# for i in range(N+1):
#     dp[1][i] = 1
# for i in range(K):
#     for j in range(1,N+1):
#         for k in range(1, N // j + 1):
#             dp[i+1][j] += dp[i][k]
#             dp[i+1][j] %= MOD

JN = deque()  # N//j table
SQN = int(N**0.5)
JN.append(SQN)

if SQN**2 != N:
    JN.append(N//SQN)
for j in range(SQN-1, 0, -1):
    JN.appendleft(j)
    JN.append(N//j)
JN.appendleft(0)

# JN.sort()
# PJN = {JN[i]: JN[i-1] for i in range(1, len(JN))}  # prev jn
LJN = len(JN)

dp = [[0 for _ in range(LJN)] for _ in range(K)]
cdp = [[0 for _ in range(LJN)] for _ in range(K)]
w = [0 for _ in range(LJN)]

# init dp
prv = 0
for i in range(1,LJN):
    jn = JN[i]
    dp[0][i] = 1
    w[i] = jn - prv
    cdp[0][i] = jn
    prv = JN[i]

for i in range(K-1):
    for j in range(1,LJN):
        dp[i+1][j] = cdp[i][LJN-j]
        dp[i+1][j] %= MOD
        cdp[i+1][j] = cdp[i+1][j-1] + dp[i+1][j] * w[j]
        cdp[i+1][j] %= MOD

print(cdp[-1][-1])
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)
from bisect import bisect_left, bisect_right
 
def main():
    N = int(input())
    L = [int(c) for c in input().split()]
    L = sorted(L)
    num = 0
    for ai in range(N):
        for bi in range(ai+1, N):
            if bi - ai == 1:
                continue
            a = L[ai]
            b = L[bi]
            ci_left = bisect_right(L[ai+1:bi], abs(L[ai] - L[bi]))
            ci_right = bisect_left(L[ai+1:bi], L[ai] + L[bi])
            # print(a, b, ci_left, min(ci_right, bi) - max(ci_left, ai) - 1)
            # num += min(ci_right, bi) - max(ci_left, ai) - 1
            num += ci_right - ci_left
            # print(a, b, ci_right, ci_left, num)
 
    print(num)
 
 
if __name__ == '__main__':
    main()

### FIXED CODE ###

import bisect

def main():
    N = int(input())
    L = [int(i) for i in input().split()]
    L.sort()
    count = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            k = bisect.bisect_left(L, L[i] + L[j])
            k -= 1
            count += k - j
    print(count)


if __name__ == "__main__":
    main()
import math

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

def rec(lv,ls):
    if lv == 0:
        return [1]
    else:
        ret = rec(lv-1,ls)
        for i in range(0,len(ret) -1):
            if ret[i]>0 and ret[i+1]>0:
                ret[i+1] += ret[i]
                ret[i] = 0  #deleted tag

        while 0 != ret.count(0):
            ret.remove(0)

        return [-1,*ret,1,*ret,-1]

#print( rec(n, list()) )


count = 0
for e in rec(n, list() ):
    abs_e = abs(e)

    if x == 0:
        break

    if x>=abs_e:
        x -= abs_e
        count += e if e>0 else 0
    else:
        count += x if e>0 else 0
        x = 0
    #print(x," ",count)

print(count)


### FIXED CODE ###


# This src was written after reading editional.pdf .

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


an, pn = [1], [1]

for i in range(n):
    an.append(2*an[i]+3)
    pn.append(2*pn[i]+1)

#print(an)

def f(n,x):

    #print(n,x)

    if n == 0:
        return 1 if 0<x else 0
    
    if x <= an[ n-1 ] + 1:
        return f( n-1, x-1 )

    else:# x <= 2*an[n-1] + 3:
        return f(n-1, x-an[n-1]-2) + pn[n-1] + 1


print(f(n,x))

    
#    else if: 
#        pass
n,m = map(int,input().split())
xyz = [list(map(int,input().split())) for i in range(n)]
ans = 0
for i in range(8):
    s = [0 for i in range(n)]
    for j in range(n):
        a = 0
        for k in range(3):
            if i>>k&1:
                a += xyz[j][k]
            else:
                a -= xyz[j][k]
        s[i] = a
    s.sort()
    ans = max(ans,sum(s[n-m:]))
print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
xyz = [list(map(int,input().split())) for i in range(n)]
ans = 0
for i in range(8):
    s = []
    for j in range(n):
        a = 0
        for k in range(3):
            if i>>k&1:
                a += xyz[j][k]
            else:
                a -= xyz[j][k]
        s.append(a)
    s.sort()
    ans = max(ans,sum(s[n-m:]))
print(ans)
N,M = map(int,input().split())

print(N(N-1)//2+M(M-1)//2)


### FIXED CODE ###

N,M = map(int,input().split())

print(N*(N-1)//2+M*(M-1)//2)
l=list(input())
def kaibun(c):
  d=c[::-1]
  if c = d:
    return 0
  else:
    return 1
a=kaibun(l)
m=l[:int((len(l)-1)/2)]
n=l[int((len(l)+1)/2):]

b=kaibun(m)
c=kaibun(n)

if a+b+c==0:
  print('Yes')
else:
  print('No')
 

### FIXED CODE ###

l=list(input())
def kaibun(c):
  d=c[::-1]
  if c == d:
    return 0
  else:
    return 1
a=kaibun(l)
m=l[:int((len(l)-1)/2)]
n=l[int((len(l)+1)/2):]

b=kaibun(m)
c=kaibun(n)

if a+b+c==0:
  print('Yes')
else:
  print('No')
N=int(input())
a=[]
b=[]
for i in range(N):
  a=a.append(float(input()))
  b=b.append(input())
total=0
j=0
while j<N:
  if b[j]='JPY':
    total = total+ a[j]
  else:
    total = total+380000.0*a[j]

print(total)


### FIXED CODE ###

N=int(input())
a=[]
b=[]
for i in range(N):
  x,y=input().split()
  a.append(float(x))
  b.append(y)
total=0
for j in range(N):
  if b[j]=='JPY':
    total += a[j]
  else:
    total += 380000.0*a[j]
print(total)
for i in list(range(1,10)):
??????for ii in list(range(1,10)):
????????????print("%d x %d = %d" % (i, ii, i*ii))

### FIXED CODE ###

for x in range(1,10):
    for y in range(1,10):
        print("%dx%d=%d" % (x, y, x*y))
N = int(input())

array = []

for i in range(N):
    array.append(list(map(int,input().split())))

test = []

t = []

for x in range(101):
    for y in range(101):
        H = []
        for i in array:
            if i[2] > 0:
                H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                H.append(H_i)
        Hset = set(H)
        H = list(Hset)[0]
        if(len(Hset)==1 and H>=0):
            t.append([x,y,H])

if len(t) >=2:
    x = 15/0
            
print("{0[0]} {0[1]} {0[2]}".format(t))


### FIXED CODE ###

N = int(input())

array = []

for i in range(N):
    array.append(list(map(int,input().split())))

test = []

t = []

for x in range(101):
    for y in range(101):
        H = []
        for i in array:
            if i[2] > 0:
                H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                H.append(H_i)
        Hset = set(H)
        H = list(Hset)[0]
        if(len(Hset)==1 and H>=0):
            t.append([x,y,H])

if len(t) >= 2:
    t = []
    for x in range(101):
        for y in range(101):
            H = []
            for i in array:
                if True:
                    H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                    H.append(H_i)
            Hset = set(H)
            H = list(Hset)[0]
            if(len(Hset)==1 and H>=0):
                t.append([x,y,H])
            
print("{0[0]} {0[1]} {0[2]}".format(t[0]))
n = input()
n[3] = '8'
print(str(n))

### FIXED CODE ###

s = input()
print(s[:3]+'8'+s[4:])
import sys

def wfs(queue, S, step, goal):
    next_queue = []
    for q in queue:
        if q == goal:
            return step+1

        i, j = q[0], q[1]
        S[i][j] = '#'

        if S[i+1][j] == '.':
            next_queue.append([i+1, j])
        if S[i-1][j] == '.':
            next_queue.append([i-1, j])
        if S[i][j+1] == '.':
            next_queue.append([i, j+1])
        if S[i][j-1] == '.':
            next_queue.append([i, j-1])

    if len(next_queue) == 0:
        return -1
    else:
        next_queue = list(set(next_queue))
        return wfs(next_queue, S, step+1, goal)


def main():
    input = sys.stdin.readline
    H, W = map(int, input().split())
    S = []
    init = 0
    for _ in range(H):
        s = [c for c in input().strip()]
        init += sum([c == '#' for c in s])
        S.append(['#'] + s + ['#'])
    S = [['#'] * (W+2)] + S + [['#'] * (W+2)]
    minstep = wfs([[1,1]], S, 0, [H, W])
    if minstep == -1:
        print(-1)
    else:
        print(H*W - minstep - init)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

def wfs(queue, S, step, goal):
    next_queue = set()
    for q in queue:
        if q == goal:
            return step+1

        i, j = q[0], q[1]
        S[i][j] = '#'

        if S[i+1][j] == '.':
            next_queue.add((i+1, j))
        if S[i-1][j] == '.':
            next_queue.add((i-1, j))
        if S[i][j+1] == '.':
            next_queue.add((i, j+1))
        if S[i][j-1] == '.':
            next_queue.add((i, j-1))

    if len(next_queue) == 0:
        return -1
    else:
        next_queue = list(set(next_queue))
        return wfs(next_queue, S, step+1, goal)


def main():
    input = sys.stdin.readline
    H, W = map(int, input().split())
    S = []
    black = 0
    for _ in range(H):
        s = [c for c in input().strip()]
        black += sum([c == '#' for c in s])
        S.append(['#'] + s + ['#'])
    S = [['#'] * (W+2)] + S + [['#'] * (W+2)]
    init = set([(1, 1)])
    minstep = wfs(init, S, 0, (H, W))
    if minstep == -1:
        print(-1)
    else:
        print(H*W - minstep - black)


if __name__ == '__main__':
    main()
A,B=map(int,input().split())
if A+B<10:
    print(A+B)
else:A+B>=10:
    print("erorr")


### FIXED CODE ###

A,B=map(int,input().split())
if A+B<10:
    print(A+B)
else:
    print("error")
import numpy as np

S      = input()
S      = S.split()
N      = int(S[0])
D      = int(S[1])
matrix = np.zeros([N, D])
count  = 0


for i in range(0, N, 1):
    X_vector = input()
    for j in range(0, D, 1):
        matrix[i][j] = int(X_vector[j])

for i in range(0, N, 1):
    a_vector = matrix[i]
    for j in range(i+1, N, 1):
        b_vector = matrix[j]
        length = np.linalg.norm(b_vector-a_vector)
        if float(length) / float(length) == 0.0:
            count++

print(count)


### FIXED CODE ###

import numpy as np

S      = input()
S      = S.split()
N      = int(S[0])
D      = int(S[1])
matrix = np.zeros([N, D])
count  = 0


for i in range(0, N, 1):
    X_vector = input()
    X_vector = X_vector.split()
    for j in range(0, D, 1):
        matrix[i][j] = int(X_vector[j])

for i in range(0, N, 1):
    a_vector = matrix[i]
    for j in range(i+1, N, 1):
        b_vector = matrix[j]
        length = np.linalg.norm(b_vector-a_vector)
        if length.is_integer():
            count = count + 1
print(count)
a=int(input())
b=int(input())
h=int(input())
print((a+b)*h/2))


### FIXED CODE ###

a=int(input())
b=int(input())
h=int(input())

print(((a+b)*h)//2)
N=int(input())
S=input()
M=S.count('.')
ans=M

for i in range(N):
	if S[i] == '#':
		M = M+1
	else:
		M = M-1
    ans = min(M,ans)
print(ans)

### FIXED CODE ###

N=int(input())
S=input()
M=S.count('.')
ans=M

for i in range(N):
	if S[i] == '#':
		M = M+1
	else:
		M = M-1
	ans = min(M,ans)
print(ans)
n = int(raw_input())
minv =  10**9
maxv = (-1)*10**9

  for j in range(0, n-1):
    if minv >= R[j]:
       minv = R[j]
    if maxv <= R[j+1] - minv:
       maxv = R[j+1] - minv
print maxv

### FIXED CODE ###

n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9  

for j in range(n-1):
    a = int(raw_input())
    b = a- minv
    if maxv < b:
       maxv = b 
    if minv > a:
       minv = a

print maxv
N = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(N):
    j = a[i] - 1
    if i < j and a[j] - 1 == i:
        ans += 1
print(ans)


### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(N):
    j = a[i] - 1
    if i < j and a[j] - 1 == i:
        ans += 1
print(ans)
import random

X,N = input().split()
X,N = int(X),int(N)

P = input().split()
P = [int(c) for c in P]

if len(P) == 0:
    print(X)
else:
    L = list(range(max(0,X-N),min(101,X+N)))
    if X+N == 100:
        L.append(100)

    for i in range(N):
        if P[i] in L:
            L.remove(P[i])

    #print(L)

    while len(L) > 2:
        rand = random.randint(1,len(L)-2)
        if L[rand] == X:
            break
        elif L[rand] > X:
            L = L[0:rand+1]
        else:
            L = L[rand:len(P)]

    if X in L:
        print(X)
    else:
        if abs(L[0]-X) > abs(L[1]-X):
            print(L[1])
        else:
            print(L[0])

### FIXED CODE ###

import random

X,N = input().split()
X,N = int(X),int(N)

P = input().split()
P = [int(c) for c in P]

if len(P) == 0:
    print(X)    
else:
    L = list(range(max(0,X-N),min(102,X+N)))

    if X+N <= 101:
        L.append(X+N)

    for i in range(N):
        if P[i] in L:
            L.remove(P[i])

    while len(L) > 2:
        rand = random.randint(1,len(L)-2)
        if L[rand] == X:
            break
        elif L[rand] > X:
            L = L[0:rand+1]
        else:
            L = L[rand:len(L)]

    if X in L:
        print(X)
    elif len(L) == 1:
        print(L[0])
    else:
        if abs(L[0]-X) > abs(L[1]-X):
            print(L[1])
        else:
            print(L[0])
a, b = map(int,input().split())

c = a - 2b

print(c if c > 0 else 0)

### FIXED CODE ###

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

c = a - 2 * b

print(c if c > 0 else 0)
A,B = map(int,input().split())

a1 = A + B
a2 = A - B
a3 = A * B

if a1 >= a2 and a1 >= a3:
	print(a1)
elif a2 >= a1 and a>= a3:
	print(a2)
elif a3 >= a1 and a3 >=a2:
	print(a3)

### FIXED CODE ###

A,B = map(int,input().split())

a1 = A + B
a2 = A - B
a3 = A * B

if a1 >= a2 and a1 >= a3:
	print(a1)
elif a2 >= a1 and a2>= a3:
	print(a2)
elif a3 >= a1 and a3 >= a2:
	print(a3)
s = list(input())
n = int(input())
import numpy as np

s = np.array(s)

L = []
for i in range(n):
    L = (list(map(str,input())))
    #print(L)
    if len(L) >1:
        if int(L[2]) == 1:
            #print(s)
            s = np.append(L[4],s)
        elif int(L[2]) == 2:
            s = np.append(s,L[4])
    
    elif len(L) ==1:
        s = np.rot90(s, 2)
        
print("".join(s))

### FIXED CODE ###

from collections import deque
s = input()
s = deque(s)
n = int(input())
cnt = False
for i in range(n):
  L = input()
  if len(L) == 1:
    cnt  ^=1 
  else:
    a,b,c = L.split()
    if cnt:
      if b == "1":
        s.append(c)
      else:
        s.appendleft(c)
    else:
      if b == "1":
        s.appendleft(c)
      else:
        s.append(c)
if cnt:
    s = reversed(s)
    print("".join(s))
else:
    print("".join(s))
N,K = map(int, input().split())
a = list(map(int, input().split()))

if 0 in a:
  N = N - 1
  if N == 0:
    print('0')
    exit()

aLow = list(filter(lambda x: x < 0, a))
aLow = list(map(lambda x: abs(x), aLow))
aLow.sort()

aHigh = list(filter(lambda x: x > 0, a))

least = 99999999999999999

#print(aLow)
#print(aHigh)

for i in range(0,N+1):
  j = K - i
  if i > len(aLow) or j > len(aHigh):
    continue

  if i == 0:
    dist = aHigh[j-1]
  elif j == 0:
    dist = aLow[i-1]
  else:
    dist = min(2*aLow[i-1]+aHigh[j-1], aLow[i-1]+2*aHigh[j-1])

  if least > dist:
    least = dist

print(least)


### FIXED CODE ###

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

if 0 in a:
  K = K - 1
  if K == 0:
    print('0')
    exit()

aLow = list(filter(lambda x: x < 0, a))
aLow = list(map(lambda x: abs(x), aLow))
aLow.sort()

aHigh = list(filter(lambda x: x > 0, a))

least = 99999999999999999

#print(aLow)
#print(aHigh)

for i in range(0,K+1):
  j = K - i
  if i > len(aLow) or j > len(aHigh):
    continue

  if i == 0:
    dist = aHigh[j-1]
  elif j == 0:
    dist = aLow[i-1]
  else:
    dist = min(2*aLow[i-1]+aHigh[j-1], aLow[i-1]+2*aHigh[j-1])

  if least > dist:
    least = dist

print(least)
from math import log2
n = int(input())
a = sorted(list(map(int, input().split())))
ans = 0
while a:
    m = a.pop()
    k = (1<<m.bit_length()) - m
    if k in a:
        a.remove(k)
        ans += 1
print(ans)


### FIXED CODE ###

from collections import Counter
n = int(input())
A = sorted(list(map(int, input().split())))[-1::-1]
c = Counter(A)
ans = 0
for a in A:
    b = (1<<a.bit_length()) - a
    if a == b and c[a] > 1:
        c[a] -= 2
        ans += 1
    elif a != b and c[a] > 0 and c[b] > 0:
        c[a] -= 1
        c[b] -= 1
        ans += 1
print(ans)
a,b,x = map(int,input().split())
ans = b//x - a//x
if a%x == 0:
  ams += 1
print(ans)

### FIXED CODE ###

a,b,x = map(int,input().split())
ans = b//x - a//x
if a%x == 0:
  ans += 1
print(ans)
n = int(input())
alist = []
xy = [[] for i in range(n)]
ans = 0
for i in range(n):
    xy[i] =  []
for i in range(n):
    alist.append(int(input()))
    for j in range(alist[i]):
        a,b=input().split()
        xy[i].append([int(a), int(b)])
g = [[] for i in range(2**n-1)]
for i in range(1,2**n):
    for j in range(n):
        if list(format(i,'0b').zfill(n))[j] == '1':
            g[i-1].append(xy[j])
def lie(xy,p):
    z = list(format(p,'0b').zfill(n)) 
    for i in range(len(xy)):
        for j in range(len(xy[i])):
            if str(xy[i][j][1]) == z[xy[i][j][0]-1]:
                continue
            else:
                return 'No'
                break
    return 'Yes'
for k in range(2**n-1):
    if lie(g[k],k+1) == 'Yes':
        ans = max(ans,list(str(format(k+1,'0b'))).count('1'))
print(ans)

### FIXED CODE ###

import numpy as np

n = int(input())
arr = np.array([int(i) for i in input().split()])
mod = 10 ** 9 + 7
s = 0

for i in range(60):
    c1 = np.count_nonzero(arr & 1) # 自分がnp.sumを利用したがどうしても正解になれなかった。なぜ？
    s += 2 ** i * c1 * (n - c1)
    arr >>= 1

print(s % mod)
n,k = map(int,input().split())
A = list(map(int,input().split()))
B = []
b = 1
ans = 1
while ans:
  a = b
  b = A[a-1]
  B.append(b)
  if len(B) == len(A):
    ans = 0
C = B * 10000000000
print(C[k-1])


### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
pos = 0
visit = [0] * N
move = []
roop = []
while visit[pos]!=2:
    if visit[pos]==0:
        move.append(pos)
    else:
        roop.append(pos)
    visit[pos] += 1
    pos = A[pos] - 1
if len(move)>K:
    print(move[K]+1)
else:
    print(roop[(K-(len(move)-len(roop)))%len(roop)]+1)
N,K = map(int, input().split())
A = [map(int, input().split())]
for a in A:
a = (1+a)/2
sumK = []
for i in range(len(A)):
  b = A[i:i+K]
  sumK.append(sum(b))
print(max(sumK))

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))

    tmp_max = sum(P[:K])
    tmp = sum(P[:K])
    for i in range(N-K):
        tmp += P[i+K]
        tmp -= P[i]

        if tmp > tmp_max:
            tmp_max = tmp

    print((tmp_max + K) / 2)

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


class UnionFind:
    def __init__(self, size):
        self.UF = list(range(size))
        self.SIZE = [1] * size  # 0-indexed

    def find(self, x):
        UF = self.UF
        find = self.find
        if UF[x] != x:
            UF[x] = find(UF[x])
        return UF[x]

    def unite(self, x, y):
        is_same = self.is_same
        find = self.find
        SIZE = self.SIZE
        UF = self.UF
        if not is_same(x, y):
            X, Y = find(x), find(y)
            SX, SY = SIZE[X], SIZE[Y]
            if SX > SY:
                m = UF[X] = Y
            else:
                m = UF[Y] = X
            SIZE[m] = SX + SY
            SIZE[X + Y - m] = 0

    def is_same(self, x, y):
        find = self.find
        return find(x) == find(y)

    def scan_uf(self):
        find = self.find
        length = len(self.UF)
        for i in range(length):
            find(i)

    def size(self, x):
        return self.SIZE[self.find(x)]


score = [[0 for _ in range(W)] for _ in range(H)]
UF1 = UnionFind(H * W)
for h in range(H):
    w = 0
    while w < W:
        if S[h][w] == '.':
            w0 = w
            while w < W and S[h][w] == '.':
                UF1.unite(W * h + w, W * h + w0)
                w += 1
        else:
            w += 1
UF2 = UnionFind(H * W)
for w in range(W):
    h = 0
    while h < H:
        if S[h][w] == '.':
            h0 = h
            while h < H and S[h][w] == '.':
                UF2.unite(W * h + w, W * h0 + w)
                h += 1
        else:
            h += 1
ans = -1
for h in range(H):
    for w in range(W):
        ans = max([ans, UF1.size(W * h + w) + UF2.size(W * h + w) - 1])
print(ans)


### FIXED CODE ###

import copy
H, W = [int(_) for _ in input().split()]
S = []
for _ in range(H):
    S += [1 if _ == '.' else 0 for _ in list(input())]
S += [0] * W
SL = copy.copy(S)
SR = copy.copy(S)
SU = copy.copy(S)
SD = copy.copy(S)
for h in range(H):
    for i in range(W * h + 1, W * (h + 1)):
        if SL[i]:
            SL[i] = SL[i - 1] + 1
        else:
            SL[i] = 0
for h in range(H):
    for i in range(W * h - 2, W * (h - 1) - 1, -1):
        if SR[i]:
            SR[i] = SR[i + 1] + 1
        else:
            SR[i] = 0
for w in range(W):
    for i in range(W + w, W * H + w, W):
        if SU[i]:
            SU[i] = SU[i - W] + 1
        else:
            SU[i] = 0
for w in range(W):
    for i in range(W * (H - 2) + w - 1, -1, -W):
        if SD[i]:
            SD[i] = SD[i + W] + 1
        else:
            SD[i] = 0
score = 0
print(max((SL[_] + SR[_] + SU[_] + SD[_] - 3 for _ in range(H * W))))
s=input()
co="CODEFESTIVAL2016"
cou=0
for i in range(s):
  if(s[i]!=co[i]):cou+=1
print(cou)

### FIXED CODE ###

s=input()
co="CODEFESTIVAL2016"
cou=0
for i in range(len(s)):
  if(s[i]!=co[i]):cou+=1
print(cou)
s = input()
cnt = 0
flg = 0
i = 0
j = -1
while flg == 0:
	if s[i] != s[j]:
		cnt += 1
	#print (s[i],s[j])
	if len(s)//2 == i+1:
		flg =1
	i += 1
	j += -1
print (cnt)


### FIXED CODE ###

s = input()
cnt = 0
flg = 0
i = 0
j = -1
if len(s) == 1:
	print (0)
	exit()
while flg == 0:
	if s[i] != s[j]:
		cnt += 1
	#print (s[i],s[j])
	if len(s)//2 == i+1:
		flg =1
	i += 1
	j += -1
print (cnt)
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for d in range(A +1):
    for e in range(B+ 1):
        for f in range(C+1):
            if d* 500 + e* 100 + f*50 == X:
                count = count + 1
input(int(count))

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for d in range(A +1):
    for e in range(B+ 1):
        for f in range(C+1):
            if d* 500 + e* 100 + f*50 == X:
                count = count + 1
print(int(count))