peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from math import factorial
N, M = map(int, input().split())
diff = abs(N-M)
ans = -1
mod = 10**9+7
if diff >= 2:
  ans = 0
elif diff == 1: # oxoxo
  ans = factorial(N) * factorial(M)
elif diff == 0: # oxox / xoxo
  ans = 2 * factorial(N) * factorial(M)
print(ans%mod)
# Judge status: Accepted
N=int(input())
L=list(map(int,input().split()))
l=sorted(L)
for i in range(N-1):
  n=(l[0]+l[i+1])/2
  l[0]=n
print(l[0])
# Judge status: Accepted
import math

A, B = map(int, input().split())
min = B * 10
max = B * 10 + 9
flag = False
for i in range(min, max + 1):
    temp = math.floor(i * 0.08)
    if (temp == A):
        flag = True
        ans = i
        break
if flag:
    print(ans)
else:
    print('-1')
# Judge status: Accepted
from itertools import permutations

n = int(input())
box = []
for _ in range(n):
    x,y = map(int,input().split())
    box.append([x,y])
ans = 0
ans_box = list(permutations(range(n)))
cnt = len(ans_box)
for i in range(cnt):
    for j in range(n-1):
        ans += (((box[ans_box[i][j+1]][0] - box[ans_box[i][j]][0]) ** 2 + (box[ans_box[i][j+1]][1] - box[ans_box[i][j]][1]) ** 2 ) ** 0.5)

print(ans/cnt)
# Judge status: Accepted
from collections import deque
S = input()
q = deque()
for s in list(S):
    q.append(s)
Q = int(input())
direction = True
for _ in range(Q):
    line = input()
    if line[0] == '1':
        direction = not direction
    else:
        if (direction and line[2] == '1') or (not direction and line[2] == '2'):
            q.appendleft(line[4])
        else:
            q.append(line[4])
print("".join(q) if direction else "".join(reversed(q)))
# Judge status: Accepted
K = int(input())
A, B = map(int, input().split())

for i in range(A, B+1):
    if i % K == 0:
        print("OK")
        exit()
        
print("NG")
# Judge status: Wrong Answer
N,H = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
B.append(0)
A.sort()
B.sort()
ans = 0
while A[-1] < B[-1]:
    b = B.pop()
    H -= b
    ans += 1
ans += (H+A[-1]-1)//A[-1]
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

# [ok, ng) - Maximum
# (ng, ok] - Minimum
# ok が 最終的な答え
ok = max(A)
ng = 0
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2

    cnt = 0
    for a in A:
        l = (a + mid - 1) // mid
        cnt += l - 1
    if cnt <= K:
        ok = mid
    else:
        ng = mid

print(ok)
# Judge status: Accepted
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def main():

    A, B = inpl()
    print(A * B)

    return


if __name__ == '__main__':
    main()
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 13 03:08:56 2020

