peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
def resolve():
    D = int(input())
    cost = list(map(int, input().split()))
    sat = [list((map(int, input().split()))) for _ in range(D)]
    last = [0]*26

    for i in range(D):
        maxcost = 0
        ans = 0
        for j in range(26):
            if maxcost <= sat[i][j]:
                ans = j+1
                maxcost = sat[i][j]
        print(ans)
resolve()
# Judge status: Wrong Answer
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == "red":
    A -= 1
else:
    B -= 1

print(A, B)
# Judge status: Accepted
a, b, c = map(int, input().split())

for i in range(b):  # あまりのパターンがb個しかない
    if a * (i + 1) % b == c:
        print('YES')
        exit(0)

print('NO')
# Judge status: Accepted
a, b, c = map(int, input().split())

if b-a == c-b:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
X, K, D = map(int, input().split())
X = abs(X)
n = X//D
if K < n:
    print(X-K*D)
else:
    if (n-K) % 2 == 0:
        print(X-n*D)
    else:
        print(abs(X-(n+1)*D))
# Judge status: Wrong Answer
n,d=map(int,input().split())
lists=[list(map(int,input().split())) for x in range(n)]
answer=0
for i in range(1,n):
  for j in range(i+1,n+1):
    for y in range(d):
      count=0
      count+=(lists[j-1][y]-lists[i-1][y])**2
      t=count**(1/2)
      if t.is_integer():
        answer+=1
print(answer)
# Judge status: Accepted
sx, sy, tx, ty = map(int, input().split())

X = tx-sx
Y = ty-sy

print('R'*X+'U'*Y+'L'*X+'D'*Y+'D'+'R'*(X+1) +
      'U'*(Y+1)+'L'+'U'+'L'*(X+1)+'D'*(Y+1)+'R')
# Judge status: Accepted
def solve(n, ABC):
    dp = [[0] * n for _ in range(3)]
    dp[0][0], dp[1][0], dp[2][0] = ABC[0]
    for i in range(1, n):
        for j in range(3):
            dp[j][i] = max(dp[(j + 1) % 3][i - 1], dp[(j + 2) % 3][i - 1]) + ABC[i][j]
    return max(dp[0][n - 1], dp[1][n - 1], dp[2][n - 1])

_n = int(input())
_ABC = [list(map(int, input().split())) for _ in range(_n)]
print(solve(_n, _ABC))
# Judge status: Wrong Answer
import math
from sys import *
inp=stdin.readline

zip=zip 
def linp(x):
    return list(map(int,x.split()))
def minp(x):
    return map(int,x.split())

n,m=minp(inp())
a=linp(inp())
an=sum(a)-n
if an>=0:
    print(an)
else:
    print("-1")
# Judge status: Wrong Answer
N = int(input())
ln = list(map(int, input().split()))
total = 0
ln = sorted(ln, reverse = True)
print(sum(ln[:-1]))
# Judge status: Accepted
S = input()
S = sorted(S)
if S[0] == S[1] and S[1] != S[2] and S[2] == S[3]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))

import fractions
from functools import reduce

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

print (gcd_list(A))
# Judge status: Accepted
# しゃくとり

mod = 10**9 + 7

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

cnt = 0
sum_ = sum(range(n + 1))
#print("sum", sum_)
#print(list(range(n + 1)))
max_ = sum(range(n - k + 1, n + 1))
min_ = sum(range(k))
for i in range(k, n+2):
    #print(max_, min_, cnt)
    cnt += max_ - min_ + 1
    cnt %= mod
    #print(cnt)
    
    if n > i + 1:
        max_ +=  n - i
    else:
        max_ = sum_
    min_ += i
print(cnt)
# Judge status: Accepted
s = input()
s=s.replace("hi", "")
print("Yes" if s=="" else "No")
# Judge status: Accepted
S = input()
S = list(S)

