Harryxun/stf_run huggingface dataset:
h,w=map(int,input().split())
field=[]
for i in range(n):
  field.append(input())
def check(a,b):
  num=0
  if field[a][b]=="#":
    return
  for i in range(a-1,a+2):
    for j in range(b-1,b+2):
      try:
        if field[i][j]=="#":
          num+=1
      except:
        pass
  return num
for i in range(h):
  for j in range(w):
    if field[i][j]==".":
      field[i][j]==check(i,j)
for i in range(h):
  print(field[i])

### FIXED CODE ###

h,w=map(int,input().split())
field=[]
nfield=[[] for i in range(h)]
for i in range(h):
  field.append(input())
def check(a,b):
  num=0
  if field[a][b]=="#":
    return
  for i in range(a-1,a+2):
    for j in range(b-1,b+2):
      try:
        if j !=-1 and i!=-1 and field[i][j]=="#":
          num+=1
      except:
        pass
  return num
for i in range(h):
  for j in range(w):
    if field[i][j]==".":
      nfield[i].append(check(i,j))
    else:
      nfield[i].append("#")
for i in range(h):
  for j in range(w):
    if j != w-1:
      print(nfield[i][j],end="")
    else:
      print(nfield[i][j])
from fractions import gcd
n, m = map(int, input().split())
a = list(map(int, input().split()))

def lcm(a, b):
    return a*b // gcd(a, b)
