peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
k = list(input())
ans = "No"
for i in k:
    if sum(x == i for x in k) >= 3:
        ans = "Yes"
print(ans)
# Judge status: Accepted
N,T = map(int, input().split())
tl = []
for i in range(N):
    c,t = map(int, input().split())
    if t <= T:
        tl.append(c)
if len(tl) == 0:
    print('TLE')
else:
    print(min(tl))
# Judge status: Wrong Answer
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
x = e - a
if x <= k:
  print('Yey!')
else:
  print(':(')
# Judge status: Wrong Answer
from collections import Counter
n = int(input())

L = list(map(int,input().split()))
sum_all = sum(L)
L = Counter(L)
#print(L)
q = int(input())
sum1 = sum_all
for i in range(q):
    
    a,b = map(int,input().split())
    #print(L)
    if a not in L:
        L[b] = 0
    else:
        L[b] +=L[a] 
    #print(L)
    sum1 = sum1 + b*L[a] - a*L[a]
    L[a] =0
    
    #print(L)
    print(sum1)
# Judge status: Wrong Answer
def times(X):
    if X == int(X):
        if 1<= X <= 179:
            K = 360/X
            if int(K) < K :
                K = int(int(K) + 1)
                print(K)
            else:
                K = int(K)
                print(K)
# Judge status: Accepted
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))
ans = float('INF')
pos = 0
for i in range(n):
  temp = t - h[i] * 0.006
  if abs(temp - a) < ans:
    ans = abs(temp - a)
    pos = i + 1
print(pos)
# Judge status: Wrong Answer
n = int(input())
h = list(map(int, input().split()))

dp = [0] * n
dp[1] = abs(h[1] - h[0])

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

print(dp)
# Judge status: Wrong Answer
import math
n, p, *a = map(int, open(0).read().split())


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


memo = [0, 0]
for i in range(n):
    memo[a[i] % 2] += 1
# p == 0


ans = 0
if p == 0:
    for i in range(0, memo[1], 2):
        ans += c(memo[1], i) * pow(2, memo[0])
else:
    for i in range(1, memo[1], 2):
        ans += c(memo[1], i) * pow(2, memo[0])
# p == 1
print(ans)
# Judge status: Accepted
n,l = [int(i) for i in input().split(' ')]
a = sorted([l+i-1 for i in range(1,n+1)])
x = 0
ab = 101
for i in a:
    if abs(i) < ab:
        ab = abs(i)
        x =  sum(a) - i

print(x)
# Judge status: Wrong Answer
#Take the value of X
#Take the value of Y
#Do double equation

X, Y = map(int, input().split(" "))

C = (Y-4*X)/-2

T = X - ((Y-4*X)/-2)

total = int(T + C)

if (T<0) or (C<0):
    print("No")
elif (T+C) == X and (4*T + 2*C) == Y:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
sr_list = list(input().split())
r_count = sr_list.count('R')
if r_count == 0:
  print('0')
elif r_count == 1:
  print('1')
elif r_count ==3:
  print('3')
else:
  if sr_list[1] == 'S':
    print('1')
  else:
    print('2')
# Judge status: Accepted
N = int(input())

cnt = 0
for i in range(1, N+1):
    k = 0
    while True:
        k += 1
        if 10 ** k > i: break
    if k % 2 == 1:
        cnt += 1
print(cnt)
# Judge status: Accepted
a=input()
a=list(a)
count=0
for i in a:
  if i=='1':
    count+=1
print(count)
# Judge status: Wrong Answer
a,b = map(int, input().split())
if a == (1 or 3 or 5 or 7 or 8 or 10 or 12) and b == (1 or 3 or 5 or 7 or 8 or 10 or 12):
  print('Yes')
elif a == (4 or 6 or 9 or 11) and b == (4 or 6 or 9 or 11):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
S = input()

if S.count("a") == 1 and S.count("b") == 1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
k = int(input())
from collections import deque
q = deque() # FIFOキューの作成
for i in range(1,10):
    q.append(str(i))


for i in range(k-1):
    a = q.popleft()
    last = int(a[-1:])
    if last == 0:
        q.append(a+"0")
        q.append(a + "1")
    elif last ==9:
        q.append(a+"8")
        q.append(a + "9")
    else:
        q.append(a + str(last - 1))
        q.append(a + str(last ))
        q.append(a + str(last + 1))

print(q.popleft())
# Judge status: Accepted
import bisect
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort()
C.sort()
cnt = 0