if (S[2] == S[3]) and (S[4] == S[5]):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N = input().split()
for a in range(len(N)):
    N[a] = int(N[a])

if N[1]/N[0] <= 500:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
s = str(input())
  
alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
f = ''
 
for i in range(len(s)):
    for j in range(26):
        if s[i] == alp[j]:
            f += alp[j]
print(f)
# Judge status: Accepted
x=1000
for a,b in zip(a:=[*map(int,[*open(0)][1].split())],a[1:]):x+=x//a*(b-a)*(a<b)
print(x)
# Judge status: Wrong Answer
N = int(input())
a = list(map(int, input().split()))
count = 1
broke = 0
suceed = False
while True:
    if count in a:
        suceed = True
        broke += a.index(count)
        a = a[a.index(count) + 1:]
        count += 1
    else:
        break
if suceed:
    print(broke)
else:
    print(-1)
# Judge status: Wrong Answer
# C - pushpush
N = int(input())
a = list(map(int,input().split()))
a = sorted(a)

S = sum(a)
lst = [0]*N

x = 0
y = 0

for i in range(N):
    x = sum(a[0:i])
    y = S - x
    lst[i] = abs(x-y)
lst.pop(0)

ans = min(lst)
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")
# Judge status: Accepted
N, D = map(int, input().split())
c = 0
for i in range(N):
    x, y = map(int, input().split())
    if (x*x+y*y <= D*D):
        c = c + 1
print(c)
# Judge status: Accepted
N = int(input())
L = list("abcdefghijklmnopqrstuvwxyz")
a = 1
while N > 26**a:
    N = N - 26**a
    a += 1
 
pre = []
for i in reversed(range(1,a)):
    r = (N-1) // 26**i
    pre.append(r)
    N = int(N%(26**i))
 
ans = ''
for i in pre:
    ans += L[i]
print(ans+L[N-1])
# Judge status: Wrong Answer
#135 b
n=int(input())
p=list(map(int,input().split()))
ans="NO"
cnt=0
for i in range(n):
    if p[i]!=(n-i):
        cnt+=1
if cnt==2:
    ans="YES"
print(ans)
# Judge status: Wrong Answer
a=int(input())
b=input()
if a>=3200:
  print('red')
else:
  print('pink')
# Judge status: Wrong Answer
s = input()
t = input()
ans = 0
for i in range(len(s)-len(t)+1):
    m = 0
    for j, k in zip(s[i:],t):
        if j==k:
            m += 1
    if m > ans:
        ans = m
print(ans)
# Judge status: Wrong Answer
S_list = list(map(int,input("入力：").split()))

r, g, b = S_list[0], S_list[1], S_list[2]
if (10 * g + b) % 4 == 0 :
    result = "Yes"
else:
    result = "No"
print(result)
# Judge status: Accepted
# ~10m AC
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, a, b = LI()

min_s = a * (n - 1) + b
max_s = a + (n - 1) * b
ans = max_s - min_s + 1
if ans < 0:
    ans = 0
print(ans)
# Judge status: Wrong Answer
import math

def keta(s):
    if len(s) < 2:
        return int(s)
    n = sum(map(int, s))
    return keta(str(n))

def main():
    N = input()
    
    if keta(N) == 9:
        print("Yes")
    else:
        print("No")



if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
s = input()
print(str.swapcase(s))
# Judge status: Accepted
sLst, tLst = list(input()), list(input())
sLst.sort()
tLst.sort(reverse=True)

sd = ''.join(sLst)
td = ''.join(tLst)

if sd < td:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
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+gcd(i,j,l)
print(a)
# Judge status: Wrong Answer
a = sorted(list(map(int, input().split())))
print(max(
  a[0] * a[1], a[-2] * a[-1]
))
# Judge status: Accepted
n = int(input())
x = n//1000
if n % 1000:
  x += 1
print(1000*x - n)
# Judge status: Wrong Answer
a,b=map(int, input().split())
if (a-b)%2==0:
  print((a+b)/2)