@author: liang
"""

N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
ans = 10**10
h.sort()
for i in range(0,N-K+1):
    tmp = h[i+K-1] - h[i]
    ans = min(ans,tmp)
print(ans)
# Judge status: Accepted
from collections import defaultdict
S = list(input())
T = list(input())

Ms = defaultdict(int)
Mt = defaultdict(int)

for i in range(len(S)):
    Ms[S[i]] += 1
    Mt[T[i]] += 1

ans = "Yes"

A = list(Ms.values())
A.sort()
B = list(Mt.values())
B.sort()

for i in range(len(A)):
    if A[i] != B[i]:
        ans = "No"
        break

print(ans)
# Judge status: Wrong Answer
N = int(input())
print("{:}".format(int((N-1)*N/2)))
# Judge status: Wrong Answer
N,M = map(int,input().split())
a = [1]
b = [1]*N

for i in range(M):
  x,y = map(int,input().split())
  b[x-1]-=1
  b[y-1]+=1
  if x ==1 and a == [1]:
    a.remove(1)
    a.append(int(y))
  elif (x in a) and (y not in a):
    a.append(int(y))
    
ans=0

for j in range(len(a)):
  if b[a[j]-1]!=0:
    ans+=1

print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
ans = []
b = [0] * n

for i in range(1,n+1)[::-1]:
    sum_i = sum(b[(i-1)::i])
    if sum_i%2 != a[i-1]:
        ans.append(i)
        b[i-1] = 1

print(len(ans))
if len(ans) != 0:
    print(*ans)
# Judge status: Accepted
S = str(input())
T = str(input())
n = len(S)
for i in range(n):
    S_ = S
    S_ = S_[i:]+S_[0:i]
    if S_ == T:
        print('Yes')
        break
else:
    print('No')
# Judge status: Accepted
N = int(input())
motoS = input()
S = list(motoS)
start = 0
end = 0
for i in range(N):
    if S[i] == '(':
        end += 1
    else:
        end -= 1
    if end < 0:
        start += 1
        end = 0
print('('*start+motoS+')'*end)
# Judge status: Wrong Answer
n = input()
line1 = input()
line2 = input()
line3 = input()

a_list = line1.split(" ")
a_list = [int(a) for a in a_list]
b_list = line2.split(" ")
b_list = [int(b) for b in b_list]
c_list = line3.split(" ")
c_list = [int(c) for c in c_list]

temp = a_list[0]
ans = 0
for a in a_list:
    if a == temp + 1:
        ans = ans + b_list[a-1] + c_list[temp-1]
        print(ans)
    else:
        ans = ans + b_list[a-1]
        print(ans)
    temp = a
print(ans)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
b=0
for x in A:
  if x%2==0:
    if x%3==0 or x%5==0:
      pass
    else:
      b=1
      break
if b==0:
  print("APPROVED")
else:
  print("DENIED")
# Judge status: Wrong Answer
def main():
    N, M = map(int, input().split(" "))
    i = M // N + 1
    while True:
        if M % i == 0:
            break
        elif i == 2:
            break
        else:
            i -= 1
    print(i)


if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == '__main__':
    s = input()
    s = s.replace("hi","")

    if s =="":
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
n=int(input())
a=list(map(int, input().split()))
cnt_4=0
cnt_2=0
for i in range(n):
    if a[i]%4==0:
        cnt_4+=1
    elif a[i]%2==0:
        cnt_2+=1

print('Yes' if cnt_4*2+1>=n or (cnt_4*2+cnt_2>=n) else 'No')
# Judge status: Accepted
a,b = map(int, input().split())
x = a +b
print(int(x/2) if x%2 == 0 else "IMPOSSIBLE")
# Judge status: Wrong Answer
import sys
n, m, k = map(int, input().split())

for i in range(n+1):
    for j in range(m+1):
        if i*(n-j)+(m-i)*j == k:
            print('Yes')
            sys.exit()
print('No')
# Judge status: Accepted
a,b,c=map(int,input().split())
if (4*a*b)<(c-a-b)**2 and c-a-b>0: print('Yes')
else: print('No')
# Judge status: Accepted
N, M = map(int, input().split())
if N > 1:
    number = [1] + [0] * (N-1)
else:
    number = [0]
SC = {}
for _ in range(M):
    s, c = map(int, input().split())
    if SC.get(s, c) != c:
        print(-1)
        exit()
    if N >= 2 and (s == 1 and c == 0):
        print(-1)
        exit()
    number[s-1] = c
    SC[s] = c
print("".join(map(str, number)))
# Judge status: Wrong Answer
N=int(input())
resurt=''
for i in range(1,10):
    if N%i ==0 and N//i<=9:  
        result='Yes'

    else:
        result='No'
print(result)
# Judge status: Accepted
n=int(input())
*a,=map(int,input().split())
l=1
cnt=0
if 1 in a:
	for i in a:
		if i==l:
			cnt+=1
			l+=1
	print(n-cnt)
else:
	print(-1)
# Judge status: Accepted
import math as m
A,B,H,M=list(map(int,input().split()))
print(m.sqrt(A**2+B**2-2*A*B*m.cos(m.radians(30*H-11*M/2))))
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())
print(max(max(b, d) - min(a, c), 0))
# Judge status: Accepted
x, a, b = map(int, input().split())

if a >= b:
    print("delicious")
elif a + x >= b:
    print("safe")
elif a + x < b:
    print("dangerous")
# Judge status: Accepted
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp = [10**9] * n
dp[0] = 0
for i in range(1,n):
    for j in range(max(0,i-k),i):
        dp[i] = min(dp[j] + abs(h[i] - h[j]), dp[i])
print(dp[-1])
# Judge status: Accepted
import math
def main():
    x = int(input())
    print(360 // math.gcd(360, x))

main()
# Judge status: Wrong Answer
k, a, b = map(int, input().split())

if a >= b-1:
    print(k+1)
else:
    if k <= a:
        print(k+1)
    else:
        if k-a % 2 == 1:
            print((k-a)//2*(b-a)+a)
        else:
            print((k-a)//2*(b-a)+a+1)
# Judge status: Wrong Answer
a = list(map(int, input().split()))
print("Yes" if a[0]== a[2] == 5 and a[1] == 7 else "No")
# Judge status: Wrong Answer
N,M = map(int,input().split())

lisN = [0] + [1]*N
ansSet = set([1])

for _ in range(M):
    # print(ansSet,lisN)
    x,y = map(int,input().split())
    if x in ansSet:
        ansSet.add(y)
        lisN[x] -= 1
        lisN[y] += 1

for i,v in enumerate(lisN):
    if v == 0:
        ansSet.discard(i)

print(len(ansSet))
# Judge status: Accepted
import collections
N = int(input())
S = input()

ans=0
for i in range(1, N):
    s = S[:i]
    t = S[i:]
#     print(s, t)
    s1 = set(s)
    t1 = set(t)
#     print(s1, t1)
    c = collections.Counter(s1&t1)
    ans = max(ans, len(c))
print(ans)
# Judge status: Accepted
H, W = map(int, input().split())
if H == 1 or W == 1:
    print("1")
elif H * W % 2 == 0:
    print(H * W // 2)
else:
    print(H * W // 2 + 1)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()


def main():
    n, m = map(int, input().split())
    A = list(map(int, input().split()))

    num = 0
    s = sum(A)
    for a in A:
        if a >= s / (m * 4):
            num += 1
    if num >= m:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()
# Judge status: Accepted
odd = input()
even = input()
for i in range(len(even)):
    print(odd[i] + even[i], end = "")
print((odd[-1] if len(odd) - len(even) else ""))
# Judge status: Wrong Answer
n,a,b = map(int, input().split())
sum = 0
for i in range(10):
  for j in range(10):
    if 10*i+j <= n and a<=i+j and i+j<=b :
      sum += 10*i + j
print(sum)
# Judge status: Wrong Answer
a = 1

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

if 0 in s :
    print(0)
else :
    for i in range(N) :
        if a>10E+17 :
            print(-1)
            break
        else :
            a = a*s[i]
    if a>10E+17 :
        print("-1")
    else :
        print(a)
# Judge status: Wrong Answer
a = input("")
a_num = a.index("A")
for i in range(len(a)-1,-1,-1):
    if a[i]=="Z":
        z_num = i+1
        break
print("num:" + str(len(a[a_num:z_num])) + \
    "text:" + a[a_num:z_num])
# Judge status: Accepted
s = input()

ans = 0
t = 0
for c in s:
    if c == "R":
        t += 1
    else:
        ans = max(ans, t)
        t = 0
ans = max(ans, t)


print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
if n>1:
    if n%k==0:
        print("0")
    else:print("1")
    
if n==1:
    print("0")
# Judge status: Wrong Answer
N,M=map(int,input().split())
P=[[x] for x in range(N)]

for _ in range(M):
    p,y=map(int,input().split())
    P[p-1].append(y)
code=[]
for i in range(N):
    temp=sorted(P[i][1:])
    for j in range(len(temp)):
        code.append(str(i+1).zfill(6)+str(j+1).zfill(6))

code.sort()
for c in code:
    print(c)
# Judge status: Accepted
n = float(input())
even_num = n // 2;
num = n - even_num
print(num/n)
# Judge status: Wrong Answer
X = list(map(int,list(input())))

for i in range(2**3+1):
  ans =[]
  for j in range(3):
    d = X[j+1]*(-1)**((i >>j)&1)
    ans.append(d)
  if sum(ans) == 7:
    print(X[0],end="")
    for i,a in enumerate(ans):
      if a>=0 and i>0:
        print("+",end="")
      print(a,end="")
    print("=7")
    exit()
# Judge status: Wrong Answer
S=input()
N = len(S) + 1
ary = [0] * N
for i in range(N-1):
    if S[i] == "<":
        ary[i+1] = ary[i] + 1

for i in range(N-2,0,-1):
    if S[i] == ">":
        ary[i] = max(ary[i], ary[i+1] + 1)

print(sum(ary))
# Judge status: Wrong Answer
N,K=map(int,input().split())
print(N%K)
# Judge status: Accepted
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(2,N):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[N-1])
# Judge status: Accepted
def resolve():
    n = int(input())
    h = list(map(int, input().split()))
    flag = 0
    for i in range(n-1):
        if h[i] == h[i+1]:
            continue
        else:
            h[i+1] -= 1
            if h[i] <= h[i+1]:
                continue
            else:
                print("No")
                exit()
    print("Yes")
resolve()
# Judge status: Accepted
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    ABC = LI()
    K = I()
    ABC.sort()

    ans = sum(ABC[:2]) + ABC[2] * 2 ** K
    print(ans)

if __name__ == '__main__':
    resolve()
# Judge status: Accepted
n, k = map(int, input().split())

ps = list(map(int, input().split()))
cur = 0
for i in range(k):
    cur += ps[i] + 1

mx = cur

for i in range(n-k):
    j = i+k
    cur += -ps[i] + ps[j]
    mx = max(mx, cur)

print(mx / 2)
# Judge status: Accepted
N,M=map(int,input().split())
graph=[[] for _ in range(N)]
for _ in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    graph[a].append(b)
    graph[b].append(a)

for i in range(N):
    print(len(graph[i]))
# Judge status: Accepted
#!/usr/bin/env python3
import sys


input = sys.stdin.readline
def IS(cb): return cb(input().strip())
def IL(cb): return [cb(s) for s in input().strip().split()]
def IR(cb, rows): return [IS(cb) for _ in range(rows)]
def ILL(cb, rows): return [IL(cb) for _ in range(rows)]


def solve():
    K = IS(int)
    S = IS(str)
    if len(S) <= K:
        print(S)
    else:
        print(S[:K] + '...')


solve()
# Judge status: Wrong Answer
A, B = [int(i) for i in input().split()]
result = 1
require_socket = B - A

if B == 1:
    print(0)
else:
    result += require_socket // A
    if (require_socket / A).is_integer() is False:
        result += 1

print(result)
# Judge status: Wrong Answer
S_list = list(map(int,input().split()))

if  S_list[1] - S_list[0] == S_list[2] - S_list[1]:
    result = "YES"
else:
    result = "No"
print(result)
# Judge status: Accepted
N = int(input())
A = [int(input()) for _ in range(N)]

sort_A = sorted(A, reverse=True)
max_value = sort_A[0]
second_value = sort_A[1]

ans = []

for a in A:
    if a < max_value:
        ans.append(max_value)
    elif a == max_value:
        ans.append(second_value)

print(*ans, sep='\n')
# Judge status: Accepted
a, b, x = map(int,input().split())

a_divmod = divmod(a, x)
if a_divmod[1] != 0:
    print(b//x - a_divmod[0])
else:
    print(b//x - a_divmod[0] + 1)
# Judge status: Wrong Answer
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
for k in range(y):
    print("u")
for k in range(x+1):
    print("r")
for k in range(y+1):
    print("d")
for k in range(x+1):
    print("l")
print("u")
print("l")
for k in range(y+1):
    print("u")
for k in range(x+1):
    print("r")
for k in range(y+1):
    print("d")
print("l")
# Judge status: Wrong Answer
import math
val = list(input().split())
ans = float(val[0]) * float(val[1])

print(int(ans))
# Judge status: Wrong Answer
s = input()
if s[-1] == "s":
    print(s+"s")
else:
    print(s+"es")
# Judge status: Wrong Answer
N,M = map(float,input().split())
import math
from decimal import *
print(math.floor(Decimal(N*M)))
# Judge status: Accepted
N,A,B=map(int,input().split())
if A>B:
  print(0)
elif N==1 and A!=B:
  print(0)
else:
  print((N-2)*(B-A)+1)
# Judge status: Accepted
n,k = map(int,input().split())
x = list(map(int,input().split()))
times = []
for i in range(n-k+1):
    tl =abs(x[i])
    tr = abs(x[i+k-1])
    tw = abs(x[i]-x[i+k-1])
    times.append(min(tl,tr)+tw)
print(min(times))
# Judge status: Accepted
a, b = map(int, input().split())
for i in range(20):
    if a*i-(i-1) >= b:
        print(i)
        break
# Judge status: Accepted
n = int(input())

ac = 0
wa = 0
tle = 0
re = 0

for i in range(n):
    s = str(input())
    if s == 'AC':
        ac += 1
    elif s == 'WA':
        wa += 1
    elif s == 'TLE':
        tle += 1
    else:
        re += 1

print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(tle))
print('RE x '+str(re))
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    a = list(map(int, input().split()))

    S = [0] * N
    S[0] = a[0]
    for i in range(N - 1):
        S[i + 1] = S[i] + a[i + 1]

    ans = float("inf")
    for i in range(N - 1):
        x = S[i]
        y = S[-1] - x
        cost = abs(x - y)
        if cost < ans:
            ans = cost

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
s,t=input().split()
a,b=map(int,input().split())
u=input()
if len(u)==len(s):
    print(a-1, b)
else:
    print(a, b-1)
# Judge status: Accepted
n, m = map(int, input().split())
if m % 2 == 0 and n * 2 <= m <= n * 4:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
lcm = a[0]
for i in range(1,n):
  lcm = lcm*a[i] // gcd(lcm,a[i])
mod=pow(10,9)+7
ans=0
for x in a:
  ans+=lcm//x
print(ans%mod)
# Judge status: Wrong Answer
K, A, B = map(int, input().split())

if(B-A <= 2):
    print(K+1)
else:
    m = max(0, K-(A-1)//2)*(B-A)+(K+1)-2*max(0, K-(A-1)//2)
    print(m)
# Judge status: Accepted
w, h, x, y = list(map(int, input().split()))

flag = 0

if x * 2 == w and y * 2 == h:
    flag = 1

print(w * h / 2, flag)
# Judge status: Accepted
import sys
readline = sys.stdin.readline
import math

def main():
    N = int(readline())
    CSF = [list(map(int, readline().rstrip().split())) for _ in range(N-1)]
    
    for i in range(N):
        t = 0
        for c, s, f in CSF[i:]:
            m = (t - s) / f
            m = max(math.ceil(m), 0)
            t = s + f * m + c
        print(t)


if __name__ == '__main__':
    main()
# Judge status: Accepted
# D - Sum of Large Numbers

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

modulus = 10 ** 9 + 7

s = 0
# m個選ぶ
for m in range(k, n + 2):
    s += (m * (n - m + 1) + 1) % modulus  # 最小から最大までの個数

print(s % modulus)
# Judge status: Accepted
n = int(input())
c = []
s = []
f = []
for _ in range(n-1):
   ci, si, fi = map(int, input().split())
   c.append(ci)
   s.append(si)
   f.append(fi)

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
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(d)]
for i in range(d):
    cand=0
    for j in range(26):
        if s[i][cand]<s[i][j]:
            cand=j
    print(cand+1)
# Judge status: Accepted
import math

n = int(input())
a = []
for i in range(5):
  a.append(int(input()))
  
mi = min(a)
ans = 5

ans += math.ceil((n-mi)/mi)

print(ans)
# Judge status: Accepted
import math
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sum_A = sum(A)
sum_B = sum(B)
cnt1 = sum_B - sum_A
cnt2 = 0
for a, b in zip(A, B):
    # if a > b:
    #     cnt2 += a - b
    if a < b:
        cnt2 += math.ceil((b - a) / 2)

if cnt1 >= cnt2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b = map(int, input().split())
l = [str(i) for i in range(a,b+1)]
ans = 0

for i in l:
    if i[0] == i[4]:
        if i[1] == i[3]:
            ans += 1
print(ans)
# Judge status: Accepted
N = int(input())
Ss = [input() for _ in range(N)]

set_s = set(Ss)
print(len(set_s))
# Judge status: Wrong Answer
n,m=map(int,input().split())
l=list(input().split() for i in range(m))
l=[[int(i[0]),i[1]] for i in l]

count=[[i+1,0,0,1] for i in range(n)]
ans=0
pen=0

for i in l:
  for j in count:
    if i[0]==j[0]:
      if j[3]==1:
        if i[1]=='WA':
          pen+=1
        else:
          ans+=1
          j[3]*=0

print(ans,pen)
# Judge status: Accepted
N,K = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
A = sorted(A,key=lambda x:x[0])
cnt = 0
i = 0
while K>cnt:
    cnt += A[i][1]
    i += 1
print(A[i-1][0])
# Judge status: Accepted
s = input()
n = len(s)
for i in range(n):
    for j in range(i, n + 1):
        if s[:i] + s[j:] == 'keyence':
            print('YES')
            exit(0)
print('NO')
# Judge status: Accepted
a, b = map(int, input().split())
if a <= b:
  print(a)
else:
  print(a-1)
# Judge status: Accepted
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
flag = True
for i in range(n):
    t,x,y = iim()
    if x+y > t or t%2 != (x+y)%2:
        flag = False

print('Yes' if flag else 'No')
# Judge status: Accepted
S = input()
T = input()
MIS = len(S)
for TS in range(0,len(S)-len(T)+1):
    LS = S[TS:TS+len(T)]
    Count = sum(True if LS[TT]!=T[TT] else False for TT in range(0,len(T)))
    MIS = min(MIS,Count)
print(MIS)
# Judge status: Accepted
N, M, X = map(int,input().split())

C = list()
A = list()
for i in range(N):
	temp = list(map(int,input().split()))
	C.append(temp[0])
	A.append(temp[1:])	


MAX = 100000000000	

def func(cost,a,i):
	if min(a) >= X:
		return cost
	elif i == N:
		return MAX
	total_A = [x+y for (x,y) in zip(a,A[i])]
    
	return min(func(cost + C[i],total_A,i+1),func(cost,a,i+1))
	
ans = func(0,[0]*M,0)

if ans == MAX:
	print(-1)
else:
	print(ans)
# Judge status: Accepted
L=int(input())
x=L/3
v=x**3
print(v)
# Judge status: Accepted
A, B, X = map(int, input().split())
print('YES' if A <= X <= (A+B) else 'NO')
# Judge status: Accepted
from collections import deque
n,m = map(int,input().split())
graph = [[] for _ in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)
ans = [-1 for _ in range(n+1)]
ans[1] = 0
q = deque()
q.append(1)
while q:
    x = q.popleft()
    for y in graph[x]:
        if ans[y] == -1:
            q.append(y)
            ans[y] = x
print("Yes")
for i in range(2,n+1):
    print(ans[i])
# Judge status: Accepted
n, k = map(int, input().split())
s = input()

s = s[ :k -1] + chr(ord(s[k - 1]) - ord("A") + ord("a")) + s[k:]
print(s)
# Judge status: Accepted
n,k=[int(j)for j in input().split()]
a=[int(j)for j in input().split()]
if n<=k:
    print(*[n]*n)
    exit()
import copy
for _ in range(k):
    table=[0]*n
    for i in range(n):
        table[max(i-a[i],0)]+=1
        if i+a[i]+1<n:
            table[i+a[i]+1]-=1
    for i in range(1,n):
        table[i]+=table[i-1]
    a=copy.deepcopy(table)
    if a==[n]*n:
        break
print(*a)
# Judge status: Wrong Answer
A,B,C = input().split()
m = max(eval(A+B+"+"+C),eval(A+"+"+B+C))
print(m)
# Judge status: Wrong Answer
X, Y = map(int, input().split())
if Y % X == 0:
    print(-1)
    exit(0)
i = 2
while X * i <=10 ** 18:
    if X * i % Y != 0:
        print(X * i)
        exit(0)
print(-1)
# Judge status: Wrong Answer
import math
N,M = map(int,input().split())
l = [int(i) for i in input().split()]
l.sort(reverse = True)
l_sum = sum(l)
d = (1/(4*M))*l_sum
d = int(d)
cnt = 0
 
for i in range(N):
    if l[i] > d:
        cnt += 1
    else:
        break
 
if cnt >= M:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import itertools
import math
N = int(input())
ll = list()
for n in range(N):
    l = list(map(int, input().split()))
    ll.append(l)
p = list()
for i in range(N):
    p.append(i)

p = itertools.permutations(p)
total = 0
for i in p:
    for s in i:
        if s == len(i) - 2:
            total += math.sqrt((ll[s + 1][0]-ll[s][0])**2 + (ll[s + 1][1]-ll[s][1])**2)

total = total / len(i)
print(total)
# Judge status: Accepted
a,b = map(int,input().split())
ans = int((a*(a-1))/2+(b*(b-1)/2))
print(ans)