peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n,q = map(int,input().split())
s = input()
ans = []
a = [0]*(10**5+1)
add = 0
check = False
for i in range(n):
    if check and s[i] == 'C':
        add +=1
    if s[i] == 'A':
        check = True
    else:
        check = False
    
    a[i] += add
for i in range(q):
    b,c = map(int,input().split())
    ans.append(a[c-1]-a[b-1])
for i in range(q):
    print(ans[i])
# Judge status: Accepted
x=int(input())
c=100
year=0
while (c<=x):
  if(c==x):
    break
  year+=1
  c+=(c*1//100)
print(year)
# Judge status: Accepted
s = input()
t = input()
c = []

for j in range(len(s)-len(t)+1):
    counter = 0
    for i in range(len(t)):
        if(s[i+j] == t[i]):
#            print("i,j=",i,j)
            counter += 1

#    print(counter)
    c.append(counter)

print(len(t)-max(c))
# Judge status: Wrong Answer
N = int(input())
List=list(map(int,input().split()))

cnt4 = 0
for i in range(N):
  a = List[i]
  if a%4 == 0:
    cnt4 += 1

cnt2 = 0
for i in range(N):
  a = List[i]
  if a%2 == 0:
    cnt2 += 1
cnt2 = int(cnt2 - cnt4)

if cnt2 == 0:
  if cnt4 >= N -cnt4 -1:
    print("Yes")
  else:
    print("No")
else:
  if cnt4-1 >= (N-cnt4) -cnt4-1:
    print("Yes")
  else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
v_list = sorted(list(map(int,input().split())))
print(v_list)

sum = 0
a = 0

if N == 1:
    sum += v_list[0]

elif N == 2:
    sum += (v_list[0] + v_list[1])/2

else:
    a = v_list[0] + v_list[1]
    for i in range(N-1):
        sum += a *2 ** (-N + i +1)
     
print(sum)
# Judge status: Accepted
sx, sy, tx, ty = [int(s) for s in input().split(" ")]
diff = [tx - sx, ty - sy]

print("R" * diff[0] + "U" * diff[1] + "L" * diff[0] + "D" * diff[1] + "D" + "R" * (diff[0] + 1) + "U" * (diff[1] + 1) + "L" + "U" + "L" * (diff[0] + 1) + "D" * (diff[1] + 1) + "R")
# Judge status: Wrong Answer
x,y=map(int,input().split())
print(x*2 if y%x!=0 else -1)
# Judge status: Wrong Answer
a, b, x = map(int, input().split())

ans = (b - a) // x
if a % x == 0 and b % x == 0:
    ans += 1
print(ans)
# Judge status: Wrong Answer
n,y=map(int,input().split())
a=int(y/10000)
b=int((y-a*10000)/5000)
print(a,b)
if (y-a*10000-b*5000)%1000 == 0:
	print(a,b,int((y-a*10000-b*5000)/1000))
else:
	print(-1,-1,-1)
# Judge status: Wrong Answer
s=str(input())
s=list(s)
temp=[]
i=0
for i in range(0,len(s)):
  if s[i]=="1":
    temp.insert(0,"1")
  elif s[i]=="0":
    temp.insert(0,"0")
  else:
    if len(temp)!=0:
      del temp[0]

#temp="".join(temp)
print(temp)
# Judge status: Accepted
print("vowel" if input() in "aiueo" else "consonant")
# Judge status: Wrong Answer
N=int(input())
a=list(map(int, input().split()))
counter = 1
for i in range(len(a)):
    for j in range(i-1):
        if a[i]<=a[j]:
            counter=counter+1
        else:
            pass
print(counter)
# Judge status: Accepted
N = int(input())
T, A = [int(i) for i in input().split()]
best_height = (A - T) / (-0.006)

H = {abs(best_height - int(n)): i+1 for i, n in enumerate(input().split())}

min_diff = min(H.keys())
print(H[min_diff])
# Judge status: Wrong Answer
D = int(input())
c = [int(x) for x in input().split()]
s = [input().split() for l in range(D)]

manzoku = 0
kyounomanzoku = 0
kyounotype = 0
d = 1
last = [0]*26




for p in range(D):
    #タイプはt[p]-1,0~25 満足度増加 s[p][t[p]] p+1日目
    for t in range(26):
        if kyounomanzoku < int(s[p][t]):
            kyounomanzoku = int(s[p][t])
            kyounotype = t
    print(kyounotype)
# Judge status: Wrong Answer
import math

N = int(input())
li = list(map(int, input().split()))

m = sum(li) / N

new = sorted(li)

for i in range(N):
  if li[i] <= m:
    print(new[math.floor(N/2)])
  else:
    print(new[math.floor(N/2) - 1])
# Judge status: Wrong Answer
import sys
#果物の種類Nと，購入数K
N, K = map(int, input().split())

#果物値段A
A = list(map(int, input().split()))
A = sorted(A, reverse = False)
#print(N, K)
#print(A)
ans=0
#C = 0

for i in A:
    ans += A.pop(0)
    #print(ans)
    #print(ans)
    """
    if C == K-1:
        print(ans)
        sys.exit()
"""
print(ans)
# Judge status: Accepted
tmp = input().split(" ")
x = int(tmp[0])
a = int(tmp[1])
b = int(tmp[2])

print("A") if abs(x - a) < abs(x - b) else print("B")
# Judge status: Accepted
l,r = map(int,input().split())
if r-l >= 2019:
    print(0)
else:
    r1 = r % 2019
    l1 = l % 2019
    if l1 > r1:
        print(0)
    else:
        ans = 2019
        for i in range(l1, r1):
            for j in range(i + 1, r1 + 1):
                ans = min(ans, (i*j) % 2019)
        print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
x = n % k
print(min(x, k - x))
# Judge status: Accepted
a, b, c, d = map(int, input().split())

ans = max(min(b, d) - max(a, c), 0)

print(ans)
# Judge status: Accepted
s = list(input())
if len(s) == len(set(s)):
    print('yes')
else:
    print('no')
# Judge status: Wrong Answer
n=input()

wk =0
for i in range(len(n)):
    wk+=int(n[i])
if wk%9==0:
    if wk!=0:
        print('Yes')
    else:
        print('No')
else:
    print('No')
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))