else:
  print('IMPOSSIBLE')
# Judge status: Accepted
# -*- coding: utf-8 -*-
n = int(input())
print('Yes' if n in {i*j for i in range(10) for j in range(10)} else 'No')
# Judge status: Wrong Answer
# 

n = int(input())
l = [int(x) for x in input().split()]
i =0
while len(l) >= 2:
    l.sort()
    a = l.pop(i)
    b = l.pop(i)
    c = (a + b) / 2
    l.append (c)

print(l)
# Judge status: Accepted
n,m = map(int,input().split())
sc = [input() for _ in range(m)]
ans = -1

start = 10**(n-1)
if n == 1:
    start = 0

for i in range(start,10**n):
    i = str(i)
    ok = 0
    
    for j in sc:
        s,c = j.split()
        
        if i[int(s)-1] == c:
            ok += 1
        
    if ok == m:
        ans = int(i)
        break
        
print(ans)
# Judge status: Accepted
S = input()

if S == 'ABC':
  print('ARC')
else:
  print('ABC')
# Judge status: Wrong Answer
s = input()
for i in range(len(s)):
  if i%2 == 0:
    if s[i] != "h":
      print("No")
      exit()
  else:
    if s[i] != "i":
      print("No")
      exit()
print("Yes")
# Judge status: Wrong Answer
(n, m, x, y) = map(int, input().split())
rightx = max(map(int, input().split()))
lefty = min(map(int, input().split()))

if rightx < min(y, lefty):
  print('No War')
else:
  print('War')
# Judge status: Accepted
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
A,B=[0],[0]
for i in range(n):
    A.append(A[i]+a[i])
for i in range(m):
    B.append(B[i]+b[i])
ans,j = 0,m
for i in range(n+1):
    if A[i]>k:
        break
    while B[j] >k-A[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)
# Judge status: Wrong Answer
s = int(input())
if s <= 2:
  print(0)
lst = []
counter = 0
for i in range(3, s+1):
    if s == i:
        lst.append([])
        lst[counter].append(i)
    if s - i > 2:
      lst.append([])
      lst[counter].append(i)
      lst[counter].append(s-i)
      counter += 1
    
print(len(lst))
# Judge status: Wrong Answer
import math
from functools import reduce

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

K = int(input())
cnt = 0

for k_1 in range(K+1):
  for k_2 in range(K+1):
    for k_3 in range(K+1):
      cnt = cnt + gcd(k_1,k_2,k_3)

print(cnt)
# Judge status: Accepted
#!/usr/bin/env python3
#ABC101 C

import math

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

print(math.ceil((N-1)/(K-1)))
# Judge status: Accepted
def main():
    n,k=map(int,input().split())
    h=sorted(list(map(int,input().split())))
    if k>=n:
        print(0)
    else:
        for i in range(k):
            _=h.pop(-1)
        print(sum(h))
    
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import sys
import math


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, m = inintm()

ans = 0

if m - n*2 > 0:
    ans += n
    m -= n*2
elif m - n*2 == 0:
    print(n)
    exit()
else:
    if m % 2 == 0:
        print(m)
        exit()
    else:
        print(m-1)
        exit()

ans += m//4

print(ans)
# Judge status: Wrong Answer
t=""
for i in input():
    if i=="B":
        t=t[:-1]
    else:
        t+=i
    print(t)
# Judge status: Accepted
N, M = map(int, input().split())
stores = [list(map(int, input().split())) for _ in range(N)]

stores.sort()
total = 0
i = 0
while True:
    if total >= M:
        i -= 1
        break
    total += stores[i][1]
    i += 1

ac = 0
k_count = 0
j = 0
while not j > i:
    if j == i:
        ac += stores[j][0] * (M-k_count)
    else:
        ac += stores[j][0] * stores[j][1]
    k_count += stores[j][1]
    j += 1

