peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N=int(input())
p=list(map(int,input().split()))
P=sorted(p)
n=0
for i in range(N):
    if p[i]!=P[i]:
        n+=1
if n<=2:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
# -*- coding: utf-8 -*-

a, b, k = map(int, input().split())
counter = 0
num_list = []
for i in range(max(a, b)):
  if a % (i + 1) == 0 and b % (i + 1) == 0:
    num_list.append(i + 1)
print(num_list[::-1][k - 1])
# Judge status: Accepted
from sys import exit
S = input()
for i in range(len(S)):
  for j in range(i):
    if S[i] == S[j]:
      print('no')
      exit(0)
  for j in range(i+1,len(S)):
    if S[i] == S[j]:
      print('no')
      exit(0)
print('yes')
# Judge status: Accepted
n=int(input())

dic={}
for i in range(1,50001):
    p=int(i*1.08)
    dic[p]=i
if n in dic:
    print(dic[n])
else:
    print(":(")
# Judge status: Accepted
x, a, b = map(int, input().split())
print("A" if abs(a-x) < abs(b-x) else "B")
# Judge status: Accepted
S = input()
N = len(S)

if S == S[::-1]:
  Sfor = S[:int((N-1)/2)]
  if Sfor == Sfor[::-1]:
    Slat = S[int((N+1)/2):]
    if Slat == Slat[::-1]:
      print("Yes")
    else:
      print("No")
  else:
    print("No")   
else:
  print("No")
# Judge status: Accepted
# 500yen
A = int(input())
# 100
B = int(input())
# 50
C = int(input())
# total amount and 50 multiple of 50
X = int(input())

res = 0
for c500 in range(A+1):
    for c100 in range(B+1):
        for c50 in range(C+1):
            total = 500*c500 + 100*c100 + 50*c50
            if ( X == total):
                res += 1

print(res)
# Judge status: Wrong Answer
A,B,C = map(int,input().split())

if (A + B*2 >= C):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a,b=input().split()
a=int(a)
b=int(b)
if a-b>=2:
  print(2*a-1)
if b-a>=2:
  print(2*b-1)
else:
  print(a+b)
# Judge status: Accepted
s = input()
acgt = [0]
tmp = 0
for i in range(len(s)):
  if s[i] in ['A', 'C', 'G', 'T']:
    tmp += 1
  elif tmp > 0:
    acgt.append(tmp)
    tmp = 0

acgt.append(tmp)

print(max(acgt))
# Judge status: Accepted
# Tenka1 Programming Beginner Contest 2019: A – On the Way
a, b, c = map(int, input().split())
print('Yes' if a < c < b or b < c < a else 'No')
# Judge status: Wrong Answer
x,a,b=map(int, input().split())

if b<a:
  print("delicious")
elif a+x>b:
  print("dangerous")
else:
  print("safe")
# Judge status: Accepted
a, b = list(map(int, input().split()))
print(str(min(a, b)) * max(a, b))
# Judge status: Accepted
N=int(input())
p=list(map(int,input().split()))
buf=0
ans=p.copy()
count=0
list2=[]
#print(ans==pdash)
ans.sort()
#print(ans)
#print(ans==pdash)
flag=0

for i in range(N):
    if not(ans[i]==p[i]):
       count=count+1

