Harryxun/stf_run huggingface dataset:
H,W=map(int, input().split())
s = []
dx = [ -1, -1, 1, 1]
dy = [ -1, 1, -1, 1]
ans = "Yes"
for i in range(H):
  s.append( input())
for y in range(H):
  for x in range(W):
    if s[y][x] == '#':
      ng = 1
      for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if (ny < 0) or (ny >= H) or (nx<0) or (nx>=W):
          continue
        if s[ny][nx] == '#':
          ng = 0
    if ng == 1:
      ans = "No"
print(ans)
        

  
    

### FIXED CODE ###

H,W=map(int, input().split())
s = []
dx = [  0, 0, 1, -1]
dy = [ -1, 1, 0, 0]
ans = "Yes"
for i in range(H):
  s.append( input())
for y in range(H):
  for x in range(W):
    if s[y][x] == '#':
      ng = 1
      for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if (ny < 0) or (ny >= H) or (nx<0) or (nx>=W):
          continue
        if s[ny][nx] == '#':
          ng = 0
      if ng == 1:
        ans = "No"
print(ans)
N = int(input())
a = []
for i in range(N):
    a.append(input())
    

for i in range(N):
    v = a[i]
    j = i-1
    while j>=0 and a[j]>v:
        a[j+1] = a[j]
        j = j-1
        a[j+1] = v
    print(a)


### FIXED CODE ###

N = int(input())
a = input().split()
b = [int(n) for n in a]


for i in range(N):
    v = b[i]
    j = i-1
    while j>=0 and b[j]>v:
        b[j+1] = b[j]
        j = j-1
        b[j+1] = v
    print(" ".join([str(n) for n in b]))
input()
a = map(int, raw_input().split())

for i in range(length(a), 1):
    print a[i-1],

### FIXED CODE ###

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

a.reverse()
print(" ".join(map(str, a)))
from collections import defaultdict


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

g = defaultdict(list)
for _ in range(m):
    l, r, d = map(int, input().split())
    g[l].append((r, d))
    g[r].append((l, -d))


checked = {}
ds = defaultdict(int)


def check(v):
    if (not (v in ds)):
        ds[v] = 0
    if v in checked:
        return True
    checked[v] = True
    for next_v, d in g[v]:
        if not (next_v in ds):
            ds[next_v] = ds[v] + d
        if not (ds[next_v] - ds[v] == d):
            return False
        elif check(next_v) is False:
            return False
    return True


valid = True
for v in range(1, n + 1):
    if v in checked:
        continue
    valid &= check(v)

if valid:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

import sys

sys.setrecursionlimit(200002)

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

g = [[] for _ in range(n)]
for _ in range(m):
    l, r, d = map(int, input().split())
    l -= 1
    r -= 1
    g[l].append((r, d))
    g[r].append((l, -d))


ds = [None for _ in range(n + 1)]


def check(v):
    for next_v, d in g[v]:
        if ds[next_v] is None:
            ds[next_v] = ds[v] + d
            if check(next_v) is False:
                return False
        elif not (ds[next_v] - ds[v] == d):
            return False
    return True


valid = True
for v in range(n):
    if ds[v] is None:
        ds[v] = 0
    if check(v) is False:
        valid = False
        break

if valid:
    print("Yes")
else:
    print("No")
n = int(input())

import math
max = math.trunc(n**0.5)
for i in range(max:0:-1):
  if n % i == 0:
    j = n / i
    print(i+j-2)
  

### FIXED CODE ###

n = int(input())
 
import math
max = math.trunc(n**0.5)
for i in range(max,0,-1):
  if n % i == 0:
    j = int(n / i)
    print(i+j-2)
    break
import sys
input = sys.stdin.readline

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

compression_dict={a: ind+1 for ind, a in enumerate(sorted(set(A)|set(B)))}
A=[compression_dict[a] for a in A]
B=[compression_dict[a] for a in B]


SA=sorted(A)
SB=sorted(B)

for i in range(N):
    if SA[i]>SB[i]:
        print("No")
        sys.exit()

# BIT(BIT-indexed tree)
LEN=N

BIT=[0]*(LEN+1)# 1-indexedなtree

def update(v,w):# index vにwを加える
    while v<=LEN:
        BIT[v]+=w
        v+=(v&(-v))# 自分を含む大きなノードへ. たとえばv=3→v=4

