{"raw_statement":[{"iden":"statement","content":"There are n (1 ≤ n ≤ 105) students numbered from 0 to n - 1, the favorite number of student i is fi (1 ≤ fi ≤ 109). Student i is friend of student j if and only if |i - j| ≤ k (1 ≤ k ≤ 20). The students will be divided in two math classes.\n\nClass A is for palindromes lovers, so naturally, only students with a palindrome as a favorite number can take it. A number is palindrome if read from right to left is the same. So 1, 55, 121 and 1331 are palindromes and 10, 233 and 990 are not.\n\nClass B is for superstitious people, so naturally, only students with a lucky number as a favorite number can take it. A number is lucky if it's formed by only digits 4 and 7. So 4, 7, 44, and 474477 are lucky numbers and 5, 40, 71 and 4474347 are not lucky numbers.\n\nYour task is to find out if it's possible to split the students into classes A and B, so that every student is in exactly one class and every student has at least one friend on the same class.\n\nThe first line has two integers n and k. The second line contains n space separated integers f0, f1, ..., fn - 1 the favorite number of each student. All numbers are given with no leading zeroes.\n\nPrint \"Yes\" or \"No\", without quotes, whether or not is possible to split the students as stated above.\n\nNote that one of the classes might be empty.\n\n"},{"iden":"input","content":"The first line has two integers n and k. The second line contains n space separated integers f0, f1, ..., fn - 1 the favorite number of each student. All numbers are given with no leading zeroes."},{"iden":"output","content":"Print \"Yes\" or \"No\", without quotes, whether or not is possible to split the students as stated above."},{"iden":"examples","content":"Input4 1474 101 7 4OutputYesInput4 1447 101 7 4OutputNo"},{"iden":"note","content":"Note that one of the classes might be empty."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $, $ 1 \\leq n \\leq 10^5 $, be the number of students.  \nLet $ k \\in \\mathbb{Z} $, $ 1 \\leq k \\leq 20 $, be the friendship radius.  \nLet $ f_i \\in \\mathbb{Z} $, $ 1 \\leq f_i \\leq 10^9 $, be the favorite number of student $ i $, for $ i \\in \\{0, 1, \\dots, n-1\\} $.  \n\nDefine:  \n- $ P(f_i) = \\text{true} $ if $ f_i $ is a palindrome, else false.  \n- $ L(f_i) = \\text{true} $ if $ f_i $ consists only of digits '4' and '7', else false.  \n\nDefine friendship: student $ i $ is friends with student $ j $ iff $ |i - j| \\leq k $ and $ i \\neq j $.  \n\n**Constraints**  \n1. Each student must be assigned to exactly one class: A or B.  \n2. A student $ i $ may be assigned to class A only if $ P(f_i) = \\text{true} $.  \n3. A student $ i $ may be assigned to class B only if $ L(f_i) = \\text{true} $.  \n4. Every student must have at least one friend in the same class.  \n\n**Objective**  \nDetermine whether there exists an assignment $ c_i \\in \\{A, B\\} $ for each student $ i $, satisfying constraints 1–4.  \nOutput \"Yes\" if such an assignment exists; otherwise, output \"No\".","simple_statement":"You are given n students, each with a favorite number.  \nStudent i can be friends with student j if |i - j| ≤ k.  \n\nYou must assign each student to exactly one of two classes:  \n- Class A: only students whose favorite number is a palindrome.  \n- Class B: only students whose favorite number is made of only digits '4' and '7'.  \n\nEvery student must have at least one friend in the same class.  \n\nPrint \"Yes\" if such a split is possible, otherwise \"No\".","has_page_source":false}