print('YES' if len(A)==len(set(A)) else 'NO')
# Judge status: Wrong Answer
N = int(input())
A, B = [],[]
for _ in range(N):
	ta,tb = map(int, input().split())
	A.append(ta)
	B.append(tb)

A = A[::-1]
B = B[::-1]

ans = 0
for i in range(N):
	A[i] += ans
	s,t = divmod(A[i], B[i])
	if s == 0:
		a = B[i]
	else:
		if t == 0:
			a = A[i]
		else:
			a = B[i] * (s+1)

	ans += a-A[i]

print(ans)
# Judge status: Accepted
A = []
for _ in range(3):
  A += list(map(int,input().split()))
N = int(input())
B = [int(input()) for _ in range(N)]
C = [0]*9
for i in B:
  if i in A:
    x = A.index(i)
    C[x] = 1
if C[0]*C[1]*C[2] == 1 or C[3]*C[4]*C[5]==1 or C[6]*C[7]*C[8] ==1 or C[0]*C[3]*C[6] ==1 or C[1]*C[4]*C[7]==1 or C[2]*C[5]*C[8] ==1 or C[0]*C[4]*C[8] ==1 or C[2]*C[4]*C[6] ==1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
D, T, S = map(int, input().split())
print('Yes' if D <= T * S else 'No')
# Judge status: Wrong Answer
S = str(input())
hitachi = "Yes"
for i in range(len(S)):
    if i%2 == 0:
        if S[i] == "h":
            pass
        else:
            hitachi = "No"
    else:
        if S[i] == "i":
            pass
        else:
            hitachi = "No"
if S=="h":
    hitachi = "No"