def getvalue(v):# [1,v]の区間の和を求める
    ANS=0
    while v!=0:
        ANS+=BIT[v]
        v-=(v&(-v))# 自分より小さい2ベキのノードへ. たとえばv=3→v=2へ
    return ANS

for a in A:
    update(a,1)

BIT2=[0]*(LEN+1)# 1-indexedなtree

def update2(v,w):# index vにwを加える
    while v<=LEN:
        BIT2[v]+=w
        v+=(v&(-v))# 自分を含む大きなノードへ. たとえばv=3→v=4

def getvalue2(v):# [1,v]の区間の和を求める
    ANS=0
    while v!=0:
        ANS+=BIT2[v]
        v-=(v&(-v))# 自分より小さい2ベキのノードへ. たとえばv=3→v=2へ
    return ANS

for a in B:
    update2(a,1)

for i in range(N):
    a=A[i]
    b=B[i]

    update(a,-1)
    update2(b,-1)

    #print(getvalue(a),getvalue2(a),getvalue(b),getvalue2(b))

    if getvalue(a)<=getvalue2(a) and getvalue(b)<=getvalue2(b):
        update(a,1)
        update2(b,1)
    else:
        print("Yes")
        sys.exit()

print("No")
        



### FIXED CODE ###

import sys
input = sys.stdin.readline

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

compression_dict={a: ind+1 for ind, a in enumerate(sorted(set(A)|set(B)))}

SA=sorted(A)
SB=sorted(B)

for i in range(N):
    if SA[i]>SB[i]:
        print("No")
        sys.exit()

for i in range(N-1):
    if SB[i]>=SA[i+1]:
        print("Yes")
        sys.exit()

AB=[(B[i],A[i]) for i in range(N)]
AB.sort()

DICT={a:ind for ind,a  in enumerate(SA)}

Group=[i for i in range(N)]# グループ分け.Group[i]=jのときiとjは同じグループ

def find(x):# find(a)=find(b)のとき同じグループ
    while Group[x] != x:
        x=Group[x]
    return x

def Union(x,y):  # xとyが同じグループになるよう更新
    if find(x) != find(y):
        Group[find(y)]=Group[find(x)]=min(find(y),find(x))

for i in range(N):
    _,a=AB[i]

    Union(DICT[a],i)

if len(set([find(i) for i in range(N)]))==1:
    print("No")
else:
    print("Yes")
N, M = map(int, input().split())
ans = 0
if N > 1 and M > 1:
    ans = (N-2) * (M-2)

elif:
    ans = 1
else:
    ans = max(N, M) - 2
print(ans)


### FIXED CODE ###

N, M = map(int, input().split())
ans = 0
if N > 1 and M > 1:
    ans = (N-2) * (M-2)

elif N==1 and M==1:
    ans = 1
else:
    ans = max(N, M) - 2
print(ans)
N=input()
stu=list(map(int,input().split()))
lis=[x for x in range(N)]
for i in range(N):
  for j in range(N):
    if stu[i]==j:
      lis[j-1]=i+1
print(lis)

### FIXED CODE ###

N=int(input())
stu=list(map(int,input().split()))
stu2=list(range(N))
for i in range(N):
    stu2[stu[i]-1]=i+1
print(*stu2,end=' ')
N = int(input())
A = list(map(int, input().split()))
count = [0]*(10**6)
for i in range(N):
    count[A[i]] += 1
    count[A[i+1]] += 1
    count[A[i+2]] += 1
print(max(count))


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
count = [0]*(10**6)
for i in range(N):
    count[A[i]] += 1
    count[A[i]+1] += 1
    count[A[i]+2] += 1
print(max(count))
n = int(input())
a = list(map(int,input().split()))
x = list(set(a))
if len(x) >= 4:
  print("No")
  exit()
if len(x) == 3:
  if x[0]^x[1] == x[2] and 3*a.count[x[0]] == 3*a.count[x[1]] == 3*a.count[x[2]] == n:
    print("Yes")
  else:
    print("No")
  exit()
if len(x) == 2:
  if x[0] == 0 or x[1] == 0 and 2*a.count[x[0]] == 2*a.count[x[1]] == n:
    print("Yes")
  else:
    print("No")
  exit()