for b in B:
    a_index = bisect.bisect_left(A,b)
    c_index = bisect.bisect_right(C,b)
    cnt += a_index*(len(C)-c_index)

print(cnt)
# Judge status: Accepted
N=int(input())
D=list(map(int,input().split()))
D.sort()

n_1=int(N/2)-1
n_2=int(N/2)
print(D[n_2]-D[n_1])
# Judge status: Wrong Answer
import heapq

n = int(input())
abs = [tuple(map(int, input().split())) for _ in range(n)]

pq = []

for ab in abs:
  a,b = ab[0],ab[1]
  heapq.heappush(pq, tuple([b,a]))
  
dl = 0
tc = 0

ans = "Yes"

for i in range(n):
  ba = pq.pop()
  dl += ba[0]
  tc += ba[1]
  if dl < tc:
    ans = "No"
    break
print(ans)
# Judge status: Accepted
s=input()
k =int(input())
for i in range(k):
    if s[i] != '1':
        ans = s[i]
        break
    elif i < k-1:
        ans = s[i+1]
    else:
        ans = s[i]
        
print(ans)
# Judge status: Wrong Answer
N=int(input())
g = []
a = 6
while a <= 100000:
  g.append(a)
  a *= 6
a = 9
while a <= 100000:
  g.append(a)
  a *= 9
g.sort(reverse=True)
ans = 0
for a in g:
  while N > a:
    N -= a
    ans += 1
print(ans+N)
# Judge status: Wrong Answer
K=int(input())
x=0
if K%2==0:
    print(-1)
    exit()
for i in range(K+1):
    x=(x*10+7)%K
    if x==0:
        print(i+1)
        break
# Judge status: Wrong Answer
X = str(input())

tmorethans = 0
totalts = 0
Nagasa = len(X)

for i in range (0, len(X)+1):
	if 2*totalts == Nagasa:
		print(2*tmorethans)
		exit()
	elif X[i] == 'T':
		tmorethans+=1
		totalts+=1
	else:
		tmorethans-=1
# Judge status: Wrong Answer
def main():
  n,l = list(map(int,input().split()))
  ans=0
  if l>=0:
    for i in range(2,n+1):
      ans+= l+i-1
  elif n+l<0:
    for i in range(1,n):
      ans+=l+i-1
  else:
    for i in range(1,n+1):
      ans+=l+i-1
  print(ans)  
main()
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
ANS=[]
ANS2=[]
for i in range(N):
  ANS+=[[A[i],i+1]]
ANS.sort()
for i in range(N):
  print(ANS[i][1])
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count=0
for c1 in range(0,c+1):
    for b1 in range(0,b+1):
        for a1 in range(0,a+1):
            if a1*500+b1*100+c1*50==x:
                count=count+1
print(count)
# Judge status: Wrong Answer
N = int(input())
# L = 800 / N 
B = 0
for i in range(N):
    if i % 15 == 0:
        B += 1
L = 800 * N
C = B * 200
print(L - C)
# Judge status: Wrong Answer
h,n = map(int, input().split())
ab,e = [],[]
for i in range(n):
  a,b = map(int, input().split())
  ab.append([a/b,a,b])