print(hitachi)
# Judge status: Accepted
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))

op = []
for i in range(m):
    b, c = map(int, input().split())
    op.append((c, b))

op.sort(reverse=True)

j = 0
k = 0

for i in range(n):
    if a[i] >= op[j][0]:
        break

    a[i] = op[j][0]
    k += 1

    if k >= op[j][1]:
        j += 1
        k = 0

    if j >= m:
        break

print(sum(a))
# Judge status: Accepted
n = int(input())
m = 0
d = 0
for i in range(10**4):
  if i*(i+1)//2 >= n:
    m = i
    d = i*(i+1)//2 - n
    break
for i in range(1,m+1):
  if i != d:
    print(i)
# Judge status: Accepted
N = int(input())
S = [int(input()) for i in range(N)]
s_10 = []
s_other = []
for s in S:
  if s % 10:
    s_other.append(s)
  else:
    s_10.append(s)

s_other.sort()
ans = sum(S)
other_mod_10 = sum(s_other) % 10
if s_other:
  if other_mod_10:
    print(ans)
  else:
    print(ans - min(s_other))
else:
  print(0)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
D = [0]*(N+1)
prev = 0
for i in range(N,-1,-1):
    D[i] = prev+A[i]
    prev = D[i]
prev = 1
for i in range(N+1):
    tmp = min(2**i,prev*2)
    if D[i] > tmp:
        D[i] = tmp
    prev = tmp-A[i]
for i in range(N,-1,-1):
    tmp = 0
    if i != N:
        tmp = (A[i+1]+1)//2
    if tmp+A[i] > 2**i:
        print(-1)
        exit()
print(sum(D))
# Judge status: Wrong Answer
n = int(input())
a = list(input() for i in range(n))
M = max(a)

if a.count(M) > 1:
  for i in range(n):
    print(M)
elif n == 1:
  print(M)
else:
  M2 = sorted(set(a))[-2]
  for i in range(n):
    if a[i] == M:
      print(M2)
    else:
      print(M)
# Judge status: Accepted
from fractions import Fraction as f
n = int(input())
odd = 0
for i in range(1,n+1):
  if i % 2 != 0:
    odd += 1
print(float(f(odd,n)))
# Judge status: Wrong Answer
def main():
    S = input()
    flag = True
    cnt = 0
    for i in range(len(S)):
        if not(i == 0 and S[i] == 'A'):
            print("WA")
            return
        elif 2 <= i <= len(S)-1 and S[i] == 'C':
            cnt += 1
        elif S[i].isupper():
            print("WA")
            return
    if cnt == 1:
        print("AC")
    else:
        print("WA")
            
main()
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
alice=0
bob=0
for i in range(n):
    if n%2==0:
        alice+=a[i]
    else:
        bob+=a[i]
print(alice-bob)
# Judge status: Wrong Answer
A, B, C = map(int, input().strip().split())
def f(a):
  if a % 4 == 0:
    return 2
  elif a % 2 == 0:
    return 1
  else:
    return 0

if f(A) == 0 or f(B) == 0 or f(C) == 0:
  print(0)
elif f(A) == 1 or f(B) == 1 or f(C) == 1:
  print(1)
else:
  print(-1)
# Judge status: Wrong Answer
from collections import Counter
mod = 10 ** 9 + 7
n = int(input())
s = input()
cnt = Counter(s)
ans = 1
for k in cnt.keys():
    ans *= (cnt[k] + 1) % mod
print(ans - 1)
# Judge status: Accepted
k,x=map(int,input().split())

if(500*k>=x):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

count = 0
for i in range(n):
    if a[i] < b[i]:
        count += (b[i] - a[i]) // 2
    else:
        count += b[i] - a[i]

print("Yes" if count >= 0 else "No")
# Judge status: Accepted
x = int(input())
q, mod = divmod(x, 11)
if mod == 0:
    ans = q*2
elif mod <= 6:
    ans = q*2+1
else:
    ans = q*2+2
print(ans)
# Judge status: Accepted
n, m, k = map(int, input().split())