if len(x) == 1:
  if x[0] == 0:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
x = list(set(a))
x.sort()
if len(x) >= 4:
  print("No")
  exit()
if len(x) == 3:
  if x[0]^x[1] == x[2] and 3*a.count(x[0]) == 3*a.count(x[1]) == 3*a.count(x[2]) == n:
    print("Yes")
  else:
    print("No")
  exit()
if len(x) == 2:
  if x[0] == 0 and (2*a.count(x[0]) == 2*a.count(x[1]) == n or 6*a.count(x[0]) == 3*a.count(x[1]) == 2*n):
    print("Yes")
  else:
    print("No")
  exit()
if len(x) == 1:
  if x[0] == 0:
    print("Yes")
  else:
    print("No")
n = int(input())
a = list(map(int, input().split()))
a = sort(a)
if a[0] == 0:
  print(0)
else:
  result = 1
  for i in range(n):
    result *= a[i]
    if result > 10^(18):
      print(-1)
      break
    else:
      continue
  else:
    print(result)

### FIXED CODE ###

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

if a.count(0) != 0:
  print(0)
else:
  result = 1
  for i in range(n):
    result *= a[i]
    if result > (10**18):
      print(-1)
      break
    else:
      continue
  else:
    print(result)
h,w=map(int,input().split())
cnt=[0]*26
for i in range(h):
	a=input()
	for j in range(w):
		cnt[ord(a[j])-ord("a")]+=1