ab.sort(reverse=True)
ans = (h//ab[0][1])*ab[0][2]
o = h-(h//ab[0][1])*ab[0][1]
f = [i[2] for i in ab if i[1] >= o]
add = 0
if f != []:
  add = min(f)
print(ans+add)
# Judge status: Accepted
import bisect
n = int(input())
a,b,c = [sorted(list(map(int,input().split()))) for i in range(3)]
ans = sum([bisect.bisect_left(a,i)*(n-bisect.bisect(c,i)) for i in b])
print(ans)
# Judge status: Accepted
first = input()
first = first.split()

N = int(first[0])
L = []
for i in range(N):
  s = input()
  L.append(s)
  
L.sort()
for i in L:
  print(i,end="")
# Judge status: Accepted
import functools
import fractions
N=int(input())
A=list(map(int,input().split()))
print(functools.reduce(fractions.gcd,A))
# Judge status: Accepted
def main():
    A = sorted(list(map(int, input().split())))
    print(sum(A[:2]))


if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys
n,k = map(int,input().split())
a = list(map(int,input().split()))

dp = [sys.maxsize]*n
dp[0]=0

#print(dp)
for i in range(n):
  for j in range(i+1,i+k+1):
    if j<n:
      dp[j] = min(dp[j],dp[i]+abs(a[i]-a[j]))
  #print(dp)
      
print(dp[n-1])
# Judge status: Accepted
s = input()
l = len(s)

for i in range(l)[::2]:
    if s[:-i-2] == s[:len(s[:-i-2])//2]*2:
        print(len(s[:-i-2]))
        exit()
# Judge status: Accepted
n=input()
a=0
for i in range(len(n)):
  a+=int(n[i])
if a%9==0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N, M = map(int, input().split())
if(N == 1 and M == 1):
  print(1)
elif(N == 1 or M == 1):
  print(N*M-2)
else:
  print((N-2)*(M-2))
# Judge status: Accepted
from collections import defaultdict

N=int(input())
S=[input() for _ in range(N)]

cnt=defaultdict(int)
for i in range(len(S[0])):
    cnt[S[0][i]]+=1

for i in range(1,N):
    tmp=defaultdict(int)
    for j in range(len(S[i])):
        tmp[S[i][j]]+=1
    for key,count in cnt.items():
        if count>tmp[key]:
            cnt[key]=tmp[key]

ans=[]
for key,count in cnt.items():
    for _ in range(count):
        ans.append(key)
ans.sort()
print("".join(ans))
# Judge status: Accepted
n = int(input())
d = [int(i) for i in input().split()]
d.sort()
mn = n//2-1
mx = n//2
ans = d[mx]-d[mn]
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
H = list(map(int, input().split()))
OK = [True] * N
for _ in range(M):
    A, B = map(lambda x: int(x)-1, input().split())
    if H[A] < H[B]:
        OK[A] = False
    elif H[A] > H[B]:
        OK[B] = False
    else:
        OK[A] = False
        OK[B] = False

ans = sum(OK)
print(ans)
# Judge status: Wrong Answer
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

rT = T - (H[0]*0.006)
dif = A - rT
ans = 1

for i in range(1, N):
    rTi = T - (H[i]*0.006)
    e_dif = A - rTi
    if e_dif<dif:
        dif = e_dif
        ans = i+1

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

count_5 = 0
count_7 = 0

if a == 5:
    count_5 += 1
elif a == 7:
    count_7 += 1

if b == 5:
    count_5 += 1
elif b == 7:
    count_7 += 1

if c == 5:
    count_5 += 1
elif c == 7:
    count_7 += 1

if count_5 == 2 and count_7 == 1:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
M = int(input())
A = list(map(int, input().split()))
ans=0
for i in range(len(A)):
    if i%2==0:
        if A[i]%2==1:
            ans=ans+1
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
dic = {}
for i in a:
    if i not in dic:
        dic[i] = 1
    else:
        dic[i] += 1
ans = 0
for k, v in dic.items():
    if k > v:
        ans += v
    elif k < v:
        ans += k - v

print(ans)
# Judge status: Wrong Answer
s = input()
if s <= '2019/04/30':
  print('Heisei')
print('TBD')
# Judge status: Accepted
N = int(input())
S = [None] * N
for i in range(N):
    S[i] = input()

C = []
for s in S:
    T = tuple(sorted(s))
    C.append(T)

dic = {}
for i in range(N):
    if C[i] in dic:
        dic[C[i]] += 1
    else:
        dic[C[i]] = 1

ans = 0
for x in dic.values():
    ans += x * (x - 1) // 2
print(ans)
# Judge status: Wrong Answer
N, X = map(int, input().split())
lists = list(map(int, input().split()))

if X - sum(lists) > 1:
    print(len(lists) - 1)
    exit()

count = 0
for num in sorted(lists):
    X -= num
    if X >= 0:
        count += 1
        if num == lists[-1]:
            break
        continue
    break
print(count)
# Judge status: Accepted
N, L = map(int, input().split())
lst = []
for i in range(N):
  lst.append(input())

slst = sorted(lst)
print("".join(slst))
# Judge status: Accepted
N = int(input())
S = [list(input()) for _ in range(N)]

result = S[0]
for i in range(1,N):
    temp = []
    for j in S[i]:
        if j in result:
            temp.append(j)
            result.remove(j)
    result = temp       
result.sort()
print("".join(result))
# Judge status: Wrong Answer
A, B, C = map(int,input().split())
print(A//B)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

MOD = 10**9 + 7

S1, S2 = 0, 0
for a in A:
    S1 += a
    S2 += a * a % MOD
    S1 %= MOD
    S2 %= MOD

print(((S1*S1%MOD-S2+MOD) % MOD) * pow(2,MOD-2,MOD) % MOD)
# Judge status: Accepted
n, k = map(int, input().split())
min = [0] * (n + 1)
max = [0] * (n + 1)
min[0] = 0
max[0] = n
for i in range(1, n + 1):
    min[i] = min[i - 1] + i
    max[i] = max[i - 1] + n - i

# print(min)
# print(max)
sum = 0
for i in range(k - 1, n + 1):
    sum = sum + max[i] - min[i] + 1
print(sum % (pow(10, 9) + 7))
# Judge status: Accepted
a,b,c,d = list(str(input()))
op = ('+', '-')
for i in range(2):
  for j in range(2):
    for k in range(2):
      result = eval(a + op[i] + b + op[j] + c + op[k] + d)
      if result == 7:
        print(a + op[i] + b + op[j] + c + op[k] + d + '=7')
        exit()
# Judge status: Accepted
#全部1にしたい
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
#端っこから区間をあらかじめ区切っておく
ans=0
i=0
while i<n-1:
  ans=ans+1
  i=i+k-1
  
  
print(ans)
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
import collections
import bisect

def main():
    n,l = map(int, input().split())
    array = [input() for _ in range(n)]

    array.sort()
    print('a'.join(array))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n, k = map(int, input().split())
s = 0
for _ in range(n):
    a, b = map(int, input().split())
    s += b
    if k <= s:
        print(a)
        exit()
# Judge status: Wrong Answer
def main():
    s = sorted(input())
    print('Yes' if s=='abc' else 'No')

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

a,b,c,d=I()
if abs(a-b)<=d and abs(b-c)<=d:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

point = 0

all_taste = p + q + r
all_taste.sort(reverse=True)

for i in range(0, X + Y):
    point += all_taste[i]

print(point)
# Judge status: Accepted
k = int(input())
A,B = map(int,input().split())
t = (A//k)+1 if A%k != 0 else A//k
s = B//k
print('OK'if t<=s else 'NG')
# Judge status: Accepted
def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    threshold = sum(A) / (4 * M)
    if sorted(A, reverse=True)[M-1] >= threshold:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
N=input()
if "9" in N:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
x = []
l = []
for i in range(N):
    x1,l1=[int(i) for i in input().split()]
    x.append(x1)
    l.append(l1)

Range = []

for i in range(N):
  max_i = x[i] + l[i]
  min_i = x[i] - l[i]
  Range.append((min_i,max_i))

Range = sorted(Range, key = lambda x:x[1])

a = 1
for i in range(N-1):
  if Range[a][0] >= Range[a-1][1]:
    a += 1
  else:
    Range.pop(a)

print(a)
# Judge status: Accepted
def main():
    import sys
    import numpy as np
    n, k = map(int, input().split())
    h = list(map(int, sys.stdin.readline().split()))
    h = np.array(h, dtype=np.int32)
    ans = np.full(n, 10**9, dtype=np.int32)
    ans[0] = 0
    for i in range(n):
        ans[i:i+k+1] = np.minimum(ans[i:i+k+1], ans[i]+np.abs(h[i:i+k+1]-h[i]))

    print(ans[n-1])

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

c = [0]*n
d = [0]*n

for i, j in enumerate(a):
    c[i] = i + j

for i, j in enumerate(a):
    d[i] = i - j

x = {}
for i, j in enumerate(c):
    if j not in x:
        x[j]=[i]
    else:
        x[j].append(i)
ans = 0
for i in d:
    if i not in x:
        continue
    else:
        ans += len(x[i])
print(ans)
# Judge status: Accepted
s = input()
end = len(s)
flg = False
for i in range(end):
    for j in range(i,end):
        string = s[:i] + s[j:]
        if string == 'keyence':
            flg = True
            break
            
print('YES' if flg else 'NO')
# Judge status: Wrong Answer
import math
a, b= map(int,input().split())
d= math.gcd(a,b)
print(a*b/d)
# Judge status: Accepted
d,t,s = map(int,input().split())
if (d/s) <= t:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
num = int(input())
ans = num%9

if ans == 0:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
def solve(string):
    h, a = map(int, string.split())
    return str((h - 1) // a + 1)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
# Judge status: Wrong Answer
a,b = map(int,input().split())
div = 1000000007

if abs(a-b)>1:
    print(0)
else:
    print(a*b*2%div)
# Judge status: Accepted
def ip():return int(input())
a=[]
for i in range(5):
    a.append(ip())
k=ip()

for i in range(4):
    for j in range(i+1,5):
        if a[j]-a[i]>k:
            print(":(")
            exit()
print("Yay!")
# Judge status: Wrong Answer
n=int(input())
s=str(input())
t=str(input())

cnt=0

if s==t:
  print(n)
else:
  for i in range(n):
    if s[-i-1]==t[i]:
      cnt+=1
    else:
      break
      
print(n*2-cnt)
# Judge status: Accepted
import math
def A():
    N, M = map(int, input().split())
    if N == 1 == M:
        print(0)
        return
    ans = 0
    if N > 1:
        ans += math.factorial(N)//(2*(math.factorial(N-2)))
    if M > 1:
        ans += math.factorial(M)//(2*(math.factorial(M-2)))
    print(ans)

A()
# Judge status: Wrong Answer
from math import atan, degrees
a,b,x = map(int, input().split())

if x >= a*b/2:
  print(degrees(atan((b-x/(a**2))*2/a)))
else:
  print(90 - degrees(atan(2*x/(a*(b**2)))))
# Judge status: Wrong Answer
x=input()
x=list(x)
y=int(input())
a=(len(x))

for i in range(a):
	if ord(x[i])+y>=123:
		y=y-(123-ord(x[i]))
		x[i]='a'
while (ord(x[a-1])+y)>123:
	y=y-26
x[a-1]=chr(ord(x[a-1])+y)
print(*x,sep='')
# Judge status: Accepted
S=input().split()
print(len(set(S)))
# Judge status: Accepted
import sys
s=input()
t=input()

s=list(s)
t=list(t)
u=s[:]

for i in range(len(s)):
    u.append(s[i])
    u.remove(u[0])
    if u==t:
        print('Yes')
        sys.exit()
print('No')
# Judge status: Accepted
S = input()

if "A" in S and "B" in S:
    print("Yes")
    exit(0)
print("No")
# Judge status: Accepted
a,b=map(int,input().split())


for x in range(10000):
  if int(x*0.08)==a and int(x*0.1)==b:
    print(x)
    exit()

print(-1)
# Judge status: Wrong Answer
n, m = map(int,input().split())

h = list(map(int,input().split()))

temp_h = h.copy()

for _ in range(m):
    x1, x2 = map(int,input().split())

    temp_h[x1 - 1] = max([temp_h[x1 - 1], h[x2 - 1]])
    temp_h[x2 - 1] = max([h[x1 - 1], temp_h[x2 - 1]])

res = [1 if x - y else 0 for x, y in zip(h, temp_h)]

print(sum(res))
# Judge status: Accepted
S = input()
N = len(S)
A = [-1 for i in range(N+1)]
if S[0] == "<":
  A[0] = 0
if S[-1] == ">":
  A[-1] = 0
  
for i in range(N):
  if S[i:i+2] == "><":
    A[i+1] = 0

#print(A)

for i in range(N):
  if S[i] == "<":
    A[i+1] = max(A[i]+1, A[i+1])
    
for i in range(N):
  if S[N-i-1] == ">":
    A[N-i-1] = max(A[N-i]+1, A[N-i-1])
    
#print(A)
print(sum(A))
# Judge status: Accepted
def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    ans = 0
    mod = 10 ** 9 + 7
    for d in range(60):
        # d桁目ごとに考える
        x = 0
        for a in A:
            if (a >> d) & 1:
                x += 1
        ans += x * (n-x) * 2**d
        ans %= mod
    print(ans)
 
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N=int(input())
A=[]
B=list(range(2,10))
B=B[::-1]
for i in B:
    while N%i==0:
        A.append(i)
        N//=i
if 1<=len(A)<=2:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
ans = 0

for i in range(1, n + 1):
  if i % 2 == 0:
    continue
  else:
    ans += 1
    
print(ans)
# Judge status: Accepted
import numpy as np
import sys

def main():
    N,M=map(int,input().split())
    A=list(map(int,input().split()))
    A_double=list(map(lambda x:x//2,A))

    mini_multi=int(np.lcm.reduce(A_double))

    res=M//mini_multi
    
    for i in A_double:
        if (mini_multi//i)%2==0:
            print(0)
            sys.exit()

    if res%2!=0:
        res+=1


    print(res//2)





if __name__=="__main__":
    main()
# Judge status: Accepted
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
l = [1] * (n+1)
for j in a:
  l[j] = 0
x = 10 ** 9 + 7
if m > n // 2:
  print(0)
else:
  dp = [0] * (n+1)
  dp[0] = 1
  if 1 not in a:
    dp[1] = 1
  for i in range(2, n+1):
    if l[i]:
      dp[i] = (dp[i-1] + dp[i-2]) % x
  print(dp[-1])
# Judge status: Wrong Answer
def cmin(a,b):
    if a>b:
        return b
    else:
        return a
 
N = int(input())
h = list(map(int,input().split()))
 
dp = [0] + [float("inf")]*(N-1)
for i in range(1,N):
    dp[i] = cmin(dp[i],dp[i-1]+abs(h[i]-h[i-1]))
print(dp[-1])
# Judge status: Accepted
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = [0]*n
for i in range(n):
    if i>=k:
        if a[i]-a[i-k]>0:
            print("Yes")
        else:
            print("No")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
mi=min(a)
ma=max(a)
i=mi
ans=10**10
while i<=ma:
    x=sum((a[j]-i)**2 for j in range(n))
    ans=min(ans,x)
    i+=1
print(ans)
# Judge status: Accepted
n=int(input())

result = 10**12
for i in range(1,int(n**0.5)+1):
  if n % i == 0:
    result = min(result, i + n//i)

print(int(result-2))
# Judge status: Wrong Answer
n = int(input())
ma = 0
for i in range(n//2):
    if i**2 <= n and ma <= i**2:
        ma = i**2
print(ma)
# Judge status: Accepted
a, b = map(int,input().split())

i = 0
while True:
  if a + (i-1)*(a-1) >= b:
    ans = i
    break
  i += 1

print(ans)
# Judge status: Wrong Answer
from math import factorial


def cmb(n,r):
    return factorial(n)//(factorial(n-r)*factorial(r))


n,p=map(int,input().split())
A=list(map(int,input().split()))
A=[A[i]%2 for i in range(n)]

cnt=A.count(0)
ans=0
for i in range(p,n-cnt+1,2):
    ans +=cmb(n-cnt,i)
print(ans*(cnt**2))
# Judge status: Accepted
import math
a,b,x=map(int,input().split())

if (a*a*b/2<=x):
  if (a*a*b==x):
    print(0)
  else:
    theta=math.atan((a*a*a)/(2*(a*a*b-x)))
    print(90.0-theta*180.0/math.pi)
else:
  theta=math.atan(2*x/(a*b*b))
  print((math.pi/2-theta)*180.0/math.pi)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = [0] * (n + 1)
# 後ろからボールの有無を決定
for i in range(n, 0, -1):
    cnt = sum(b[::i])
    # 条件と異なるならボールを投入
    if cnt % 2 != a[i - 1]:
        b[i] = 1
m = sum(b)
print(m)
for i in range(1, n + 1):
    if b[i]:
        print(i, end=' ')
# Judge status: Accepted
def main():
    s = input()
    ans = True
    for i in range(len(s)):
        if i % 2 == 0 and s[i] == "L":
            ans = False
        elif i % 2 == 1 and s[i] == "R":
            ans = False
    print("Yes" if ans else "No")


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
H, N = map(int, input().split())
A= [(list(map(int, input().split()))) for _ in range(N)]
total_point = 0
 
while H > 0:
	B= [a[0]/a[1] for a in A]
	index = B.index(max(B))
 
	num = H//A[index][0]
	H = H%A[index][0]
	used_point = A[index][1]
	damage = A[index][0]
	A = [a for a in A if a[0]<damage and a[1]<used_point]
	if len(A) == 0:
		num += 1
		H = 0
	total_point += num*used_point
print(total_point)
# Judge status: Accepted
f=lambda:map(int,input().split())
n,m=f(); a=list(f())
from fractions import *
l=1
for i in a:
  i//=2; l=l*i//gcd(l,i)
  if (l//i)%2<1 or l>m: print(0); exit()
print(m//l-m//(l*2))
# Judge status: Accepted
import math

N, D = map(int, input().split())
X = []
cnt = 0
for i in range(N):
    X.append(list(map(int, input().split())))
for i in range(1, N):
    for j in range(i):
        d = 0
        for k in range(D):
            d += (X[i][k] - X[j][k])**2
        for l in range(d+1):
            if l**2 == d:
                cnt += 1
                break
print(cnt)