for i in range(n+1):
    for j in range(m+1):
        if k == i*(m-j) + j*(n-i):
            print("Yes")
            exit()

print("No")
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    P = [int(x) for x in input().split()]

    ans = 0
    for i in range(N):
        if i + 1 == P[i]:
            ans += 1
            if i == N - 1:
                break
            P[i + 1] = P[i]

    print(ans)
    
    

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
h = list(map(int, input().split()))
for i in range(n - 2):
    if h[i] < h[i + 1] and h[i + 1] > h[i + 2]:
        if h[i] <= h[i + 1] - 1 and h[i + 1] - 1 == h[i + 2]:
            h[i + 1] -= 1
for i in range(n - 1):
    if h[i] > h[i + 1]:
        print("No")
        exit()
print("Yes")
# Judge status: Wrong Answer
def main():
    n,k=map(int,input().split())
    p=list(map(int,input().split()))
    kitai=[]
    ans=0
    for i in range(n):
        buf=sum(range(1,p[i]+1))/p[i]
        kitai.append(buf)
        if i<=k-1:
            ans+=buf
    x=ans
    for i in range(k,n):
        x-=kitai[i-1]
        x+=kitai[i]
        if ans<=x:
            ans=x
    print(ans)

if __name__=='__main__':
    main()
# Judge status: Accepted
from itertools import accumulate
import heapq as hq
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]
ab.sort()
ls = []
hq.heapify(ls)
k = max([a[0] for a in ab]+[m])
daylist = [0]*(k+1)
for i in range(n):
  daylist[ab[i][0]] += 1
daylistsum = list(accumulate(daylist))
ans = 0
for i in range(1,m+1):
  for j in range(daylistsum[i-1],daylistsum[i]):
    hq.heappush(ls,-ab[j][1])
  if ls:
    ans -= hq.heappop(ls)