cnt.sort(reverse=True)
now=0
for i in range(h//2+w//2):
	if cnt[now]>=4:
		cnt[now]-=4
	else:
		now+=1
	if now==26:
		break
cnt.sort(reverse=True)
if h%2==1 and w%2==1:
	print(2/0)
	if cnt[:3] in ([2,2,1],[4,1],[3,2],[1,0,0]):
		print("Yes")
	else:
		print("No")
elif h%2==0 and w%2==0:
	if cnt[0]==0:
		print("Yes")
	else:
		print("No")
else:
	if cnt[0]==cnt[1]==2 or cnt[0]==4:
		print("Yes")
	else:
		print("No")


### FIXED CODE ###

h,w=map(int,input().split())
cnt=[0]*26
for i in range(h):
	a=input()
	for j in range(w):
		cnt[ord(a[j])-ord("a")]+=1
if h%2==1 and w%2==1:
	f=0
	for i in range(26):
		if cnt[i]%2==1:
			cnt[i]-=1
			break
	four=0
	for i in range(26):
		if cnt[i]>=4:
			four+=cnt[i]//4*4
		elif cnt[i]%2==1:
			f=-1
			break
	if four>=h*w-(h//2+w//2)*2-1 and f==0:
		f=1
	else:
		f=0
elif h%2==0 and w%2==0:
	f=1
	for i in range(26):
		if cnt[i]%4!=0:
			f=0
			break
else:
	if h%2==0:
		h,w=w,h
	two=0;f=0
	for i in range(26):
		if cnt[i]%4==2:
			two+=2
		elif cnt[i]%2==1:
			f=-1
			break
	if two<=w and f==0:
		f=1
	else:
		f=0
print("Yes" if f else "No")
a, b, c = map(int, input().split())
a, b, c.sort()
print "{0} {1} {2}".format(a[0], b[1], c[2])

### FIXED CODE ###

n = list(map(int, input().split()))
n.sort()
print (n[0],n[1],n[2])
def soinsu(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

n=int(input())
a=soinsu(n)
c=[]
if n>=2:
    for i in range(max(a)):
        c.append(0)
for i in a:
    c[i-1]+=1
if n>=2:
    f=max(c)
z=0
g=[1]
d=1
e=1
while e<=f:
    d+=1
    e=d*(d+1)/2
    g.append(e)
l=len(g)
g=tuple(g)
c=tuple(c)
for i in c:
    for j in range(l):
        if i<g[j]:
            z+=j
            break
        
print(z)

### FIXED CODE ###

n=int(input())
import math
s=round(math.sqrt(n))+1

i=2
c1=0
c2=1
ans=0
while i<=s:
    if n%i==0:
        n//=i
        c1+=1
        if c1==c2:
            c1=0
            c2+=1
            ans+=1
    else:
        c2=1
        i+=1
        c1=0
if n>s:
    ans+=1
    
print(ans)
nm = [int(i) for i in input().split()]
n = nm[0]
m = nm[1]
slist = []
clist = []
for i in range(m):
  sc = [int(i) for i in input().split()]
  slist.append(sc[0])
  clist.append(sc[1])

fl = 0
if (n == 1):
  if (slist[0] == 1 and clist[0] == 0):
    print('-1')
    fl = 1

answerlist = ['-1' for i in range(n)]
for (i,s), c in zip(enumerate(slist),clist):
  if (c == 0 and s == 1):
    print('-1')
    break
    fl = 1
  if (answerlist[s-1] != '-1' and answerlist[s-1] != str(c)):
    print('-1')
    break
    fl = 1
  answerlist[s-1] = str(c)
for i in range(n):
  if (answerlist[i]) == '-1':
    if (i == 0):
      answerlist[i] = '1'
    else:
      answerlist[i] = '0'
if fl == 1:
	print("".join(answerlist))

### FIXED CODE ###

nm = [int(i) for i in input().split()]
n = nm[0]
m = nm[1]
slist = []
clist = []

for i in range(m):
  sc = [int(i) for i in input().split()]
  slist.append(sc[0])
  clist.append(sc[1])

fl = 0
if (n == 1):
  if m != 0:
    if (slist[0] == 1 and clist[0] == 0):
      print('0')
      fl = 1
      exit()

answerlist = ['-1' for i in range(n)]
for (i,s), c in zip(enumerate(slist),clist):
  if (c == 0 and s == 1):
    print('-1')
    fl = 1
    exit()
  if (answerlist[s-1] != '-1' and answerlist[s-1] != str(c)):
    print('-1')
    fl = 1
    exit()
  answerlist[s-1] = str(c)
for i in range(n):
  if (answerlist[i]) == '-1':
    if (i == 0):
      if (n == 1):
        answerlist[i] = '0'
      else:
        answerlist[i] = '1'
    else:
      answerlist[i] = '0'
if fl == 0:
	print("".join(answerlist))
n=int(input())
k=int(input())
h = list(map(int, input().split()))
sum = 0
for i in range(0,n):
    if h[i] >= k:
        sum =sum +1
print(sum)

### FIXED CODE ###

n = list(map(int, input().split()))
h = list(map(int, input().split()))
sum = 0
for i in range(0,n[0]):
    if h[i] >= n[1]:
        sum =sum +1
print(sum)
global MOD,facts,inv
MOD = 998244353

def nCr(n,r):
    return ((facts[n] * inv[r]) % MOD) * (inv[n-r] % MOD)

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

facts = [0]*(N+10)
facts[0] = facts[1] = 1
for i in range(2,N+1):
    facts[i] = (facts[i-1] * i) % MOD
inv = [0]*(N+10)
inv[N] = pow(facts[N],MOD-2,MOD)
for i in range(N,0,-1):
    inv[i-1] = (inv[i] * i) % MOD


ans = 0
for i in range(N+1):
    bal = K - (i * A)
    m,f = bal % B,bal // B
    if m == 0 and f + i <= 2*N:
        ans += (nCr(N,i) * nCr(N,f)) % MOD
        
print(ans)

        


### FIXED CODE ###

global MOD,facts,inv
MOD = 998244353

def nCr(n,r):
    global facts,inv
    return (facts[n] * inv[r]) % MOD * inv[n-r] % MOD

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

facts = [0]*(N+10)
facts[0] = facts[1] = 1
for i in range(2,N+1):
    facts[i] = (facts[i-1] * i) % MOD
inv = [0]*(N+10)
inv[N] = pow(facts[N],MOD-2,MOD)
for i in range(N,0,-1):
    inv[i-1] = (inv[i] * i) % MOD

ans = 0
for i in range(N+1):
    bal = K - (i * A)
    m,f = bal % B,bal // B
    if m == 0 and f <= N and f >= 0:
        ans = (ans + (nCr(N,i) * nCr(N,f))) % MOD
        
print(ans)
#239423 29392 39299 394239932
def a(s,i):
    if i = l-1:
        if eval(s)==7:
            return s+"=7"
        return
    a(s+"+"+N[i+1],i+1)
    a(s+"-"+N[i+1],i+1)

N = input()
l = len(N)

print(a(N[0],0))


### FIXED CODE ###

def dfs(i, Str, res):
    if i==3:
        if res==7:
            print(Str+"=7")
            exit()
        return
    
    dfs(i+1,Str+"+"+s[i+1],res+int(s[i+1]))
    dfs(i+1,Str+"-"+s[i+1],res-int(s[i+1]))

s=input()
dfs(0,s[0],int(s[0]))
n,y = map(int,input().split())
	
for s1 in range(n+1):
	for s2 in range(n-s1+1):
		if y== s1*10000+s2*5000+(n-s1-s2)*1000:
			print("{} {} {}".format(s1,s2,s3))
else:
	print("{} {} {}".format(-1,-1,-1))


### FIXED CODE ###

n,y = map(int,input().split())
	
for s1 in range(n+1):
	for s2 in range(n-s1+1):
		if y== s1*10000+s2*5000+(n-s1-s2)*1000:
			print("{} {} {}".format(s1,s2,n-s1-s2))
			exit()
else:
	print("{} {} {}".format(-1,-1,-1))
N=input()
a=list(map(int, input().split()))
b=a
c=1
if c>=N:
	d=a[c]
    b[d]=1
    c+=1
print(b)

### FIXED CODE ###

N=int(input())
a=list(map(int,input().split()))
ans=[0]*N
for i in range(N):
	b=a[i]-1
	ans[b]=i+1
for i in range(N):
	print(ans[i])
a=int(input())
b=int(input())
s=(a-1)*(b-1)
print(s)

### FIXED CODE ###

a,b=(int(i) for i in input().split())
print((a-1)*(b-1))
from sys import setrecursionlimit
setrecursionlimit(1000000)

def permute(a, idx):
    if idx == len(a):
        permutations.append(a[::])
    for i in range(idx, len(a)):
        a[i], a[idx] = a[idx], a[i]
        permute(a, idx + 1)
        a[i], a[idx] = a[idx], a[i]

def doit(a, b, c, idx):
    if (a, b, c, idx) in memo:
        return memo[a, b, c, idx]
    if idx == len(unused):
        return abs(a - needA) + abs(b - needB) + abs(c - needC)
    memo[a, b, c, idx] = min(
        doit(a, b, c, idx + 1),
        doit(a + unused[idx], b, c, idx + 1) + 10,
        doit(a, b + unused[idx], c, idx + 1) + 10,
        doit(a, b, c + unused[idx], idx + 1) + 10
    )
    return memo[a, b, c, idx]

n, needA, needB, needC = map(int, input().split())
a = [int(input()) for _ in range(n)]
ret = float('inf')
memo = {}
for mask in range(1 << n):
    if bin(mask).count('1') != 3:
        continue
    abc = [a[i] for i in range(n) if (mask >> i) & 1]
    unused = [a[i] for i in range(n) if not (mask >> i) & 1]
    permutations = []
    permute(abc, 0)
    for p in permutations:
        ret = min(ret, doit(*p, 0))
print(ret)

### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(1000000)

def permute(a, idx):
    if idx == len(a):
        permutations.append(a[::])
    for i in range(idx, len(a)):
        a[i], a[idx] = a[idx], a[i]
        permute(a, idx + 1)
        a[i], a[idx] = a[idx], a[i]

def doit(a, b, c, idx):
    if (a, b, c, idx) in memo:
        return memo[a, b, c, idx]
    if idx == len(unused):
        return abs(a - needA) + abs(b - needB) + abs(c - needC)
    memo[a, b, c, idx] = min(
        doit(a, b, c, idx + 1),
        doit(a + unused[idx], b, c, idx + 1) + 10,
        doit(a, b + unused[idx], c, idx + 1) + 10,
        doit(a, b, c + unused[idx], idx + 1) + 10
    )
    return memo[a, b, c, idx]

n, needA, needB, needC = map(int, input().split())
a = [int(input()) for _ in range(n)]
ret = float('inf')
for mask in range(1 << n):
    if bin(mask).count('1') != 3:
        continue
    abc = [a[i] for i in range(n) if (mask >> i) & 1]
    unused = [a[i] for i in range(n) if not (mask >> i) & 1]
    permutations = []
    permute(abc, 0)
    for p in permutations:
        memo = {}
        ret = min(ret, doit(p[0], p[1], p[2], 0))
print(ret)
H,W = map(int,input('H W=').split())
S = []
for i in range(H):
    s = list(map(int,input().strip().split()))
    S.append(s)
for i in range(0,H):
    for j in range(0,W):
        if (S[i][j] == '.'):
            count = 0
            for a in range(-1,2):
                for b in range(-1,2):
                    if(0<=i+a<=H-1 and 0<=j+b<=W-1):
                        if(S[i+a][j+b] == '#'):
                            count += 1
            S[i][j] = count
    print(S[i])

### FIXED CODE ###

H,W = map(int,input().split())
S = [[0 for j in range(W)] for i in range(H)]
for i in range(H):
    S[i] = list(input())
for i in range(H):
    for j in range(W):
        if (S[i][j] == '.'):
            count = 0
            for a in range(-1,2):
                for b in range(-1,2):
                    if(0<=i+a<=H-1 and 0<=j+b<=W-1):
                        if(S[i+a][j+b] == '#'):
                            count += 1
            S[i][j] = count
    print(*S[i], sep='')
from typing import List


class Solution:

    def solve(self, N: int, M: int, cakes) -> int:

        sign = []
        for i in [1, -1]:
            for j in [1, -1]:
                for k in [1, -1]:
                    sign.append((i, j, k))

        def sumprod(c, s):
            ret = 0
            for i in range(len(c)):
                ret += c[i] * s[i]
            return ret

        candidates = []
        for s in sign:
            cakes = sorted(cakes, key=lambda c: sumprod(c, s))

            xyz = [0, 0, 0]
            for i in range(M):
                for j in range(3):
                    xyz[j] += cakes[i][j]

            candidates.append(
                sum([abs(xyz_) for xyz_ in xyz])
            )

        return max(candidates)


if __name__ == '__main__':

    # standard input
    N, M = map(int, input().split())
    cakes = []
    for i in range(N):
        cakes.append(tuple(map(int, input().split())))

    # solve
    solution = Solution()
    print(solution.solve(N, M, cakes))


### FIXED CODE ###

class Solution:

    def solve(self, N: int, M: int, cakes) -> int:

        sign = []
        for i in [1, -1]:
            for j in [1, -1]:
                for k in [1, -1]:
                    sign.append((i, j, k))

        def sumprod(c, s):
            ret = 0
            for i in range(len(c)):
                ret += c[i] * s[i]
            return ret

        candidates = []
        for s in sign:
            cakes = sorted(cakes, key=lambda c: sumprod(c, s))

            xyz = [0, 0, 0]
            for i in range(M):
                for j in range(3):
                    xyz[j] += cakes[i][j]

            candidates.append(
                sum([abs(xyz_) for xyz_ in xyz])
            )

        return max(candidates)


if __name__ == '__main__':

    # standard input
    N, M = map(int, input().split())
    cakes = []
    for i in range(N):
        cakes.append(tuple(map(int, input().split())))

    # solve
    solution = Solution()
    print(solution.solve(N, M, cakes))
A, B, C =map(int,input().shape())
if A+B+C >=22:
  print('bust')
else:
  print('win')

### FIXED CODE ###

A, B, C =map(int,input().split())
if A+B+C >=22:
  print('bust')
else:
  print('win')
n = int(input())
    P = list(map(int, input().split()))     
     
    ans = 0
    for i in range(1, n-1):
        if P[i-1] < P[i] < P[i+1] or P[i+1] < P[i] < P[i-1]:
            ans += 1
     
    print(ans)
    

### FIXED CODE ###

n = int(input())
P = list(map(int, input().split(' ')))

ans = 0
for i in range(1, n-1):
    if P[i-1] < P[i] < P[i+1] or P[i+1] < P[i] < P[i-1]:
        ans += 1

print(ans)
A,B,C,D=map(int,input().split())
print(map(A*B,C*D))

### FIXED CODE ###

A,B,C,D=map(int,input().split())
print(max(A*B,C*D))
n = int(input())
l = [int(input()) for _ in range(n)] + [0]
p = [0]
for i in range(n):
  if l[i] != l[i+1]:
    p.append(l[i])
lp = len(p)
l = [0]*lp
l[0] = 1
d = dict()
for i in range(1,lp):
  l[i] = l[i-1]
  if p[i] in d:
    l[i] += l[p[i]]
  d[p[i]] = i
print(l[-1])

### FIXED CODE ###

n = int(input())
oth = [int(input()) for _ in range(n)]
mod = 10**9 + 7
l = list()
for x in oth:
    if l and l[-1] == x:
        continue
    l.append(x)
lenl = len(l)
last = [-1] * 200001
l2 = [-1] * 200001
for i, a in enumerate(l):
    l2[i] = last[a]
    last[a] = i

dp = [0] * lenl
dp[0] = 1
for i in range(1, lenl):
    prev = 0 if l2[i] < 0 else dp[l2[i]]
    dp[i] = (dp[i - 1] + prev) % mod
print(dp[-1])
n = int(input())
numbersA = input().split()
numbersB = input().split()
diff = []
plusTotal = 0
minousTotal = 0

for i in range(0,n):
	diff.append((int(numbersB[i]) - int(numbersA[i])))
	if diff[i] < 0:
		minousTotal += diff[i]
	else:
		plusTotal += diff[i] // 2


print(plusTotal)

if plusTotal >= abs(minousTotal):
	print("Yes")
else:
	print("No")

### FIXED CODE ###

inp = input().split()

i = 1
x = 0

while i <= pow(10,18):
	if inp[0] == "1" and inp[1] == "1":
		print(-1)
		x = 1
		break
	if i % int(inp[0])  == 0 and i % int(inp[1]) != 0:
		print(i)
		x = 1
		break
	i *= int(inp[0])

if x == 0:
	print(-1)
import sys

argv = sys.argv
a = []

P = int(argv[0])
Q = int(argv[1])
R = int(argv[2])

a.append(P)
a.append(Q)
a.append(R)
max = 0
for i in a:
    if max < i:
        max = i

print(sum(a)-max)

### FIXED CODE ###

import sys

a = []


P, Q, R=map(int, input().split())
a.append(P)
a.append(Q)
a.append(R)
max = 0
for i in a:
    if max < i:
        max = i

print(sum(a)-max)
l = list(map(int,input().split()))

if l[1] == 0:
    ans = 0
else:
    q, mod = divmod(l[0], (l[1]+l[2]))
    qq, modd = divmod(mod, l[1])
    if qq == 0 :
        ans = l[1] * q + modd
    else:
        ans = l[1] * (q + qq)

print(ans)

### FIXED CODE ###

S = input()
a,b,c = list(S)

if a == b == c:
    print('No')
else:
    print('Yes')
import itertools
N, M, Q = map(int,input().split())
abcd_list = []
for i in range(Q):
    abcd_list.append(list(map(int,input().split())))

num_lis = []
for i in range(M+1):
    num_lis.append(i)

point_list = []
for A in itertools.permutations(num_lis,N):
    A = sorted(list(A))
    point = 0
    for abcd in abcd_list:
        if A[abcd[1]-1] - A[abcd[0]-1] == abcd[2]:
            point += abcd[3]
    point_list.append(point)

print(max(point_list))


### FIXED CODE ###

import itertools
N, M, Q = map(int,input().split())
abcd_list = []
for i in range(Q):
    abcd_list.append(list(map(int,input().split())))

ans = 0
for A in itertools.combinations_with_replacement(range(1, M+1), N):
    A = sorted(list(A))
    point = 0
    for abcd in abcd_list:
        if A[abcd[1]-1] - A[abcd[0]-1] == abcd[2]:
            point += abcd[3]
    if point > ans:
        ans = point

print(ans)
grid=[[int(i) for i in input().split()]for i in range(i)]
print(grid[0]*grid[1]/2)

### FIXED CODE ###

a = list(int(i) for i in input().split())
print(a[0]*a[1]//2)
L, R = map(int, input().split())
R = min(R, L+2019)
print(min([i * j % 2019 for i in range(L, R+1) for jj in range(i+1, R+1)]))


### FIXED CODE ###

L, R = [int(i) for i in input().split()]
if R - L < 2019:
    print(min([(i * j) % 2019 for i in range(L, R) for j in range(L + 1, R + 1)]))
else:
    print(min([(i * j) % 2019 for i in range(L, L + 2019) for j in range(L, L + 2019)]))