print(ac)
# Judge status: Accepted
import collections
N = int(input())
A = list(map(int,input().split()))
Cn_A = collections.Counter(A)
ans_list = [0]*len(Cn_A)
ans = 0
for i,j in enumerate(Cn_A.values()):
    ans+=j*(j-1)//2
for i in A:
    j = Cn_A[i]
    print(ans-(j*(j-1)//2)+((j-1)*(j-2)//2))
# Judge status: Accepted
n, m, x = map(int, input().split())
a = [[int(i) for i in input().split(" ")] for j in range(n)]
mi = 10**7

for i in range(1, 2**n):
    te = [0]*m
    bi = bin(i+2**n)[3:]
    c = 0
    for j in range(n):
        if bi[j] == "0":
            continue
        te = [x+y for x, y in zip(te, a[j][1:])]
        c += a[j][0]
    if sum([1 for i in te if i >= x]) == m:
        mi = min(mi, c)
if mi == 10**7:
    print(-1)
else:
    print(mi)
# Judge status: Accepted
def invr():
    return(map(int, input().split()))


n, k = invr()
arr = []
d = dict()
for i in range(n):
    a, b = invr()
    if a in d:
        d[a] += b
    else:
        d[a] = b
        arr.append(a)
arr = sorted(arr)
pos = 0
for i in arr:
    pos += d[i]
    if pos >= k:
        print(i)
        break
# Judge status: Wrong Answer
N,D=[int(x) for x in input().rstrip().split()]
 
l=[]
for i in range(N):
  X=[int(x) for x in input().rstrip().split()]
  l.append(X)
 
ans=0
for i in range(N):
  ni=l[i]
  for j in range(i+1,N):
    nj=l[j]
    now=0
    for s in range(D):
      now+=(ni[s]-nj[s])**2
    now=now**0.5
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

n1 = sum([1 if A % 2 != 0 else 0 for A in a])
n4 = sum([1 if A % 4 == 0 else 0 for A in a])
n2 = N - n1 - n4

if n2 > 0:
    if n4 >= n1:
        print("Yes")
    else:
        print("No")
else:
    if n4 >= n1 - 1:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n==0:
    print(x)
    exit()


for i in range(100):
    num = x-i
    if num not in p:
        print(num)
        exit()
    num = x+i
    if num not in p:
        print(num)
        exit()
# Judge status: Accepted
N = int(input())
for i in range(1,100):
    if i*1000 >= N:
        print((i*1000)-N)
        break
# Judge status: Wrong Answer
N, M = map(int, input().split())
X, Y = [], []

for _ in range(M):
    x, y = map(int, input().split())
    X.append(x - 1)
    Y.append(y - 1)

red = [0] * N
red[0] = 1
ball = [1] * N

for x, y in zip(X, Y):
    if red[x] == 1 and ball[x] != 0:
        red[y] = 1
        if ball[x] == 1:
            red[x] = 0
        ball[x] -= 1
        ball[y] += 1

print(sum(red))
# Judge status: Wrong Answer
def resolve():
  S_string = input()

  if len(S_string) < 4:
    print("0")

  count = 0
  d_start = 4
  d_end = len(S_string)

  for i in range(0, len(S_string) - 3):
    for d in range(d_start, d_end + 1 - i ):
      # print(int(S_string[i: i + d]))
      if (int(S_string[i: i + d])%2019==0):
        count += 1
  print(count)

if __name__ == "__main__":
  resolve()
# Judge status: Wrong Answer
N = int(input())
N_List = sorted(list(map(int,input().split())))
ct = 0
for i in range(1,N-1):
    if (N_List[i] >= N_List[i-1]) & (N_List[i] <= N_List[i+1]):
        ct += 1

print(ct)
# Judge status: Accepted
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    ans = (N-1) * N // 2
    print(ans)
if __name__ == "__main__":
    main()
# Judge status: Accepted
# https://atcoder.jp/contests/abc083/tasks/arc088_a
X, Y = map(int, input().split())
s = X
count = 1
while s <= Y:
    s *= 2
    count += 1
print(count-1)
# Judge status: Accepted
a,b,c=map(int,input().split())
k=int(input())
temp=max(a,b,c)
for i in range(k):
  temp=temp*2
print(a+b+c+temp-max(a,b,c))
# Judge status: Accepted
class Culuculation():
  N = 0
  K = 0
  H = []
  
  #初期化。ここで引数も受け取る
  def __init__(self):
    self.N, self.K = ( int(x) for x in input().split(' '))
    self.H = [int(x) for x in input().split(' ')]

  #計算処理
  def culc(self):
    self.H.sort(reverse=True)
    if self.N >= self.K:
      del self.H[0:self.K]
    else:
      self.H.clear()
    print(sum(self.H))

def main():
  tmp = Culuculation()
  tmp.culc()

if __name__=='__main__':
  main()
# Judge status: Wrong Answer
N,K=map(int,input().split())
A = map(int, input().split())

count=0
for a in A:
  if a>K:
    count+=1

print(count)
# Judge status: Wrong Answer
from math import factorial
n, m = map(int,input().split())
if abs(n-m) >=2:
    print(0)
elif abs(n-m) == 1:
    print((factorial(n)*factorial(m)) % int(1e9)+7)
else:
    print((factorial(n)*factorial(m)*2) % (int(1e9)+7))
# Judge status: Accepted
import math

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

remainders = [a%2 for a in A]

odd = remainders.count(1)
even = remainders.count(0)

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

ans = 0
for n in range(N+1):
  for p in range(P,n+1,2):
    if odd >= p and even >= n-p:
      ans += combinations_count(odd,p) * combinations_count(even,n-p)

print(ans)
# Judge status: Accepted
n,x=map(int,input().split())
a=sorted(list(map(int,input().split())))
for i in range(n):
    x-=a[i]
    if x<0:
        break
    else:
        if x==0:
            i+=1
print(i)
# Judge status: Accepted
A = int(input())
B = int(input())
ans = A+B
if ans == 3:
  print(3)
elif ans == 4:
  print(2)
else:
  print(1)
# Judge status: Wrong Answer
t = int(input())

c1, c2, c3, c4 = 0, 0, 0, 0
for i in range(t):
	s = input()
	if s == 'AC':
		c1 += 1
	elif s == 'TLE':
		c2 += 1
	elif s == 'WA':
		c3 += 1
	else:
		c4 += 1
print('AC *', c1)
print('WA *', c3)
print('TLE *', c2)
print('RTE *', c4)
# Judge status: Accepted
from collections import Counter

N = int(input())
A = list(input().split())
A = [int(A[i])for i in range(N)]
A_count = list(Counter(A).most_common())

rectangle = sorted([A_count[i][0] for i in range(len(A_count)) if A_count[i][1] >= 2],reverse=True)
square = sorted([A_count[i][0] for i in range(len(A_count)) if A_count[i][1] >= 4], reverse=True)

S_rec = (rectangle[0] * rectangle[1] if len(rectangle) >= 2 else 0)
S_squ = (square[0] ** 2 if len(square) >= 1 else 0)

print(max(S_rec, S_squ))
# Judge status: Wrong Answer
start="a"
n=int(input())
ans=[]

def dfs(string,n):
    if len(string)==n:
        print(string)
    else:
        s=string
        for i in range(97,max([ord(j)for j in string])+2):
            dfs(string+chr(i),n)
        

dfs(start,n)
print(len(ans))
for i in ans:
    print(i)
# Judge status: Accepted
N,K = map(int,input().split())
ans=0

for i in range(1,N+1):
    p=1
    sc=i
    cnt=0
    while 1<=sc<=K-1:
        cnt +=1
        p /=2
        sc *=2
    #print(i,cnt,p/N)
    ans += p/N
print(ans)
# Judge status: Accepted
a, b, m = map(int,input().split())
a_l = list(map(int,input().split()))
b_l = list(map(int,input().split()))
xyc = []
for _ in range(m):
    xyc.append(list(map(int,input().split())))

ans = min(a_l) + min(b_l)
for x, y, c in xyc:
    ans = min(ans, a_l[x-1]+b_l[y-1]-c)

print(ans)
# Judge status: Accepted
s = input()
ans = []
for i in s:
    if i == "0" or i == "1":
        ans.append(i)
    else:
        if ans:
            ans.pop()
print("".join(ans))
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
dp=l.copy()
for i in range(n-1):

	dp1=dp.copy()
	l=list(map(int,input().split()))
	for j in range(3):
		ans=float('-inf')
		for k in range(3):
			if(j!=k):
				ans=max(ans,l[j]+dp[k])
		dp1[j]=ans
	dp=dp1.copy()
print(max(dp))
# Judge status: Accepted
import sys

a, b = map(int, input().split())
for i in range(1251):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        print(i)
        sys.exit()
print(-1)
# Judge status: Wrong Answer
N, L = map(int, input().split())

s = []
for i in range(N):
    s.append(input())

s.sort()

print(s)

print(''.join(s))
# Judge status: Accepted
N = int(input())
S = input()

west = [0]*N
east = [0]*N

tmp = 0
for i in range(1,N):
    if S[i-1] == 'W':
        tmp += 1
        west[i] = tmp
    else:
        west[i] = tmp

tmp = 0
for i in range(N-2,-1,-1):
    if S[i+1] == 'E':
        tmp += 1
        east[i] = tmp
    else:
        east[i] = tmp

ans = float('inf')
for i in range(N):
    ans = min(ans,west[i]+east[i])
print (ans)
# Judge status: Wrong Answer
import collections
n=int(input())
a=list(map(int,input().split()))
l=[0]*(n+1)
ans=0
for i in range(n):
    l[a[i]]+=1
for j in range(n):
    if l[j]>1:
        ans+=(l[j])*(l[j]-1)//2
for k in range(n):
    s=l[a[k]]
    if s<2:
        print(ans)
    else:
        print(ans-(s+1)*s//2+s*(s-1)//2)
# Judge status: Wrong Answer
a = int(input())

a = a + a^2 + a^3
# Judge status: Accepted
def dfs(i, f, result):
    if i == l - 1:
        if result == 7:
            print(f + '=7')
            exit()
    else:
        dfs(i + 1, f + '-' + s[i + 1], result - int(s[i + 1]))
        dfs(i + 1, f + '+' + s[i + 1], result + int(s[i + 1]))


s = input()
l = len(s)

dfs(0, s[0], int(s[0]))
# Judge status: Accepted
import math
N = int(input())
Min = 1e12
for a in range(1, int(math.sqrt(N)) + 1):
    if (N % a) == 0:
        Min = min(Min, a + N//a - 2)
print(Min)
# Judge status: Accepted
import math
n,d=map(int,input().split())
l=[]
x=[]
c=0
for i in range(n):
    l.append(list(map(int,input().split())))
    
for i in range(n-1):
    for j in range(i+1,n):
        for k in range(d):
            x.append(abs(l[i][k]-l[j][k])**2)
        if math.sqrt(sum(x))%1==0:
            c+=1
        x=[]
print(c)
# Judge status: Wrong Answer
N,A,B,C,D=map(int, input().split())
S=input()
if S.find("##", A, B)<0 and S.find("##", C, D)<0:
    if C<D:
        print("Yes")
    else:
        if S.find("...", B-2, D+2)>=0:
            print("Yes")
        else:
            print("No")
else:
    print("No")
# Judge status: Accepted
s,f=input()[::-1],-1
while f<0:
    if s:
        if s[:5]=='maerd':
            s=s[5:]
        elif s[:5]=='esare':
            s=s[5:]
        elif s[:6]=='resare':
            s=s[6:]
        elif s[:7]=='remaerd':
            s=s[7:]
        else:
            f=0
    else:
        f=1
print(['NO','YES'][f])
# Judge status: Wrong Answer
# n = int(input())
l, r, d = map(int, input().split())
# l = list(map(int, input().split()))
# if (r-l)%d == 0:
#     print((r-l)//d)
# else:
#     print((r-l)//d + 1)

print((r-l+1)//d)
# Judge status: Accepted
n = input()
if int(n[0]) < int(n[1]):
    print(str(int(n[0]) + 1) * 3)
elif int(n[0]) == int(n[1]) and int(n[0]) < int(n[2]):
    print(str(int(n[0]) + 1) * 3)
else:
    print(str(int(n[0])) * 3)
# Judge status: Accepted
N,A,B=map(int,input().split())
H=0
K=0
S=input()
for i in range(N):
	if S[i]=="a":
		if K<A+B:
			print("Yes")
			K+=1
		else:
			print("No")
	elif S[i]=="b":
		if K<A+B:
			if H<B:
				print("Yes")
				H+=1
				K+=1
			else:
				print("No")
		else:
			print("No")
	elif S[i]=="c":
		print("No")
# Judge status: Accepted
import math
n, m = map(int, input().split())
a = []
for i in range(n):
    l = list(map(int, input().split()))
    a.append(l)
a.sort(key=lambda x: x[0])
sum = 0
cnt = 0
for i in range(n):
    if cnt + a[i][1] >= m:
        sum += (m-cnt)*a[i][0]
        cnt += m-cnt
        break
    else:
        sum += a[i][0]*a[i][1]
        cnt += a[i][1]
print(sum)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

s = input().rstrip()
n = len(s)

t = s[0:(n-1)//2]
q = s[(n+2)//2:n]

if s == s[::-1] and t == t[::-1] and q == q[::-1]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(1,n-2):
    if p[i-1]<p[i]<p[i+1]:
        ans+=1
    else :
        ans+=0
print(ans)
# Judge status: Accepted
M=10**9+7
n=int(input())
a=list(map(int, input().split()))
def f(x, y):
  while y: x,y=y,x%y
  return x
l,r=a[0],1
for i in range(1,n):
  g=f(l,a[i])
  s,t=l//g,a[i]//g
  l,r=s*t*g,(r*t+s)%M
print(r)
# Judge status: Accepted
import numpy as np
from numba import njit, i8

n, k = map(int, input().split())
arr = np.array(list(map(int, input().split())))


@njit(i8[:](i8, i8, i8[:]), cache=True)
def solve(n, k, arr):
    for i in range(min(k, 50)):
        tmp_arr = np.zeros(n + 2, np.int64)
        for i, power in enumerate(arr):
            tmp_arr[max(0, i - power + 1)] += 1
            tmp_arr[min(n + 1, i + power + 2)] -= 1
        arr = np.cumsum(tmp_arr)[1:-1]
    return arr


print(*solve(n, k, arr))
# Judge status: Wrong Answer
m=int(input())
h=list(map(int,input().split()))
ans1=[]
ans=0
if m>1:
  
  for x in range(m-1):
    if h[x]<h[x+1]:
      ans1.append(ans)
      ans=0
    else:
      ans+=1
      ans1.append(ans)
    
  
    
  print(max(ans1))

else:
  print(1)
# Judge status: Accepted
a = input().split()
for i in range(5):
  if i == int(a[i])-1:
    continue
  else:
    print(i+1)
# Judge status: Accepted
n = int(input())
x,cs = 1,1
while n>=cs:
  x +=1
  cs += x
[print(i) for i in range(1,x+1) if i != cs-n]
# Judge status: Accepted
import re
s = input()

s1 = re.fullmatch(r"A([a-z]+)C([a-z]+)", s)

if s1 == None:
    print("WA")
else:
    print("AC")