print(ans)
# Judge status: Wrong Answer
N = int(input())
a = [1]
b = [6,6**2,6**3,6**4,6**5,6**6]
c = [9,9**2,9**3,9**4,9**5]
list = a+b+c
list.sort(reverse = True)
a = 0
for i in range(12):
  a += N//list[i]
  N -= list[i]*(N//list[i])
print(a)
# Judge status: Accepted
def popularity(votes, N, M):
    
    total_votes = sum(votes)
    limit = total_votes / (4.0 * M)
    
    cnt = 0
    for vote in votes:
        if vote >= limit:
            cnt += 1
    
    if cnt >= M:
        return "Yes"
    
    return "No"
  
N, M = [int (x) for x in input().split()]
votes = [int (x) for x in input().split()]
print(popularity(votes, N, M))
# Judge status: Wrong Answer
def main():
    x = input().replace("TS", "T S").split()
    ans = 0
    s = 0
    for i in x:
        s += i.count("S")
        t = i.count("T")
        if t <= s:
            s -= t
            ans += s
        else:
            ans += 2*(t-s)
            s = 0
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
x, a, b = map(int, input().split())
if abs(x - a) > abs(x - b):
  print('B')
else:
  print('A')
# Judge status: Accepted
S = input()
n = S.count("N")
s = S.count("S")
w = S.count("W")
e = S.count("E")
if (n == s == 0 or (n > 0 and s > 0)) and (w == e == 0 or (w > 0 and e > 0)):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
# 2020/01/30
# AtCoder Beginner Contest 064 - C

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

# Count
ans = 0

a.sort()
wk_r = -1
a_max = 0
cnt = 0
for i in range(n):
    if a[i] >= 3200:
        a_max = cnt + (n - i)
        break
    
    rank = a[i] // 400
    if wk_r != rank:
        cnt = cnt + 1
        wk_r = rank

a_min = cnt
if a[n-1] < 3200:
    a_max = cnt

# Output
print(a_min, a_max)
# Judge status: Accepted
A,B = map(int,input().split())
print(A+B if A+B<24 else A+B-24)
# Judge status: Accepted
print(1+list(map(int,input().split())).index(0))
# Judge status: Accepted
def digitsum(s):
    su = 0
    for i in range(len(s)):
        su += int(s[i])

    return su

def main():
    N = int(input())

    ans = 10**10
    for a in range(1, N):
        b = N - a
        tmp = digitsum(str(a)) + digitsum(str(b))

        ans = min(ans, tmp)

    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N, M, X, Y = map(int, input().split())
x = [int(x) for x in input().split()]
y = [int(y) for y in input().split()]

if max(x) < min(y) and X < min(y):
    print('No War')
else:
    print('War')
# Judge status: Accepted
N = int(input())

mod = 10**9 + 7
print((pow(10, N, mod) - 2*pow(9, N, mod) + pow(8, N, mod))%mod)
# Judge status: Wrong Answer
import math
X = int(input())
time = X
for i in range(X+1):
    j = X - i
    if j > time: continue
    n = - 1 + math.sqrt(1+8*X-j)
    if n < 2*j and math.floor(n) == n:
        time = min(time, j)
print(time)
# Judge status: Accepted
import math

N, M = map(int, input().split())
if abs(N - M) >= 2:
    print(0)
    exit()


N = math.factorial(N) % (10 ** 9 + 7)
M = math.factorial(M) % (10 ** 9 + 7)
if N == M:
    print((N * M * 2) % (10 ** 9 + 7))
else:
    print((N * M) % (10 ** 9 + 7))
# Judge status: Accepted
from collections import deque
N = int(input())
A = [list(map(int,input().split())) for _ in range(2)]
Q = deque([(0,0,A[0][0])])
ans = 0
while Q:
    x,y,d = Q.popleft()
    if x == 1 and y == N-1:
        ans = max(ans,d)
        continue
    for dx,dy in [(0,1),(1,0)]:
        if x+dx <= 1 and y+dy <= N-1:
            Q.append((x+dx,y+dy,d+A[x+dx][y+dy]))
print(ans)
# Judge status: Wrong Answer
n = map(int, input().split())

while n == 0:
    a += n
    n -= 1
print(n)
# Judge status: Accepted
N,K = map(int, input().split())
R,S,P = map(int,input().split())
T = list(input())

ans = 0
d = {'s':R , 'p':S, 'r':P}
for i,t in enumerate(T):
    if i<K:
        ans += d[t]
    else:
        if T[i-K]!=T[i]:
                ans += d[t]
        else:
            T[i]=''

print(ans)
# Judge status: Wrong Answer
import collections
l=list(input())

if len(l)%2!=0:
            print('No')
            exit()

else:
            c=collections.Counter(l)
            c_item=list(c.values())
            for i in range(len(set(l))):
                         if c_item[i] %2 !=0:
                                    print('No')
print('Yes')
# Judge status: Accepted
l=list(map(int,input().split()))
if(l[1]-l[0]==l[2]-l[1]):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(1, n+1):
  if (i%3 != 0) and (i%5 != 0):
    ans += i
print(ans)
# Judge status: Accepted
from operator import itemgetter
import datetime

n = int(input())
sn = dict()

for i in range(n):
    s = input()
    if(s in sn):
        sn[s] += 1
    else:
        sn[s] = 1

sn = sorted(sn.items(), key=lambda x:(-x[1],x[0]))
#print(sn)

max_val = max(dict(sn).values())

for si in sn:
    if(int(si[1]) == max_val):
        print(si[0])
    else:
        break
# Judge status: Accepted
x = int(input())

bounds = [
    400,
    600,
    800,
    1000,
    1200,
    1400,
    1600,
    1800,
    2000
]
bounds.reverse()

for i, b in enumerate(bounds):
    if x >= b:
        print(i)
        break
# Judge status: Wrong Answer
import sys
import numpy as np
 
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
 
 
n=int(input())
h=list(map(int,input().split()))

dp=[0]*(n+1)

dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(0,n-2):
	dp[i+2]=min((dp[i]+abs(h[i+2]-h[i])),(dp[i+1]+abs(h[i+1]-h[i])))


print(dp[n-1])
# Judge status: Accepted
n=int(input())

dic={}
for i in range(n):
    s=input()
    if s in dic:
        dic[s]+=1
    else:
        dic[s]=1

m=int(input())
for i in range(m):
    s=input()
    if s in dic:
        dic[s]-=1
    else:
        dic[s]=-1
        
print(max(0,max(dic.values())))
# Judge status: Accepted
n,a,b=map(int,input().split())
s=input()
ab_count=0
b_count=0

for i in s:
    if i=="a":
        if ab_count<a+b:
            print('Yes')
            ab_count+=1
        else:
            print('No')
    elif i=="b":
        if ab_count<a+b and b_count<b:
            print('Yes')
            ab_count+=1
            b_count+=1
        else:
            print('No')
    else:
        print('No')
# Judge status: Accepted
n = int(input())
L = [input().split() for _ in range(n)]
d = {}
for s, p in L:
    if s not in d.keys():
        d[s] = [int(p)]
    else:
        d[s].append(int(p))
for i, v in enumerate(L, start=1):
    v.append(i)
for i in sorted(d):
    for j in sorted(d[i], reverse=True):
        for k in range(n):
            if L[k][1] == str(d[i][d[i].index(j)]):
                print(L[k][2])
# Judge status: Accepted
n,m=map(int,input().split())
idx = n//2
offset = 0
for i in range(m):
    if n%2==0 and (2*i+1)*2 >= n:
        offset = 1
    print(idx-i, idx+i+1+offset)
# Judge status: Accepted
S = input()
now = ""
ans = 0
flag = 0
for s in S:
  if flag == 1:
    now = ""
    ans += 1
    flag = 0
  else:
    if now == s:
      flag = 1
    else:
      now = s
      ans += 1
print(ans)
# Judge status: Accepted
import  math


def length(l1, l2):
    total = 0
    for i in range(len(l1)):
        total += (l1[i] - l2[i]) ** 2
    return math.sqrt(total)


N, D = map(int, input().split())
X = []
ans = 0
for _ in range(N):
    X.append(list(map(int, input().split())))

for i in range(N-1):
    for j in range(i+1, N):
        tmp = length(X[i], X[j])
        if tmp.is_integer():
            ans += 1
print(ans)
# Judge status: Accepted
def q2():
    K, X = (int(i) for i in input().split())
    min_pos = X - K + 1
    max_pos = X + K
    ans = map(lambda x: str(x), range(min_pos, max_pos))
    print(' '.join(list(ans)))


if __name__ == '__main__':
    q2()
# Judge status: Accepted
a,b,m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = min(A) + min(B)
for _ in range(m):
    x,y,c = map(int, input().split())
    p = A[x-1] + B[y-1] - c
    if p < ans:
        ans = p
print(ans)
# Judge status: Wrong Answer
newlst = []
lst =[]
m = int(input())
while(m<0):
    a = str(input())
    lst.append(a)
    m = m -1
for j in lst:
    if j not in newlst:
        newlst.append(j)
print(len(newlst))
# Judge status: Accepted
n = int(input())
l = sorted(list(map(int, input().split())),reverse=True)
print(sum(l[1:len(l)-n:2]))
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
s = sum(A)
p = 10**20
t = 0
for i in range(n):
    t += A[i]
    p = min(p, abs(s-t*2))
print(p)
# Judge status: Accepted
n = int(input())

if n <= 999:
    print("ABC")
elif n > 999:
    print("ABD")
# Judge status: Accepted
n = int(input())

c = [0] * n
s = [0] * n
f = [0] * n

for i in range(n-1):
	c[i],s[i],f[i] = map(int,input().split())

for i in range(n):
	t = 0
	for j in range(i,n-1):
		if t < s[j]: t = s[j]
		elif t % f[j] == 0: pass
		else: t = t + f[j] - t%f[j]
		t += c[j]

	print(t)
# Judge status: Accepted
N = int (input ())
t2 = 0
x2 = 0
y2 = 0
ans = 'Yes'
for i in range (N):
    t,x,y = map(int, input().split())
    if abs(x+y-x2-y2) <= t-t2:
        if ((abs(x2+y2-x-y))-(t-t2)) % 2 == 1:
            ans = 'No'
            break
    else:
        ans = 'No'
        break
    t2 = t
    x2 = x
    y2 = y
print (ans)
# Judge status: Wrong Answer
N,K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
score = [1 for x in range(N-K+1)]
for k in range(len(score)):
    for j in range(K):
        score[k] *= A[K+k-1-j]
for i in range(1,len(score)):
    if score[i] > score[i-1]:
        print("Yes")
    else:
        print("No")
print(score)
# Judge status: Accepted
from statistics import median

N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

mn = median(A)
mx = median(B)

if N % 2 == 1:
    print(int(mx - mn + 1))        # mn, mn + 1, mn + 2, ..., mx
else:
    print(int((mx - mn) * 2 + 1))    # mn, mn + 0.5, mn + 1, ..., mx
# Judge status: Accepted
A,B,C,D=input()
if A==B==C or B==C==D:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N, L = map(int, input().split())

L_max= N + L -1
ans = (L + L_max) * N // 2

if L * L_max <= 0:
    print(ans)
elif ans > 0:
    print(ans - L)
else:
    print(ans - L_max)
# Judge status: Wrong Answer
def resolve():
    s = int(input())
    ans = [s]
    count = 0
    while True:
        if ans[count]%2 == 0:
            ans.append(ans[count]/2)
        else:
            ans.append(ans[count]*3+1)
        count += 1
        if ans[count] < 1:
            ans[count] = ans[count-1]
        if ans[count] == 4:
            print(count+3)
            exit()
resolve()
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
p=[i for i in range(1,n+1)]
cnt=0
for i in range(n) :
    if p[i]!=a[i] :
        cnt+=1
print("YES" if cnt<=2 else "NO")
# Judge status: Accepted
S = input()

ans = 1000
N = len(S)
for i in range(N-2):
    ans = min(ans,abs(753-int(S[i:i+3])))
    
print(ans)
# Judge status: Wrong Answer
#import math
#gcd = math.gcd
from fractions import gcd



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

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

ans = 0
MOD = 10**9+7

cur = 1
for a in A:
    cur =  lcm(cur,a)
    
for a in A:
    ans += cur//a
    ans %= MOD
print(ans)
# Judge status: Accepted
a = input()
if int(a) == 3 or int(a) == 5 or int(a) == 7:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
l1 = set(l)
if len(l) == len(l1):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
x=int(input())
while True:
  for j in range(2,x):
    if x%j==0:
      x+=1
      break
  else:
    print(x)
    break
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

def gcd(x,y):
    if y==0: return x
    return gcd(y,x%y)
ans = A[0]
for a in A:
    ans = gcd(ans,a)
print(ans)
# Judge status: Wrong Answer
# coding: utf-8
import math
n = int(input())
t = 0
x = 0
y = 0
txy = []
for i in range(n):
    ti, xi, yi = list(map(int, input().split()))
    txy.append((ti, xi, yi))

for ti, xi, yi in txy:
    if xi - x + yi - y > ti - t:
        print("NO")
        exit()
    elif (xi - x + yi - y - (ti - t)) % 2 != 0:
        print("NO")
        exit()
    else:
        t = ti
        x = xi
        y = yi
print("YES")
# Judge status: Wrong Answer
i,j,n=map(int,input().split())
i_num=i/n
j_num=j/n
cnt=j_num-i_num
#print(cnt)
if i_num % n==0:
  cnt+=1
print(cnt)
# Judge status: Accepted
n=int(input())
s=0
w=1000
for i in range(n):
  d=int(input())
  s+=d
  if d%10:w=min(d,w)
if w==1000:print(0)
else :print(s-(0 if s%10 else w))