Problem:
Score: 300 points

Problem Statement

M-kun is a student in Aoki High School, where a year is divided into N terms.

There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows:

For the first through (K-1)-th terms: not given.

For each of the K-th through N-th terms: the multiplication of the scores in the last K exams, including the exam in the graded term.

M-kun scored A_i in the exam at the end of the i-th term.

For each i such that K+1 \leq i \leq N, determine whether his grade for the i-th term is strictly greater than the grade for the (i-1)-th term.

Constraints

2 \leq N \leq 200000

1 \leq K \leq N-1

1 \leq A_i \leq 10^{9}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K
A_1 A_2 A_3 \ldots A_N

Output

Print the answer in N-K lines.

The i-th line should contain Yes if the grade for the (K+i)-th term is greater than the grade for the (K+i-1)-th term, and No otherwise.

Sample Input 1

5 3
96 98 95 100 20

Sample Output 1

Yes
No

His grade for each term is computed as follows:

3-rd term: (96 \times 98 \times 95) = 893760

4-th term: (98 \times 95 \times 100) = 931000

5-th term: (95 \times 100 \times 20) = 190000

Sample Input 2

3 2
1001 869120 1001

Sample Output 2

No

Note that the output should be No if the grade for the 3-rd term is equal to the grade for the 2-nd term.

Sample Input 3

15 7
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9

Sample Output 3

Yes
Yes
No
Yes
Yes
No
Yes
Yes

Solution in Scala (2.13.1) (judge verdict: Accepted)

import java.security.KeyStore.TrustedCertificateEntry
import java.util
import java.util.regex.Pattern
import java.util.{ArrayList, Collections, Comparator, List => JList}

import scala.collection.immutable.TreeMap
import scala.math._
import scala.collection.mutable
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.util.{Failure, Success, Try}

object Main{
  val LS = "\n"
  def main(args: Array[String]): Unit = {
    if (sys.env.getOrElse("TEST", "")=="1"){
      println(test());
    }else{
      val input=io.Source.stdin.getLines().mkString(LS);
      println(solve(input).trim());
    }
  }

  def init (nRows: Int, nCols: Int, default: Int) = Array.tabulate(nRows,nCols)( (x,y) =>  default)

  def sortIgnoreCase1(list: JList[String]): JList[String] = {
    val r = new ArrayList[String](list)
    Collections.sort(r, new Comparator[String] {
      override def compare(o1: String, o2: String): Int = o1.compareToIgnoreCase(o2)
    })
    r
  }


  def solve(input: String): String = {
    val Array(n, k) = input.split(LS).head.split(" ").map(_.toInt)
    val a = input.split(LS).tail.head.split(" ").map(_.toInt)
    (k until n).map{i =>
      if (a(i) > a(i - k)) "Yes" else "No"
    }.mkString(LS)
  }



  def divideDigits(num: Long, base: Long = 10L): List[Long] = {
    def proc(num: Long, base: Long, flg: Boolean): List[Long] = {
      var flag = flg
      val quotient = num / base
      val remainder = if (num % base == 0) {
        flag = true
        base
      } else if (flag) {
        flag = false
        val temp = num % base - 1
        if (temp == 0) {
          flag = true
          base - 1
        } else temp
      } else {
        flag = flg
        num % base
      }
      quotient match {
        case 0 =>
          if (flag) {
            List.empty
          } else List(remainder)
        case _ => remainder :: proc(quotient, base, flag)
      }
    }

    proc(num, base, false).reverse//.filterNot(_ == 0)
  }


  def medianCalculator(seq: Seq[Long]): Long = {
    //In order if you are not sure that 'seq' is sorted
    val sortedSeq = seq.sortWith(_ < _)

    if (seq.size % 2 == 1) sortedSeq(sortedSeq.size / 2)
    else {
      val (up, down) = sortedSeq.splitAt(seq.size / 2)
      (up.last + down.head) / 2
    }
  }

  def factorize(x: Long): List[Long] = {
    def foo(x: Long, a: Long = 2, list: List[Long] = Nil): List[Long] = a*a > x match {
      case false if x % a == 0 => foo(x / a, a    , a :: list)
      case false               => foo(x    , a + 1, list)
      case true                => x :: list
    }
    foo(x)
  }

  def divisors(n: Int): Vector[Int] = {
    val halfList = (1 to sqrt(n).toInt).toVector.filter(n % _ == 0).map(_.toInt)
    val reversedList = if (sqrt(n).floor == sqrt(n)) halfList.reverse.tail.map(n/_) else halfList.reverse.map(n/_)
    halfList ++ reversedList
  }

  def gcd(m: Long, n: Long): Long = n match {
    case 0 => m
    case _ => gcd(n, m % n)
  }
  def lcm(a: Long, b: Long): Long = a * b / gcd(a, b)

  val tests=List(
    """5 3
      |96 98 95 100 20""".stripMargin -> """Yes
                                               |No
                                               |
                                 |
                                         |
                                       |
                                   |""".stripMargin
    ,
    """3 2
      |1001 869120 1001""".stripMargin -> """No
                                                |
                                 |
                                           |
                                |""".stripMargin
    ,
    """15 7
      |3 1 4 1 5 9 2 6 5 3 5 8 9 7 9""".stripMargin -> """Yes
                                                             |Yes
                                                             |No
                                                             |Yes
                                                             |Yes
                                                             |No
                                                             |Yes
                                                             |Yes
                                             |""".stripMargin
//    ,
//    """10 10
//      |1000000000 100000000 10000000 1000000 100000 10000 1000 100 10 1""".stripMargin -> """999983200
//                                                                                                |""".stripMargin,
//    """4 3
//      |1 2 3 0
//      |""".stripMargin -> """6""",
//    """4 3
//      |1 2 0 0
//      |""".stripMargin -> """0"""
  )

  def test():String= {
    return tests.map{case (i,o)=>(i.trim(),o.trim())}
      .zipWithIndex.map{
      case ((input,outputExpect),i)=>{
        val output=solve(input).trim();
        s"test${i+1}:"+(if(output==outputExpect){
          "Passed"
        }else{
          s"Failed\nexpect:\n${outputExpect}\noutput:\n${output}"
        })
      }}
      .mkString("\n");
  }



}