if (count==0)or(count==2):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
a, b, c = map(int, input().split())
if max(a, b, c) * 2 == a + b + c:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N = int(input())
a = [int(c) for c in input().split()]
c = [0]*8
over = 0
for i in range(N):
    if a[i]>=3200:
        over+=1
    else:
        c[a[i]//400]+=1

mi = 8-c.count(0)
if mi+over>8:
    ma = 8
else:
    ma = mi+over
print(mi,ma)
# Judge status: Accepted
import math


hour_hand_speed = (2 * math.pi) / (12 * 60)
minute_hand_speed = (2 * math.pi) / 60

hour_hand, minute_hand, hour, minute = list(
    map(int, input().split())
)

elapsed_time = 60 * hour + minute

hour_hand_angle = elapsed_time * hour_hand_speed
minute_hand_angle = minute * minute_hand_speed

angle_btw_hour_minute = abs(hour_hand_angle - minute_hand_angle)

distance = math.sqrt(
    hour_hand**2 + minute_hand**2 - (2 * hour_hand * minute_hand * math.cos(angle_btw_hour_minute))
)

print(distance)
# Judge status: Accepted
import math
n,k = map(int,input().split())
num = 0
for i in range(1,n + 1):#サイコロの出た目
    if i >= k:
        num += 1 / n
    else:
        num += (1 / (n * (2 ** math.ceil(math.log(k / i,2)))))
print(num)
# Judge status: Accepted
def main():
    n = int(input())
    print(800 * n - 200 * (n // 15))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import sys
s = input()

l = len(s)
if s[0] != "A":
    print("WA")
    sys.exit()
ss =  s[2:l-1]
if ss.count("C") != 1:
    print("WA")
    sys.exit()

cidx = ss.find("C")+2
sss = s[1:cidx]+s[cidx+1:]
print(sss)
if sss.islower():
    print("AC")
    sys.exit()

print("WA")
# Judge status: Accepted
def f(x):
    now = 0
    for i in range(n):
        now += (a[i]-1)//x

    return now <= k

n, k = map(int, input().split())
a = list(map(int, input().split()))
ng = 0
ok= int(1e9)
while ok - ng > 1:
    x = (ok + ng) // 2
    if f(x):
        ok = x
    else:
        ng = x

print(ok)
# Judge status: Accepted
# -*- coding: utf-8 -*-

TT, TA, AT, AA = map(int, input().split())

while True:
    AT = AT - TA # T attack
    if (AT <= 0):
        print("Yes")
        break

    TT = TT - AA #A attack
    if (TT <= 0):
        print("No")
        break
# Judge status: Wrong Answer
s = input()
if s.replace('hi','') == '':
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = input()
if s =="SUN":
  print("7")
if s =="MON":
  print("6")
if s =="TUE":
  print("5")
if s =="WED":
  print("4")
if s =="THU":
  print("3")
if s =="FRI":
  print("2")
if s =="SAT":
  print("1")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
a.sort()
l=[]
i=0
while i<n-1:
  if a[i]==a[i+1]:
    l.append(a[i])
    i+=2
  else:
    i+=1
l.reverse()
if len(l)<2:
  print(0)
else:
  print(l[0]*l[1])
# Judge status: Accepted
n = int(input())
s = input()
t = input()
ans = n * 2
for i in range(n):
    if s[i:] == t[:n-i]:
        ans -= n - i
        break
print(ans)
# Judge status: Accepted
l=list(map(int,input().split()))
if(l[0]==l[1]==l[2]):
  print("No")
elif l[0]==l[1] or l[0]==l[2] or l[1]==l[2]:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
A, B, C, K = map(int, input().split()) 
if K==0:
    print(A-B)
else:
    if B-A<=10**18:
        print(B-A)
    else:
        print("Unfair")
# Judge status: Accepted
n, x, t = map(int,input().split())
if (n%x == 0):
  y = n//x*t
  print(y)
else:
  y = n//x + 1
  y = y*t
  print(y)
# Judge status: Accepted
n,m = map(int, input().split())
if n == m:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b, c = map(int,input().split())
#if math.sqrt(a)+math.sqrt(b) < math.sqrt(c):
if c-a-b> 0 and (c-a-b)**2 > 4*a*b:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
A, B = map(int, input().split())
if A >= 13:
    print(B)
elif A>=6:
    print(B//2)
else:
    print(0)
# Judge status: Accepted
word = input()

list_word = list(word)

if list_word.count(list_word[0]) == 2 and list_word.count(list_word[1]) == 2 and list_word.count(list_word[2]) == 2:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S=input()
T=input()
a=0
for n in range(len(S)):
  if S[n] != T[n]:
    a+=1
print(a)
# Judge status: Accepted
N = int(input())
D = {}
for i in range(N):
  S = input()
  L = [S[j] for j in range(10)]
  L.sort()
  s = ""
  for j in range(10):
    s = s[:] + L[j]
  if s in D:
    D[s] += 1
  else:
    D[s] = 1
p = 0
for i in D:
  p += (D[i]*(D[i]-1))//2
print(p)
# Judge status: Wrong Answer
import fractions
a,b,c,d = map(int,input().split())

ans = b - a + 1
cd = c*d/fractions.gcd(c,d)
tmp = int(b / c) - int((a-1) / c)
tmp2 = int(b / d) - int((a-1) / d)
tmp3 = int(b / cd) - int((a-1) / cd)
print(ans - tmp - tmp2 + tmp3 )
# Judge status: Wrong Answer
lst=[]
c=0
flag=0
n = int(input())
str = input()
lst = str.split(' ')
#for i in range(0,n):
#  lst[i] = int(lst[i])
lst.sort()
#print(lst)
for i in range(0,n):
  flag=0
  for j in range(0,i):
    
    if  int(lst[i])%int(lst[j])==0:
      flag=1
      j=i
  if flag==0:
    c = c+1
print(c)
# Judge status: Accepted
n = int(input())

a = list(map(int, input().split()))
b = []
c = []

for i in range(n):
	b.append(-(i + 1 + a[i]))
	c.append(a[i] - i - 1)

#print(a)
#print(b)
#print(c)

counts = {}

result = 0

counts[b[0]] = 1

for i in range(1, n):
	x = c[i]

#	print(x)
	#print(counts)

	if x in counts: 
		result += counts[x]

	y = b[i]
	if y in counts:
		counts[y] += 1
	else: 
		counts[y] = 1


	


print(result)
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a >= 13:
    print(b)
elif 6 <= a <= 12:
    print(b/2)
else:
    print(0)
# Judge status: Wrong Answer
n=list(map(int,input().split()))
print(sum(n)//len(n))
# Judge status: Wrong Answer
L, R, d = list(map(int, input().split()))

if L%d == 0 or R%d == 0:
  print(1+ R//d - L//d)

else:
  print(R//d - L//d)
# Judge status: Accepted
n,x=map(int,input().split())
a=list(map(int,input().split()))
b=[0]*n
a.sort()
cnt=0
for i in range(n):
    if a[i]<=x:
        x-=a[i]
        if i==n-1 and x!=0:
            break
        cnt+=1
    else:
        break
print(cnt)
# Judge status: Accepted
n,_,*l=map(int,open(0).read().split())
s=set(l)
p,t=0,1
for i in range(n): p,t=t,(p+t)%(10**9+7)*(not{i+1}&s)
print(t)
# Judge status: Accepted
n=int(input())

mod=10**9+7

def power_func(a,n,mod):
  bi=str(format(n,"b"))
  res=1
  for i in range(len(bi)):
    res=(res*res)%mod
    if bi[i]=='1':
      res=(res*a)%mod
  return res

x=power_func(10,n,mod)
y=power_func(9,n,mod)
z=power_func(8,n,mod)

ans=(x-(y-z)*2-z)%mod

print(ans)
# Judge status: Wrong Answer
def main():
    A, B, C = input().split()
    if A == B and A == C:
        print("Yes")
    else:
        print("No")

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

DIV=10**9+7

def gcd(a,b):
  if a<b:
    a,b=b,a
  while a%b!=0:
    a,b=b,a%b
  return b

def lcd(a,b):
  return a*b//(gcd(a,b))

sums=0
L=1
for i in range(N):
  newL=lcd(L,A[i])
  if newL!=L:
    sums=(sums*(newL//L)+newL//A[i])%DIV
    L=newL

print(sums)
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
a,b = max(0,a-k) , b-max(k-a,0)
print(a,b)
# Judge status: Accepted
k,a,b=map(int,input().split())
cnt=0
if b<a+2:
    print(k+1)
else:
    if k>=a+1:
        k-=a+1
        cnt+=b
        q,modulo=divmod(k,2)
        cnt+=q*b-q*a+modulo
        print(cnt)
    else:
        print(k+1)
# Judge status: Wrong Answer
from collections import defaultdict
n = int(input())
li = []
for i in range(n):
    li.append(int(input()))

dic = defaultdict(int)
for i in li:
    if dic[i] == 0:
        dic[i] = 1
    elif dic[i] == 1:
        dic[i] = 0

ans = 0
for i in li:
    if dic[i] == 1:
        ans += 1
print(ans)
# Judge status: Accepted
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

W = ['Sunny', 'Cloudy', 'Rainy']
A = readline().decode('utf8').rstrip()

print(W[(W.index(A) + 1) % 3])
# Judge status: Wrong Answer
a, b = map(int, input().split())
h = 0
for i in range(1, 1000):
    h += i
    ans = (2*h + i+1 - a - b)/2
    if ans > 0:
        print(ans)
        exit()
# Judge status: Accepted
def solve():
    N = input()
    if len(N) == 1:
        print(int(N))
    elif all(i == '9' for i in N[1:]):
        print(int(N[0]) + 9 * (len(N) - 1))
    else:
        print((int(N[0]) - 1) + 9 * (len(N) - 1))

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
n = int(input())

alpha = "abcdefghijklmnopqrstuvwxyz"

inp = [""]
for i in range(n):  # ふかさのループ
    out = []
    for j in range(len(inp)):  # リストのループ
        for k in range(i):  # アルファベットのループ
            out.append(inp[j] + alpha[k])
    out.append(inp[j] + alpha[i])
    inp, out = out, inp

for i in range(len(inp)):
    print(inp[i])
# Judge status: Accepted
n = int(input())
from collections import defaultdict
dic = defaultdict(int)
for i in range(n):
    s = "".join(list(sorted(input())))
    dic[s] += 1
#print(dic)
cnt = 0
for k,v in dic.items():
    cnt += v*(v-1)//2
print(cnt)
# Judge status: Accepted
n,d=map(int,input().split())
print(n//(2*d+1)+1 if n%(2*d+1)!=0 else n//(2*d+1))
# Judge status: Accepted
# author:  Taichicchi
# created: 13.09.2020 21:21:37

import sys

N = int(input())

MOD = (10 ** 9) + 7

ans = (10 ** N - ((9 ** N) * 2 - (8 ** N))) % MOD

print(ans)
# Judge status: Wrong Answer
s=input()
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print("Good")
else:
  print("Bad")
# Judge status: Accepted
from fractions import gcd
a,b=map(int,input().split())
gcd=gcd(a,b)
ans=a*b//gcd
print(ans)
# Judge status: Accepted
import math

a, b, c = map(int, input().split())
if c > a - b and 4 * a * b < (c - a - b) ** 2:
    print('Yes')
else:
    print('No')
# 4 * a * b < (c - a - b) ** 2
# Judge status: Wrong Answer
r, g, b = map(int, input().split())
if (r * 100+ g*10+ b) % 4 == 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s=input()
ans1=[]
ans1.append(0)
now=0
for i in s:
    if i == "<":
        now+=1
    else:
        now=0
    ans1.append(now)
ans2=[]
ans2.append(0)
now=0
for i in reversed(s):
    if i == ">":
        now+=1
    else:
        now=0
    ans2.append(now)

ans=[]
for i in range(len(ans1)):
    ans.append(max(ans1[i],ans2[len(ans1)-i-1]))
print(sum(ans))
# Judge status: Accepted
import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
def main():
    N,K = map(int, input().split())
    A = np.array(list(map(int, input().split())))
    for b in (A[:N-K] < A[K:]):
        print('Yes' if b else 'No')
main()
# Judge status: Accepted
import sys
n, c, k = [int(i) for i in sys.stdin.readline().split()]
t_ls = []
for i in range(n):
    t = int(sys.stdin.readline().strip())
    t_ls.append(t)
t_ls.sort()
last = t_ls[0]
cnt = 1
ans = 1
for t in t_ls[1:]:
    if t <= last + k and cnt < c:
        cnt += 1
        continue
    last = t
    cnt = 1
    ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))
ans = 'Yes'
for i in range(n-1):
    if h[i] > h[i+1]:
        h[i+1] += 1
    if h[i] > h[i+1]:
        ans = 'No'
print(ans)
# Judge status: Accepted
n = int(input())
c = 0
max_c = 0
max_num = 1

for i in range(1, n+1):
    if i % 2 == 0:
        j = i
        c = 1
        j /= 2
        while j % 2 == 0:
            c += 1
            j /= 2
    if c > max_c:
        max_c = c
        max_num = i

print(max_num)
# Judge status: Accepted
a,b,c=map(int,input().split())
if 22<=a+b+c:
    print("bust")
else:
    print("win")
# Judge status: Accepted
N = int(input())

dic = {}
m = 1
for i in range(N):
    st = input()
    if st not in dic:
        dic[st] = 1
    else:
        dic[st] += 1
        if dic[st] > m:
            m = dic[st]

ans = []
for s in dic:
    if dic[s] == m:
        ans.append(s)
ans.sort()
for i in range(len(ans)):
    print(ans[i])
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
l = [0 for i in range(n+1)]
ans = 0
for i in range(n):
    l[a[i]] += 1
for i in range(n+1):
    ans += (l[i]*(l[i]-1))//2
al = []
for i in range(n):
    a0 = ans - (l[a[i]]*(l[a[i]]-1))//2 + ((l[a[i]]-1)*(l[a[i]]-2)//2)
    al.append(a0)
for i in al:
    print(i)
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())
print(min(n,k)*x+max((n-k),0)*y)
# Judge status: Accepted
def main():
    s, b, e = [int(x) for x in input().split()]
    e += 0.5
    levas = e // s
    print(int(levas*b))
main()
# Judge status: Accepted
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
  sum = 0
  k = i
  while k > 0:
    sum = sum + k % 10
    k = k // 10
  if A <= sum <= B:
    ans = ans + i
print(ans)
# Judge status: Accepted
def resolve():
    X = int(input())
    if X>=30:
        print('Yes')
    else:
        print('No')

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

if 0 < a and 0 < b:
  print("Positive")
elif (a == 0 or b == 0) or (a < 0 and 0 < b):
  print("Zero")
else:
  if (a-b)%2 == 0:
    print("Negative")
  else:
    print("Positive")
# Judge status: Accepted
X, Y, A, B, C = map(int, input().split())
p = sorted(list(map(int, input().split())), reverse=True)[:X]
q = sorted(list(map(int, input().split())), reverse=True)[:Y]
r = sorted(list(map(int, input().split())), reverse=True)[:X+Y]
pqr = sorted(p+q+r, reverse=True)
print(sum(pqr[:X+Y]))
# Judge status: Wrong Answer
N = int(input())

m = [0] * (N+1)
for i in range(1, N):
  temp = i
  for k in range(temp, N+1, i):
    m[k] += 1

ans = 0
for n in range(1, N+1):
  ans += n*m[n]
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
ans = 0
if 2 * n <= m:
  m -= n * 2
  ans += n
  ans += m // 4
else:
  ans += m // 2
print(ans)
# Judge status: Wrong Answer
H, A = map(int, input().split())

if H%A==0:
  print(H/A)
else:
  print((H//A)+1)
# Judge status: Accepted
word=input().split()
print(word[0][0]+word[1][0]+word[2][0])
# Judge status: Accepted
a,b,x = map(int, input().split())
if a <= x and x <= a+b:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
N = int(input())
S = list(input())

Rcnt = 0
Gcnt = 0

excep = 0

for i in range(len(S)):
    if S[i] == 'R':
        Rcnt += 1
    elif S[i] == 'G':
        Gcnt += 1
    for j in range(1, (len(S)//2)):
        if i+j+j < len(S) and S[i] != S[i+j]:
            if S[i] != S[i+j+j] and S[i+j] != S[i+j+j]:
                excep += 1

RGBcalc = Rcnt * Gcnt * (N - Rcnt - Gcnt)

print(RGBcalc - excep)
# Judge status: Accepted
def main():
    k = int(input())
    a,b = map(int,input().split())
    answer = "NG"
    for i in range(a,b+1):
        if i % k == 0:
            answer = "OK"
            break
    print(answer)

if __name__ == '__main__':
    main()
# Judge status: Accepted
S = list(input())
value = [0] * (len(S) + 1)
  
for i in range(len(S)):
  if S[i] == '<':
    if value[i] == 0:
      value[i+1] = 1
    else:
      value[i+1] = value[i] + 1

for i in reversed(range(len(S))):
  if S[i] == '>':
    if value[i+1] == 0 and value[i] == 0:
      value[i] = 1
    elif value[i] <= value[i+1]:
      value[i] = value[i+1] + 1
print(sum(value))
# Judge status: Accepted
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
num=[]
for i in range(m):
    num.append(list(map(int,input().split())))
num.sort(reverse=True,key=lambda x: x[1])
cnt=0
for i in range(n):
    if cnt==m:
        break
    if num[cnt][0]==0:
        cnt+=1
    if cnt==m:
        break
    if a[i]>=num[cnt][1]:
        break
    a[i]=num[cnt][1]
    num[cnt][0]-=1
print(sum(a))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=0
while True:
  for i in range(n):
    if a[i]%2!=0:
      print(ans)
      exit()
    a[i]//=2
  ans+=1
# Judge status: Accepted
N = int(input())
A = int(input())

if N%500 > A:
  print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
import numpy as np

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

while all(a % 2 == 0 for a in A):
  A = [a/2 for a in A]
  count += 1
  
print(count)
# Judge status: Wrong Answer
import networkx as nx
room, route_count = map(int,input().split())

G = nx.Graph()
G.add_nodes_from(range(1,room+1))
G.add_edges_from([list(map(int,input().split())) for _ in range(route_count)])

is_end = False
for i in range(2, room+1):
  if ~nx.has_path(G,source=i, target=1):
    is_end = True
    break

if is_end:
  print('No')
else:
  print('Yes')
  shortest_path_dict = nx.single_target_shortest_path(G, target=1)
  for i in range(2,room+1):
    print(shortest_path_dict[i][1])
# Judge status: Wrong Answer
a,b,k = map(int,input().split())
cnt = 0
for i in range(1,a*b*k):
  if i%a==0 and i%b==0:
    cnt+=1
    if(cnt==k):
      print(i)
      exit()
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)

s = 0
for x in range(n, 2*n):
    s += a[x]

print(s)
# Judge status: Wrong Answer
import sys

def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    A = list(map(int, input().split()))
    x = 1
    for i in A:
        x *= i
        if x > 10**18:
            x = -1
            return
    print(x)

if __name__ == "__main__":
    main()
# Judge status: Accepted

n = int(input())

data = []
data.append([0, 0, 0])
for i in range(n):
    t, x, y = map(int,  input().split())
    data.append([t, x, y])

for i in range(1, n + 1):
    dis = abs(data[i][1] - data[i - 1][1]) + abs(data[i][2] - data[i- 1][2])
    dif = data[i][0] - data[i - 1][0]
    if (dif % 2 != dis % 2 or dis > dif):
        print("No")
        exit() 

print("Yes")
# Judge status: Accepted
x, a, b = list(map(int, input().split()))
print('A' if abs(x - a) < abs(x - b) else 'B')
# Judge status: Accepted
n,k=map(int,input().split())
A=list(map(int,input().split()))

def culc(L):
    subL=[0]*(n+1)

    for i in range(n):
        temp=L[i]
        bottom=max(i-temp,0)
        top=min(i+temp,n-1)

        subL[bottom]+=1
        subL[top+1]-=1
    
    resL=[0]*n
    resL[0]=subL[0]
    for i in range(1,n):
        resL[i]=resL[i-1]+subL[i]

    return resL

for i in range(min(k,41)):
    A=culc(A)

print(*A)
# Judge status: Accepted
h, m, h2, m2, k = map(int, input().split())

i = h2 * 60 + m2 - (h * 60 + m)

print(i-k)
# Judge status: Wrong Answer

a, b = map(int, input().split())
c = int((a + b) / 2)
print(c + 1)
# Judge status: Accepted
import sys
def input():
	return sys.stdin.buffer.readline()[:-1]

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

dp = [10** 30 for _ in range(h+1)]
dp[0] = 0
for a, b in spells:
	for i in range(h):
		dp[min(i+a, h)] = min(dp[min(i+a, h)], dp[i]+b)

print(dp[h])
# Judge status: Accepted
from copy import copy
n, *x = map(int, open(0).read().split())
a = []
for i, v in enumerate(x):
    a.append((v, i))
a.sort()

# a[(i - 1)/ /2] , a[i // 2]
ans = [0] * n
for i in range(n):
    if i <= (n - 1) // 2:
        ans[a[i][1]] = a[n // 2][0]
    else:
        ans[a[i][1]] = a[(n - 1) // 2][0]
for y in ans:
    print(y)
# Judge status: Accepted
N=int(input())
A=[format(i,'060b') for i in map(int,input().split())]
ans=0
mod=10**9+7
for k in range(60):
    count=[a[60-1-k] for a in A].count('0')
    ans+=count*(N-count)*(2**k)%mod
print(ans%mod)
# Judge status: Wrong Answer
s = input()
memo = s[0]
len_s = len(s)
cnt = 0
ans = 0
for i in range(2 * 10 ** 5):
    ans += 1
    if memo == s[cnt]:
        memo = s[cnt:cnt + 2]
        cnt += 2
    else:
        memo = s[cnt]
        cnt += 1
    if cnt > len_s - 1:
        break

print(ans)
# Judge status: Wrong Answer
S = input()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

if A + B + C + D == 7 or A - B - C - D == 7 or A + B + C - D == 7 or A - B + C + D == 7 or A - B - C + D == 7 or A - B + C - D == 7 or A + B - C + D == 7:
  print('YES')
# Judge status: Wrong Answer
n, m = map(int, input().split())
x = list(map(int, input().split()))

if n >= m:
    print(0)
    exit()

x.sort()

d = [x[i+1] - x[i] for i in range(m-1)]

d.sort()

print(sum(d[:-n+1]))
# Judge status: Accepted
import bisect
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        ans += bisect.bisect_left(L, L[i] + L[j]) - j - 1
print(ans)
# Judge status: Accepted
n,m = map(int, input().split(' '))
List = [i+1 for i in range(m)]

i = 0
while i < n:
    k_list = list(map(int, input().split(' ')))
    lcopy = List[:]
    for l in lcopy:
        if l not in k_list[1:]:
            List.remove(l)
            #print(l,List)
    i += 1
print(len(List))
# Judge status: Accepted
n,m = map(int,input().split())

max_cnd = m//n

for i in range(max_cnd):
    if m % (max_cnd-i) == 0:
        print(max_cnd-i)
        exit()
# Judge status: Accepted
# -*- coding: utf-8 -*-

s = input()
cnt = {l:0 for l in set(s)}
if len(cnt) != 2:
    print('No')
    exit(0)

for l in s:
    cnt[l] += 1
    if cnt[l] > 2:
        print('No')
        exit(0)

print('Yes')
# Judge status: Accepted
from math import factorial
N = int(input())
A = list(map(int,input().split()))
t, j = float("INF"), -1
max_A = max(A)
A.remove(max_A)
for i in range(N-1):
  if abs(max_A//2 - A[i]) < t:
    t = abs(max_A//2 - A[i])
    j = i
print(max_A, A[j])
# Judge status: Wrong Answer
n = input()
count = 0
tmp = ''
for i in n:
  if tmp == '' or count == 0:
    tmp = i
  elif count == 3:
    break
  if tmp == i:
    count += 1
  else:
    tmp = i
if count >= 3:
  print('Yes')
else:
  print('No')