"""
akが偶数だから、bk=2akとして、何かの奇数で共通可できるようにすればよい。
Xが存在するには、奇数部分はbkの最小公倍数と奇数を掛けたもの
"""
lcm_all = lcm(a[0]//2, a[1]//2)
for i in range(1, n):
    lcm_all = lcm(lcm_all, a[i]//2)

f = True
if lcm_all > m:
    f = False
for i in range(n):
    if (lcm_all//(a[i]//2))%2 == 0:
        # akの2の約数の数がそろわないので、どんな奇数を掛けても共通のXを作れない
        f = False
if f:
    print((m-lcm_all) // (lcm_all *2 ) +1)
else:
    print(0)

### FIXED CODE ###

from fractions import gcd
n, m = map(int, input().split())
a = list(map(int, input().split()))

def lcm(a, b):
    return a*b // gcd(a, b)
"""
akが偶数だから、bk=2akとして、
bk × (2p + 1)を満たすpが存在すれば良い
2p+1は奇数のため、Xとbkの2の素因数は一致しなければならない
akに含まれる最大の2^kを探す。
"""
if len(a) == 1: lcm_all = a[0]//2
else: lcm_all = lcm(a[0]//2, a[1]//2)
amax = 0
for i in range(1, n):
    lcm_all = lcm(lcm_all, a[i]//2)
    amax = max(amax, a[i]//2)

f = True
if lcm_all > m:
    f = False
for i in range(n):
    if n == 1: break
    if (lcm_all//(a[i]//2))%2 == 0:
        # akの2の約数の数がそろわないので、どんな奇数を掛けても共通のXを作れない
        f = False
if f:
    # amaxの奇数倍でmを超えないもの
    ans = (m // lcm_all + 1)//2
    print(ans)
else:
    print(0)
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.4.3)

import math
import statistics
import numpy as np

n = int(input())
h = list(int(i) for i in input().split())

i = 0
ans = 0
cnt = 0
while i + 1 < n:
  if h[i] >= h[i + 1]:
    cnt += 1
  else:
    if ans < cnt:
      ans = cnt
    cnt = 0
  i += 1

if ans < cnt:
  ans = cnt
print(ans)


### FIXED CODE ###

# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/

import math
import statistics

cnt = 0
s = input()
t = input()
for i in range(3):
  if s[i] == t[i]:
    cnt += 1;
print(cnt)
n = list(int,input())
if n[0] == 7 or n[1] == 7 or n[2] == 7
  print('Yes')
elif:
  print('No')


### FIXED CODE ###

n = input()
if '7' in n:
  print('Yes')
else:
  print('No')
N=int(input())
if N%2==0:
  print(int((N/2)**2)
elif N%2!=0:
  print((N//2)*(N-(N//2)))

### FIXED CODE ###

N=int(input())
if N%2==0:
  print((N//2)**2)
elif N%2!=0:
  print((N//2)*(N-(N//2)))
from collections import deque
import copy
import sys
sys.setrecursionlimit(410000)

INF = 10**6

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

def solve(sy,sx):
  d = [[INF]*w for _ in range(h)]
  que = deque()
  que.append([sx,sy])
  d[sy][sx]=0

  while len(que)>0:
    px,py = que.popleft()

    for dx,dy in ((-1,0),(0,1),(1,0),(0,-1)):
      nx = px + dx
      ny = py + dy

      if (0 <= nx and nx < w and 0<=ny and ny < h) \
          and maze[ny][nx] != '#' \
          and (d[ny][nx] == INF or d[ny][nx] > d[py][px] +1):              
        que.append((nx,ny))
        d[ny][nx] = d[py][px] +1

  return d


maze = copy.deepcopy(org_maze)
f = solve(0,0)

d79 = f[0][w-1]
d71 = f[2][0]
d73 = f[h-1][w-1]

maze = copy.deepcopy(org_maze)
f = solve(0,w-1)
d91 = f[h-1][0]
d93 = f[h-1][w-1]

maze = copy.deepcopy(org_maze)
f = solve(h-1,0)
d13 = f[h-1][w-1]

print(max(d79,d71,d73,d91,d93,d13))

### FIXED CODE ###

from collections import deque
import copy
import sys
#import numpy as np
sys.setrecursionlimit(410000)

INF = 10**6

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

def solve(sy,sx):
  d = [[INF]*w for _ in range(h)]
  for i in range(h):
    for j in range(w):
      if maze[i][j] == '#':
        d[i][j] = -INF          
  
  que = deque()
  que.append([sx,sy])
  d[sy][sx]=0

  while len(que)>0:
    px,py = que.popleft()

    for dx,dy in ((-1,0),(0,1),(1,0),(0,-1)):
      nx = px + dx
      ny = py + dy

      if (0 <= nx and nx < w and 0<=ny and ny < h) \
          and maze[ny][nx] != '#' \
          and (d[ny][nx] == INF or d[ny][nx] > d[py][px] +1):              
        que.append((nx,ny))
        d[ny][nx] = d[py][px] +1

  return d

ans = 0
for sy in range(h):
  for sx in range(w):
    maze = copy.deepcopy(org_maze)
    if maze[sy][sx] == '.':      
      f = solve(sy,sx)      
      for i in range(h):        
        ans = max(ans,max(f[i]))
          
print(ans)
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 = 10 ** 9 + 7
N = 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)


n,a,b=map(int,input().split())
ans=((2**n-1)%(10**9+7)-cmb(n,a,p)-cmb(n,b,p))
print(int(ans))

### FIXED CODE ###

mod=10**9+7
n,a,b=map(int,input().split())
ans=pow(2,n,mod)-1 #n種類の花を使って花束を作る総数は2^n-1通り
comb1=1 #nCaの計算
for i in range(n-a+1,n+1): #n*(n-1)*…*(n-a+1)を計算
 comb1*=i
 comb1%=mod
for i in range(1,a+1): #1/a!=1/(1*2*…*a)=1^(p-2)*2^(p-2)*…*a^(p-2) (p=10**9+7)を計算
 comb1*=pow(i,mod-2,mod)
 comb1%=mod
comb2=1
for i in range(n-b+1,n+1): #n*(n-1)*…*(n-b+1)を計算
 comb2*=i
 comb2%=mod
for i in range(1,b+1): #1/b!=1/(1*2*…*b)=1^(p-2)*2^(p-2)*…*b^(p-2) (p=10**9+7)を計算
 comb2*=pow(i,mod-2,mod)
 comb2%=mod
ans-=(comb1+comb2) #nCa、nCbを総数から引く
ans%=mod
print(ans)
D, N = map(int, input().split())

print(N * 100 ** D)D, N = map(int, input().split())

if N != 100:
    print(N * 100 ** D)
else:
    print((N + 1) * 100 ** D)

### FIXED CODE ###

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

if N != 100:
    print(N * 100 ** D)
else:
    print((N + 1) * 100 ** D)
N = int(input())
A = list(map(int,input().split()))

from functools import reduce
import math

R = reduce(math.gcd,A)

print(int(R))

### FIXED CODE ###

# author:  Taichicchi
# created: 14.09.2020 22:18:44

import sys
from math import gcd

N = int(input())

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

ans = gcd(A[0], A[1])
for i in range(2, N):
    ans = gcd(ans, A[i])

print(ans)
#coding:utf-8

if __name__ == "__main__":
    N = int(input())
    tmp = input().split()
    Hs = []
    for t in tmp:
        Hs.append(int(t))
    total = 0

    for n in range(N):
        n_count = 0
        for i in range(0, n):
            if Hs[i] > Hs[n]:
                break
            n_count += 1
        if n_count == n:
            total += 1
        
    print(total)

### FIXED CODE ###

#coding:utf-8

if __name__ == "__main__":
    A, B = map(int, input().split())
    total = 0
    for n in range(2):
        if A < B:
            total += B
            B = B - 1
        else:
            total += A
            A = A - 1
    
    print(total)
N,W= map(int,input().split())
w=[]
v=[]
for  i in range(N):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)

dp =[ [0]*(N*10) for _ in range(W*10) ]

for i in range(N):
    for  j in range(W+1):
        dp[i+1][j]=dp[i][j]
        if j-w[i]>=0:
            dp[i+1][j]= max(dp[i][j] , dp[i][j-w[i]]+v[i])

print(dp[N][W])

### FIXED CODE ###

N,W= map(int,input().split())
w=[]
v=[]
for  i in range(N):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)

dp =[ [0]*(W+1) for _ in range(N+1) ]

for i in range(N):
    for  j in range(W+1):
        dp[i+1][j]=dp[i][j]
        if j-w[i]>=0:
            dp[i+1][j]= max(dp[i][j] , dp[i][j-w[i]]+v[i])

print(dp[N][W])
inputs = []

for i in range(10000) :
	inputraw = input()
	if inputraw == '0' :
		break
	inputs.append(inputraw)

for i, input in enumerate(inputs) :
	print("Case "+str(i)+": "+ str(input)+"\n"))

### FIXED CODE ###


inputs = []

for i in range(10000) :
	inputraw = input()
	if inputraw == '0' :
		break
	inputs.append(inputraw)

for i, input in enumerate(inputs) :
	print("Case "+str(i+1)+": "+ str(input))
n, m = map(int, input().split())
frac = [1]
for i in range(max(n, m)):
    frac.append(frac[i]*(i+1)%p)
mod = 10**9 + 7
#フェルマーの小定理を用いてcombの計算を行う
def comb(n, k, mod):
    a=frac[n]
    b=frac[k]
    c=frac[n-k]
    return (a * pow(b, mod-2, mod) * pow(c, mod-2, mod)) % mod
print(comb(n, 2, mod) + comb(m, 2, mod))

### FIXED CODE ###

n, m = map(int, input().split())
frac = [1]
p = 10**9 + 7
for i in range(max(n, m)):
    frac.append(frac[i]*(i+1)%p)

#フェルマーの小定理を用いてcombの計算を行う
def comb(n, k, mod):
    a=frac[n]
    b=frac[k]
    c=frac[n-k]
    return (a * pow(b, mod-2, mod) * pow(c, mod-2, mod)) % mod
if n >= 2:
  a = comb(n, 2, p)
else:
  a = 0
if m >= 2:
  b = comb(m, 2, p)
else:
  b = 0
print(a + b)
import sys
n,y = map(int, input().split())

for a in range(n+1):
	for b in range(n+1):
	  if (a * 10000 + b * 5000 + (n-a-b) * 1000 == y):
		print(str(a) + ' ' + str(b) + ' ' + str(c))
		sys.exit()

print('-1 -1 -1')
sys.exit()

### FIXED CODE ###

import sys

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

for a in range(n+1):
	for b in range(n+1-a):
		c = n - a - b
		if (a * 10000 + b * 5000 + c * 1000 == y):
				print(str(a) + ' ' + str(b) + ' ' + str(c))
				sys.exit()
	
print('-1 -1 -1')
sys.exit()
S=input()
Ans="ARC"
if S=="ARC":
  Ans="ABC
print(Ans)

### FIXED CODE ###

S=input()
Ans="ARC"
if S=="ARC":
  Ans="ABC"
print(Ans)
line = input().split()
a = int( line[0] )
b = int( line[1] )
print( a * b, 2 * ( a + b ) )



### FIXED CODE ###

a,b = input().split()
a = int( a )
b = int( b )
print(  a * b, 2 * ( a + b ) )
N = input()
tmp = 0
while N > 0:
    tmp += (N % 10)
    N /= 10
if tmp % 9 == 0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = MAP()
prev = -INF
ans = 0
for a in A:
    if a < prev:
        ans += (prev - a)
    else:
        prev = a
print(ans)
a, b = map(int, input().split())
if a + b == 15:
    ans = '+'
elif a * b == 15:
    ans = '*'
print(ans)

### FIXED CODE ###

a, b = map(int, input().split())
print('+' if a+b==15 else '*' if a*b==15 else 'x')
s = input()
k = int(input())
li = []
for i in range(len(s)):
    for j in range(i+1,len(s)+1):
        li += [s[i:j]]
li2 = set(li)
li3 = sorted(li2)
print(li3[k-1]

### FIXED CODE ###

s = input()
k = int(input())
li = []
for i in range(len(s)):
    for j in range(i+1,len(s)+1):
        if j-i<=6:
            li += [s[i:j]]
li2 = set(li)
li3 = sorted(li2)
print(li3[k-1])
n,i = map(int, input())
print(n-i+1)

### FIXED CODE ###

n,i = map(int, input().split())
print(n-i+1)
n= int(input())
a = int(input())
if n%500 < a:
    print('YES')
else
    print('NO')

### FIXED CODE ###

n = int(input())
a = int(input())
if n % 500 <= a:
  print("Yes")
else:
  print("No")
n = int(input())
s = input()
out = [len(set(s[:i])&set(s[i:])) for i in range(n)]
print(max(out))

### FIXED CODE ###

a, b = map(int, input().split())
print(max(a+b, a-b, a*b))
A,B map(int,input().split())
goukei=3*A+B
print(int(goukei/2))

### FIXED CODE ###

A,B =map(int,input().split())
goukei=3*A+B
print(int(goukei/2))
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
if sum(a)>=sum(b):
    print("No")
else:
    ans=0
    lim=sum(b)-sum(a)
    for i in range(n):
        if a[i]<b[i]:
            ans+=(b[i]-a[i])//2
    if ans>lim:
        print("No")
    else:
        print("Yes")

### FIXED CODE ###

a,b=map(int,input().split())
if a%b==0:
    print(-1)
else:
    print(a)
w = input().split('\n')
valid = False
for i in range(1,len(w))
  if w[i][-1] == w[i+1][0] and len(set(w)) == len(w) 
      vaild = True
  else: 
      vaild = False

print("Yes" if vaild else "NO")


### FIXED CODE ###

# coding: utf-8
 
 
def is_unique(seq):
    return len(seq) == len(set(seq))
 
 
def main():
    n = int(input())
    shiri = True
 
    w = []
    for i in range(n):
        w.append(input())
 
    for i in range(n-1):
        if w[i][-1] != w[i + 1][0]:
            shiri = False
            break
 
    if not is_unique(w):
        shiri = False
 
    if shiri:
        print('Yes')
    else:
        print('No')
 
 
if __name__ == '__main__':
    main()
k=int(())
print("ACL"*k)

### FIXED CODE ###

k=int(input())
print("ACL"*k)
A, B, C, D = [int(s) for s in input().split()]
turn = 0
while A > 0 and C > 0:
  if turn == 0:
    C -= B
    turn = 1
  else:
    A -= D
  	turn = 0
if A > 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

A, B, C, D = [int(s) for s in input().split()]
turn = 0
while A > 0 and C > 0:
  if turn == 0:
    C -= B
    turn = 1
  else:
    A -= D
    turn = 0
if A > 0:
  print("Yes")
else:
  print("No")
a,b,c=map(int,input().split())
if (a*b)%2==0:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

a,b=map(int,input().split())
if (a*b)%2==0:
  print('No')
else:
  print('Yes')
a=list(map,input().split())
k=int(input())
while a[0]>=a[1]:
  k-=1
  a[1]*=2
while a[1]>=a[2]:
  k-=1
  a[2]*=2
if k>=0:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

a=list(map(int,input().split()))
k=int(input())
while a[0]>=a[1]:
  k-=1
  a[1]*=2
while a[1]>=a[2]:
  k-=1
  a[2]*=2
if k>=0:
  print("Yes")
else:
  print("No")
a, b, k = map(int, input().split())

num_list = list(range(a, b+1))

length = len(num_list)

for x in range(min(length, k)):
    print(num_list[x])

for x in range(max(k, length-k), length):
    print(num_list[x])


### FIXED CODE ###

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

for x in range(a, min(b+1, a+k)):
    print(x)

for x in range(max(a+k, b-k+1), b+1):
    print(x)
n,k=map(int,input().split())
burger=[None]*n
burger[0]="P"
for i in range(1,n):
  burger[i]="B"+burger[i-1]+"P"+burger[i-1]+"B"
print(sum(1 for i in burger[-1][:k] if i=="P"))

### FIXED CODE ###

n,x=map(int,input().split())
length=[0]*n;p=[0]*n
length[0]=1
p[0]=1
for i in range(1,n):
  length[i]=length[i-1]*2+3
  p[i]=p[i-1]*2+1
def meat(n,x):
  if n==0:
    return 0 if x<=0 else 1
  elif x<=1+length[n-1]:
    return meat(n-1,x-1)
  elif x==2+length[n-1]:
    return p[n-1]+1
  else:
    return p[n-1]+1+meat(n-1,x-length[n-1]-2)
print(meat(n,x))
H, W = map(int, input().split())
M = (H + W) * 80

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

dp = [[0] * W for _ in range(H)]
dp[0][0] |= (1 << (M - abs(A[0][0] - B[0][0])))

for h in range(H):
    for w, (a, b) in enumerate(zip(A[h], B[h])):
        d = abs(a - b)
        if d == 0:
            continue
        mask = 0
        if h > 0:
            mask |= (dp[h - 1][w] << d)
            mask |= (dp[h - 1][w] >> d)
        if w > 0:
            mask |= (dp[h][w - 1] << d)
            mask |= (dp[h][w - 1] >> d)
        dp[h][w] = mask

state = dp[-1][-1]
nums = []
for digit, b in enumerate(bin(state)[2:][:: -1]):
    if b == '1':
        nums.append(M - digit)
ans = min(abs(n) for n in nums)
print(ans)


### FIXED CODE ###

H, W = map(int, input().split())
M = (H + W) * 80

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

dp = [[0] * W for _ in range(H)]
dp[0][0] = (1 << (M - abs(A[0][0] - B[0][0])))

for h in range(H):
    for w, (a, b) in enumerate(zip(A[h], B[h])):
        d = abs(a - b)
        mask = 0
        if h > 0:
            mask |= (dp[h - 1][w] << d)
            mask |= (dp[h - 1][w] >> d)
        if w > 0:
            mask |= (dp[h][w - 1] << d)
            mask |= (dp[h][w - 1] >> d)
        dp[h][w] |= mask

state = dp[-1][-1]
nums = []
for digit, b in enumerate(bin(state)[2:][:: -1]):
    if b == '1':
        nums.append(digit - M)
ans = min(abs(n) for n in nums)
print(ans)
import math

a, b = map(int, input().split())
count = 0
# a, b = (12, 18)

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


c = make_divisors(a)
d = make_divisors(b)
e = []
for i in c:
    if i in d:
        e.append(i)

print(e)
e.pop(0)
e.sort()

gcd_list = [1]
for i in e:
    count = 0
    for j in gcd_list:
        if math.gcd(i, j) != 1:
            break
        else:
            count += 1
        if count == len(gcd_list):
            gcd_list.append(i)

# for i in range(len(e)):
#     for j in range(i+1, len(e)):
#         if math.gcd(e[i], e[j]) == 1:
#             print(e[i], e[j])
#             count += 1

print(len(gcd_list))


### FIXED CODE ###

import fractions

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


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


c = make_divisors(a)
d = make_divisors(b)
e = []
for i in c:
    if i in d:
        e.append(i)

e.pop(0)
e.sort()

gcd_list = [1]
for i in e:
    count = 0
    for j in gcd_list:
        if fractions.gcd(i, j) != 1:
            break
        else:
            count += 1
        if count == len(gcd_list):
            gcd_list.append(i)

print(len(gcd_list))
N = int(input())
nums = [int(i) for i in input().split()]
LOOP = int(np.log2(N))+1
LOOP_N = N

for _ in range(LOOP):
    is_odd = (LOOP_N%2 == 1)
    LOOP_N = math.ceil(LOOP_N/2)
    nums = [nums[2*i] if (i==LOOP_N-1 and is_odd) else (nums[2*i]+nums[2*i+1])/2  for i in range(LOOP_N)]

print(nums[0])

### FIXED CODE ###

n = int(input())
nums = sorted(map(lambda x: int(x), input().split(' ')))
res = nums[0] / 2**n
for index, num in enumerate(nums):
    res += num / 2**(n - index)
print(res)
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0

for h in range(a +1):
    for i in range(b +1):
        for j in range(c +1):
            if total = h *500 + i *100 + j *50 == x:
                count += 1
print(count)

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0

for h in range(a +1):
    for i in range(b +1):
        for j in range(c +1):
            if h *500 + i *100 + j *50 == x:
                count += 1
print(count)
h,w=map(int,input().split())
data=[list(input()) for i in range(h)]
map1=[[0]*w for i in range(h)]
map2=[[0]*w for i in range(h)]
for i in range(h):
  count=0
  for j in range(w):
    if data[i][j]=="#":
      count=0
    else:
      count+=1
      map1[i][j]=count
  count=0
  for j in range(w):
    if map1[i][-1-j]==0:
      count=0
    else:
      if count==0:count=map1[i][-1-j]
      map1[i][-1-j]=count
for i in range(w):
  count=0
  for j in range(h):
    if data[j][i]=="#":
      count=0
    else:
      count+=1
      map2[j][i]=count
  count=0
  for j in range(h):
    if map2[-j-1][i]==0:
      count=0
    else:
      count=max(map2[-j-1][i],count)
      map2[-j-1][i]=count
ans=0
import numpy
map1=numpy.ndarray(map1)
map2=numpy.ndarray(map2)
map3=map1+map2
print(int(max(map3)-1))

### FIXED CODE ###

h,w=map(int,input().split())
s=[list(input())for _ in range(h)]
score=[[0]*w for _ in range(h)]
ans=0
range_w=range(w)
range_h=range(h)
for i in range_h:
  tmp_1=0
  tmp_2=0
  for j in range_w:
    if s[i][j]=="#":
      tmp_1=0
    else:
      tmp_1+=1
    score[i][j]+=tmp_1
    
    if s[i][-j-1]=="#":
      tmp_2=0
    else:
      tmp_2+=1
    score[i][-j-1]+=tmp_2
    
for j in range_w:
  tmp_3=0
  tmp_4=0
  for i in range_h:
    if s[i][j]=="#":
      tmp_3=0
    else:
      tmp_3+=1
    score[i][j]+=tmp_3
    
    if s[-i-1][j]=="#":
      tmp_4=0
    else:
      tmp_4+=1
    score[-i-1][j]+=tmp_4-3
for i in range(h):
  for j in range(w):
    ans=max(ans,score[i][j])
print(ans)
N=int(input())
A=0
B=0
AB=0
ans=0

for i in range(N):
  s=input()
  for j in range(len(s)-1):
    if s[j]=="A" and s[j+1]=="B":
      ans+=1
      
  if s[0]=="B" and s[-1]=="A":
    AB+=1
  elif s[0]=="B":
    B+=1
  elif s[-1]=="A":
    A+=1
  else:
    continue
  
ans+=min(A,B)
tmp=abs(A-B)

if AB <= tmp:
  ans+=AB
else:
  ans+=AB//tmp*tmp
  ans+=AB%temp
  
print(ans)

### FIXED CODE ###

N=int(input())
A=0
B=0
AB=0
ans=0

for i in range(N):
  s=input()
  for j in range(len(s)-1):
    if s[j]=="A" and s[j+1]=="B":
      ans+=1
      
  if s[0]=="B" and s[-1]=="A":
    AB+=1
  elif s[0]=="B":
    B+=1
  elif s[-1]=="A":
    A+=1
  else:
    continue

if AB==0:
  ans+=min(A,B)
else:
  if A==0 and B==0:
    ans+=(AB-1)
  else:
    ans+=(AB+min(A,B))
    
print(ans)
N=int(input())
S=[input() for i in range (N)]
S.count("ABC")

### FIXED CODE ###

N=int(input())
S=str(input())
print(S.count("ABC"))
x, y = map(int,input().split())
if (x+y)%3!=0:
  print(0)
  exit()
n = (x+y)//3
if 0 > x-n or 0 > y-n:
  print(0)
  exit()

m = min(x-n,y-n)
mod = 1000000007
ans = 1
for i in range(m):
  ans = (ans *(n-i) // i) % mod
print(ans)
  

### FIXED CODE ###

#coding:utf-8
import bisect
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = True



def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    x, y = LMIIS()

    if (x+y)%3!=0:
      print(0)
      exit()
    n = (x+y)//3
    if 0 > x-n or 0 > y-n:
      print(0)
      exit()

    m = min(x-n,y-n)
    mod = 10**9 + 7

    a = 1
    b = 1
    c = 1
    for i in range(1, n+1):
        a = a * i % mod
    for i in range(1, n - m + 1):
        b = b * i % mod
    for i in range(1, m + 1):
        c = c * i % mod
    print(a * pow(b * c, mod - 2, mod) % mod)




if __name__ == '__main__':
    main()
def solve(S):
    if S in ["dream","dreamer","erase","eraser"]:
        return True
    elif len(S) <= 7:
        return False

    if S[0:7] == "dreamer":
        return solve(S[7:]) or solve(S[5:])
    elif S[0:5] == "dream":
        return solve(S[5:])
    if S[0:6] == "eraser":
        return solve(S[6:]) or solve(S[5:])
    elif S[0:5] == "erase":
        return solve(S[5:])

    return False

print("YES" if solve(input()) else "NO")

### FIXED CODE ###

s = input()[::-1]
flag = 1
i = 0
while i < len(s):
    if s[i:i+5] == "maerd" or s[i:i+5] == "esare":
        i += 5
    elif s[i:i+6] == "resare":
        i += 6
    elif s[i:i+7] == "remaerd":
        i += 7
    else:
        flag = 0
        break

print("YES" if flag else "NO")