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



Sample input:
5 3
96 98 95 100 20


Sample output:
Yes
No

Submission status: Time Limit Exceeded

Solution code:

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

hy=[1]*n
ans=0
for i in range(k-1,n):
    for e in range(0,k):
        hy[i]*=a[i-e]


for i in range(k,n):
    if hy[i-1]<hy[i]:
        ans='Yes'
        print(ans)
    else:
        ans='No'
        print(ans)
#print(hy)

Submission status: Time Limit Exceeded

Solution code:
def marks_C():
    N, K = map(int, input().split())
    scores = tuple(map(int, input().split()))

    for i, k in enumerate(range(K, N)):

        if calc_score(scores[i + 1:k + 1]) > calc_score(scores[i:k]):
            print('Yes')
        else:
            print('No')


def calc_score(score: tuple):
    total = 1
    for i in score:
        total *= i
    return total


if __name__ == '__main__':
    marks_C()

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int, input().split())
a_arr = list(map(int, input().split()))

k_idx = K - 1
term_val_arr = []
for i in range(N - K + 1):
    val = 1
    for j in range(K):
        val *= a_arr[k_idx - j]
    term_val_arr.append(val)
    k_idx += 1

for i in range(N-K):
    if len(term_val_arr)-1 != i:
        if term_val_arr[i] < term_val_arr[i+1]:
            print('Yes')
        else:
            print('No')

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(1,k+1):
    a[i] = a[i] * a[i-1]

if a[k]/a[0] <= a[k-1]:
    print('No')
else:
    print('Yes')
for i in range(k+1,n):
    a[i] = a[i] * a[i-1]
    if a[i]/a[i-k] <= a[i-1]/a[i-k-1]:
        print('No')
    else:
        print('Yes')

Submission status: Time Limit Exceeded

Solution code:
n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
s = []
f = []

for i in range(k-1,n):
    z = 0
    c = 1
    while z < k:
        c = c * arr[i-z]
        z += 1

    s.append(c)
    
l = len(s)
for i in range(1,l):
    if s[i]>s[i-1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
l = []
i = 0
for x in input().split():
    A = int(x)
    if K < N - i:
        l.append(A)
    if i >= K:
        if l.pop(0) < A:
            print("Yes")
        else:
            print("No")
    i = i + 1

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
A = list(map(int, input().split()))
score = []
wknum = 1
for i  in range(k):
    wknum *= A[i]

score.append(wknum)

for i in range(n - k):
    wknum //= A[i]
    wknum *= A[k + i]
    score.append(wknum)
    if score[i + 1] <= score[i]:
        print('No')
    else:
        print('Yes')

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

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

    array = [0]*n
    before = 1
    for i in range(k):
        before *= A[k-1-i]
    for i in range(k,n):
        tmp = 1
        after = (before//A[i-k])*A[i]
        if before < after:
            print('Yes')
        else:
            print('No')
        before = after


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import os
import sys
from io import BytesIO, IOBase
from collections import deque
from collections import defaultdict
def main():
	n, k = list(map(int, input().split()))
	arr = list(map(int,input().split()))

	num = 1
	for i in range(k):
		num *= arr[i]
	res = [num]
	f = True
	for i in range(k,n):
		num *= arr[i]
		num //= arr[i-k]
		res.append(num)
		if res[-1] <= res[-2]:
			print("No")
		else:
			print("Yes")







# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = "x" in file.mode or "r" not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b"\n") + (not b)
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode("ascii"))
		self.read = lambda: self.buffer.read().decode("ascii")
		self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
	main()

Submission status: Time Limit Exceeded

Solution code:
N,K=map(int,input().split())
A=list(map(int,input().split()))
a=1

for i in range(K):
  a=a*A[i]
  
for j in range(N-K):
  b=a*A[K+j]//A[j]
  
  if (a < b ):
    print("Yes")
    a=b
    continue
  else:
    print("No")
    a=b
    continue

Submission status: Time Limit Exceeded

Solution code:
N,K =map(int,input().split())
A =list(map(int,input().split()))
points = []
for i in range(K,N+1):
  point = 1
  for k in range(K):
    point *= A[i-k-1]
  points.append(point)
  if i > K:
    if points[i-K] > points[i-1-K]:
      print("Yes")
    else:
      print("No")

Submission status: Time Limit Exceeded

Solution code:
n = list(map(int,input().split()))
a = list(map(int,input().split()))

now = 1
pre = 0
for i in range(0,n[1]):
    now *= a[i]

for i in range(n[1],n[0]):
    pre = now
    if a[i-n[1]] == 0:
        now = 1
    else:
        now /= a[i-n[1]]
    now *= a[i]
    if now > pre:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int,input().split())
C = list(map(int,input().split()))
#print(C)
ans = 1
for i in range(K):
  ans *= C[i]

for i in range(N-K):
  preans = ans
  ans *= C[K+i]
  ans /= C[i]
  if preans < ans:
    print("Yes")
  if preans >= ans:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
def calc(l, k):
  res = 1
  for i in range(k):
    res = res*l[i]
  return res

n, k = map(int, input().split())
a = tuple(map(int, input().split()))
i = 1
prev = calc(a[:k], k)

while i+k <= n:
  tmp = calc(a[i:i+k], k)
  if tmp > prev:
    print('Yes')
  else:
    print('No')
  prev = tmp
  i += 1

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = 1
ans=[]
for i in range(k):
    s *= a[i]
ans.append(s)
for i in range(k, n):
    s = s * a[i] // a[i - k]
    ans.append(s)
    if ans[i - k] < ans[i - k + 1]:
        print("Yes")
    else:
        print("No")
    # print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1
 
n, k = map(int, input().split())
A = list(map(int, input().split()))
now = 1
for i in range(k):
    now *= A[k-1-i]
for i in range(k-1, n):
    #print(A[i])
    if i == k-1:
        before = now
    else:
        now = now//A[i-k]
        now *= A[i]
        #print(A[i-k], A[i], now, before)
        if before < now:
            print("Yes")
        else:
            print("No")
        before = now

Submission status: Time Limit Exceeded

Solution code:
import functools


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

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

answers = []

prev_mul_scores_last_k = functools.reduce(lambda acc, score: acc * score, scores[:k])

prev_score = scores[0]

for i in range(k, n):
    mul_scores_last_k = (prev_mul_scores_last_k // prev_score) * scores[i]

    if prev_mul_scores_last_k < mul_scores_last_k:
        answers.append('Yes')
    else:
        answers.append('No')

    prev_mul_scores_last_k = mul_scores_last_k
    prev_score = scores[i - (k - 1)]

for answer in answers:
    print(answer)

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int,input().split())
a = [int(i) for i in input().split()]
a.reverse()

lists = []
answer = a[0]
for i in range(1, k):
    answer = answer * a[i]
lists.append(answer)

for i in range(n - k):
    answer = answer / a[i] * a[i + k]
    lists.append(answer)

lists.reverse()

for i in range(n - k):
    if lists[i] < lists[i + 1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import product, combinations, permutations
from copy import deepcopy
import sys
sys.setrecursionlimit(4100000)
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


if __name__ == '__main__':
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    mod = len(A)%K
    prev = None
    L = 0

    for i in range(N-K+1):
        check = A[i:i+K]
        if i==0:
            acc = 1
            for c in check:
                acc *= c
                prev = acc
        else:
            acc = 1
            for c in check:
                acc *= c
            if prev<acc:
                print("Yes")
            else:
                print("No")
            prev = acc

Submission status: Time Limit Exceeded

Solution code:
a = list(map(int, input().split()))
b = list(map(int, input().split()))

k_1 = 1
k = 1

for i in range(a[0]):
    if i < a[1]:
        k = k * b[i]
    if i >= a[1]:
        k_1 = k
        k = k * b[i] / b[i-a[1]]
        if k > k_1:
            print("Yes")
        else:
            print("No")

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = [int(x) for x in input().split()]

A_past = 1
for Ai in A[:K]:
  A_past *= Ai

for i in range(N-K):
  A_now = 1
  for Ai in A[i+1:i+K+1]:
    A_now *= Ai
  if A_now > A_past:
    print("Yes")
  else:
    print("No")
  A_past = A_now

Submission status: Time Limit Exceeded

Solution code:
N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
#%%
temp1 = 1
T = A[0: K]
for i in T:
    temp1 *= i

temp2 = temp1

for i in range(K, N):
    temp2 /= A[i - K]
    temp2 *= A[i]
    if temp1 < temp2:
        print("Yes")
    else:
        print("No")
    temp1 = temp2

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
s,e = 1,k+1
temp = 1
for i in range(k):
    temp *= a[i]
for i in range(n-k):
    score = 1
    for j in range(s,e):
        score *= a[j]
    print("Yes" if score>temp else "No")
    temp = score
    s+=1
    e+=1

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3

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

    point = [1] * (K)
    point[0] = A[0]

    for i in range(1, K):
        point[i] = point[i - 1] * A[i]

    ans = point[K - 1]
    for i in range(N - K):
        tmp = ans * A[K + i] / A[i]
        if ans < tmp:
            print('Yes')
        else:
            print('No')
        ans = tmp


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
#c
n,k = map(int,input().split())
a = list(map(int,input().split()))

num_list = []

for i in range(n-k+1):
    num = 1
    for j in range(i,i+k):
        num *= a[j]
    num_list.append(num)
    
for i in range(len(num_list)-1):
    if num_list[i] < num_list[i+1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
N,K=map(int,input().split())
A=[int(s) for s in input().split()]
dp=[0]*(N-K+2)
dp[1]=1
for j in range(K):
    dp[1]*=A[j]
for i in range(1,N-K+1):
    dp[i+1]=dp[i]*A[K+i-1]/A[i-1]
    if dp[i+1]>dp[i]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
N,K=map(int,input().split())
A=list(map(int,input().split()))

dictS={}
dictS[0]=1

for n in range (1,N):
    if n<K:
        # S.append(A[n]*S[-1])
        dictS[n]=A[n]*dictS[n-1]

    else:
        # S.append(A[n]*S[-1]/A[n-K])
        dictS[n]=A[n]*dictS[n-1]/A[n-K]

for i in range (K,N):
    if dictS[i]>dictS[i-1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))
P = list()
z = 1
for i in range(K):
  z *= A[i]
P.append(z)
for i in range(1,N - K + 1):
  z = (z // A[i - 1]) * A[i + K - 1]
  P.append(z)
pre = P[0]
for p in P[1:]:
  if pre < p:
    print("Yes")
  else:
    print("No")
  pre = p

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
A=list(map(int,input().split()))
lst=[1]*(n-k+1)
for i in range(n-k+1):
  if i==0:
    temp=1
    for j in range(k):
      temp*=A[j]
    lst[i]=temp
  else:
    temp=lst[i-1]//A[i-1]
    lst[i]=temp*A[i+k-1]
    print("Yes" if lst[i]>lst[i-1] else "No")

Submission status: Time Limit Exceeded

Solution code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, k = LI()
a = LI()
base = 1
for elem in a[:k]:
    base *= elem
for i in range(k, n):
    rate = a[i] / a[i-k]
    # print(rate)
    if rate > 1:
        ans = 'Yes'
    else:
        ans = 'No'
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
# cook your dish here

arr = []
n,k = (input().split())
arr = list(map(int, input().split()))
n = int(n)
k=int(k)
test = []
start =0
end = k
temp = 1
for j in range(k):
    temp = temp*arr[j]
test.append(temp)
for i in range(1,n-k+1):
    temp /= arr[start]
    temp *= arr[end]
    test.append(temp)
    start+=1
    end+=1

for i in range(1,n-k+1):
    
    if(test[i] <= test[i-1]):
        print("No")
    else:
        print("Yes")

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
A = list(map(int, input().split()))
# print(A)

score_list = []

for i in range(n - k + 1):
    score = 1
    for j in range(k):
        score *= A[i+j]
    score_list.append(score)

# print(score_list)

for i in range(n - k):
    if score_list[i] < score_list[i + 1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
n = input().split()
n = [int(i) for i in n]
m = input().split()
m = [int(i) for i in m]

point_range = n[0]-(n[1]-1)
point_list = []
point = 1
for i in range(point_range):
    for j in m[i:n[1]+i]:
        point *= j
    if i != 0:
        if point > pre_point:
            print("Yes")
        else:
            print("No")

    pre_point = point
    point = 1

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))

rp = []
score = 1
for i in range(0, k):
    score *= a[i]
rp.append(score)

for i in range(k,n):
    score = score / a[i-k] * a[i]
    rp.append(score)
    if rp[i-k] < rp[i-k+1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
#print(arr2)
final=list()
start=0
end=arr1[1]
prod=1
for i in range(arr1[1]):
	prod*=arr2[i]
final.append(prod)
while end<arr1[0]:
	prod/=arr2[start]
	start+=1
	prod*=arr2[end]
	end+=1
	final.append(prod)
	pass

sz=len(final)
for i in range(sz-1):
	if(final[i+1]>final[i]):
		print("Yes")
	else:
		print("No")
#print(final)

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int,input().split())
A = list(map(int,input().split()))
mae = 1
for i in range(K):
    mae *= A[i]
for i in range(N-K):
    ato = mae/A[i]*A[i+K]
    #mae = ato
    if ato > mae:
        print("Yes")
    else:
        print("No")
    mae = ato

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().rstrip().split())
arr = list(map(int, list(input().split())))
tmp = -1
for i in range(k,n+1):
  ar_ = arr[i-k:i]
  ar = sum(ar_)
 # for a in ar_:
  #  ar *= a
  if tmp != -1:
    if ar > tmp:
      print("Yes")
    else:
      print("No")
  tmp = ar

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = n - k + 1
lis = [0]*l
c = 0
m = 1

for i in range(l):
  for j in range(c, c + k):
    m = m * a[j]
  lis[i] = m
  m = 1
  c += 1
for i in range(n - k):
  if lis[i] < lis[i + 1]:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない
N,K = map(int, input().split())
A = list(map(int, input().split()))
aa =1
DP =[0]*(N-K+1)
for i in A[:K]:
    aa *=i
DP[0] =aa

for i in range(N -K):
    DP[i+1] =DP[i]*A[i+K]//A[i]
    if DP[i+1] >DP[i]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))

evaluations = []
for n in range(N):
    if n < K-1:
        evaluations.append(0)
    else:
        evaluation = 1
        for i in range(K):
            evaluation *= A[n-i]
        evaluations.append(evaluation)
# print(evaluations)

for n in range(K, N):
    print('Yes' if evaluations[n] > evaluations[n-1] else 'No')

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
scs = list(map(int, input().split()))
#print(scs)

res = []
re = 1

for i in range(n - k + 1):
    #print(i)
    for j in range(k):
        #print(i + j)
        re = re * scs[i + j]
    res.append(re)
    re = 1

#print(res)

prev = res[0]

for i in range(1, n - k + 1):
    if res[i - 1] < res [i]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
a,b=map(int,input().split())
l = list(map(int,input().strip().split()))
i = 0
ans= 1
while(i!=a):
	if(i<b): ans *= l[i]
	else:
		x = ans / l[i-b]
		x *= l[i]
		if(x>ans): print("Yes")
		else: print("No")
		ans  = x
	i += 1

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator

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

prod = functools.partial(functools.reduce, operator.mul)
for i in range(K, N+1):
    sum_prod = prod(A[i-K:i])
    if i > K:
        if sum_prod > tmp_sum_prod:
            print('Yes')
        else:
            print('No')
    tmp_sum_prod = sum_prod

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator


def prod(arr):
    return functools.reduce(operator.mul, arr)


def main():
    N, K = (int(x) for x in input().split(" "))
    A = [int(x) for x in input().split(" ")]
    lastest_score = prod(A[0:K])
    result = ["No"] * (N-K+1)
    for i in range(1, N-K+1):
        current_score = lastest_score - A[i-1] + A[i + K-1]
        if lastest_score < current_score:
            result[i] = "Yes"
        lastest_score = current_score
    [print(x) for x in result[1:]]


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
a=list(map(int,input().split()))
first=1
for i in range(k):
    first=first*a[i]
for i in range(n-k):
    point=1
    for j in range(k):
        point=point*a[k-j+i]
    if(first<point):
        print("Yes")
    else:
        print("No")
    first=point

Submission status: Time Limit Exceeded

Solution code:
def main():
    info1 = input('').split(' ')
    N = int(info1[0])
    K = int(info1[1])
    A = list(map(int, input('').split(' ')))
    num_terms = N-K+1
    terms = [1] * num_terms
    j = 0
    for i in range(0,K):
        terms[j] *= A[i]
    j += 1
    for i in range(K,N):
        terms[j] = terms[j-1]/A[i-K]*A[i]
        j +=1

    for i in range(1,num_terms): 
        if terms[i] > terms[i-1]: 
            print("Yes")
        else:
            print("No")
main()

Submission status: Time Limit Exceeded

Solution code:
nk = input('')
n = int(nk.split()[0])
k = int(nk.split()[1])

alist = list(map(int,input('').split()))

pre=0
result=1
for i in range(k):
    result *= alist[i]
pre=result
for i in range(1,n-k+1):
    result=result * alist[i+k-1] / alist[i-1]
#    print("[{}/{}]:{}".format(i,i+k,result))
    if result > pre:
        print('Yes')
    else:
        print('No')
    pre=result

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[2]:


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


# In[3]:


def main():
    x0 = 1
    for i in range(K):
        x0 *= A[i]
    x = x0
    for j in range(K,N):
        score = x*A[j]//A[j-K]
        if score > x:
            print("Yes")
        else:
            print("No")
        x = score


# In[4]:


if __name__ == '__main__':
    main()


# In[ ]:

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
a=list(map(int,input().split()))
old=1
for j in range(k):
	old*=a[k-1-j]
for i in range(n-k+1):
	new=1
	for s in range(k):
		new*=a[k-1-s+i]
	if i>0 and new>old:
		print('Yes')
	elif i>0 and new<=old:
		print('No')
	old=new

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

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

s_k = 1
for j in range(k):
    s_k *= scores[j]

for i in range(k + 1, n + 1):
    _s_k = s_k
    remove = scores[i - k - 1]
    add    = scores[i - 1]
    s_k = s_k * add / remove

    if _s_k < s_k:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
score = list(map(int, input().split()))
add = []
sc = 1
for i in range(K):
    sc *= score[i]
add.append(sc)
for i in range(K, N):
    sc = sc // score[i-K]
    sc *= score[i]
    add.append(sc)
pre = 0
for num, val in enumerate(add):
    if num != 0:
        print("Yes" if val > pre else "No")
    pre = val

Submission status: Time Limit Exceeded

Solution code:
n, k = list(map(int, input().split()))
arr = list(map(int,input().split()))

num = 1
for i in range(k):
	num *= arr[i]
res = [num]
f = True
for i in range(k,n):
	num *= arr[i]
	num //= arr[i-k]
	res.append(num)
	if res[-1] <= res[-2]:
		print("No")
	else:
		print("Yes")

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int,input().split())
A = list(map(int,input().split()))
for i in range(N-K):
    if sum(A[i:i+K]) < sum(A[i+1:i+K+1]):
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
N, K = input().split()
N = int(N)
K = int(K)
scores = [int(s) for s in input().split()]
sums = []
for i in range (K-1, N):
    c = 1
    j = i
    for i in range(j,i-K,-1):
        c *= scores[j]
        j -= 1
    sums.append(c)

for i in range(N-K):
    if sums[i] < sums[i+1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
a=list(map(int,input().split()))

pi=[]
s=1
for i in range(k):
  s*=a[i]
pi.append(s)

for i in range(1,n-k+1):
  pi.append(int((s/a[i-1])*a[i-1+k]))
  s=pi[i]
  if pi[i-1]<pi[i]:
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))

def list_seki(l):
    S = 1
    for i in range(0, len(l)):
        S *= l[i]
    return S

def hikaku(l):
    for i in range(1, len(l)):
        if l[i-1]<l[i]:
            print("Yes")
        else:
            print("No")

D = []
for x in range(K, N+1):
    before = list_seki(A[x-K:x])
    D.append(before)

hikaku(D)

Submission status: Time Limit Exceeded

Solution code:
n, k = [int(i) for i in input().split()]
lst = [int(i) for i in input().split()]

points = []
for i in range(k - 1, n):
  if i == k - 1:
    point = 1
    for j in range(k):
      point *= lst[j]
  else:
    point = point * lst[i] / lst[i - k]
  points.append(point)

for i in range(len(points)):
  if i > 0:
    if points[i] > points[i-1]:
      print('Yes')
    else:
      print('No')

Submission status: Time Limit Exceeded

Solution code:
import operator
from functools import reduce

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

x = []

for i in range(N - K + 1):
    hoge = A[i:i + K]
    x.append(hoge)

for i in range(len(x) - 1):
    now = reduce(operator.mul, x[i])
    next = reduce(operator.mul, x[i + 1])

    if now < next:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
# C
N, K = map(int, input().split())
A = list(map(int, input().split()))

num = 1
cnt = 0
lst = []
for i in range(N):
    if (i < K):
        num *= A[i]
    else:
        lst.append(num)
        num = (num // A[cnt]) * A[i]
        cnt += 1
lst.append(num)

for i in range(len(lst) - 1):
    if (lst[i] < lst[i+1]):
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = []
tmp = 1
for i in range(k):
    tmp *= a[i]
b.append(tmp)
for i in range(k,n):
    tmp /= a[i-k]
    tmp *= a[i]
    b.append(tmp)
for i in range(len(b)):
    if i == len(b)-1:    break
    if b[i+1] > b[i]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys

YES = "Yes"
NO = "No"

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

scores = [0] * K
pre = A[0]
scores[0] = A[0]
i = 1
while i < K:
    scores[i] = A[i]
    pre = pre * A[i]
    i += 1

while i < N:
    cur = pre
    cur = cur / scores[i % K]
    cur = cur * A[i]
    scores[i % K] = A[i]

    if cur > pre:
        print(YES)
    else:
        print(NO)
    pre = cur
    i += 1

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator


def prod(arr):
    return functools.reduce(operator.mul, arr)


def main():
    N, K = (int(x) for x in input().split(" "))
    A = [int(x) for x in input().split(" ")]
    lastest_score = prod(A[0:K])
    result = [None] * (N-K+1)
    for i in range(1, N-K+1):
        current_score = lastest_score - A[i-1] + A[i + K-1]
        if lastest_score < current_score:
            result[i] = "Yes"
        else:
            result[i] = "No"
        lastest_score = current_score
    [print(x) for x in result[1:]]


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
ara = list(map(int, input().split()))

brr = []

total = 1
for i in range(0, k):
    total = total * ara[i]
# print(total)

a = 0
brr.append(total)

for i in range(k, n):
    total = total / ara[a]
    total = total * ara[i]
    a = a + 1
    brr.append(total)

l = len(brr)

for i in range(1, l):
    if brr[i-1] >= brr[i]:
        print("No")
    else:
        print("Yes")

Submission status: Time Limit Exceeded

Solution code:
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import product, combinations, permutations
from copy import deepcopy
import sys
import numpy as np
sys.setrecursionlimit(4100000)
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


if __name__ == '__main__':
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    mod = len(A)%K
    prev = None
    L = 0

    for i in range(N-K+1):
        check = A[i:i+K]
        if i==0:
            acc = 1
            for c in check:
                acc *= c
                prev = acc
        else:
            acc = 1
            for c in check:
                acc *= c
            if prev<acc:
                print("Yes")
            else:
                print("No")
            prev = acc

Submission status: Time Limit Exceeded

Solution code:

from sys import stdin,stdout
#stdin=open('input.txt','r')
#stdout=open('output.txt','w')
#print=stdout.write
input = lambda: stdin.readline().rstrip("\r\n")
from collections import deque as que, defaultdict as vector
from heapq import*
inin = lambda: int(input())
inar = lambda: list(map(int,input().split()))


n , k = [int(x) for x in input().split()]
ar = inar()
p = 1

for i in range(k):
	p = p*ar[i]
tmp = p
for i in range(k,n):
	p = (tmp/ar[i-k])*ar[i]
	if(p>tmp):
		print("Yes")
	else:
		print("No")
	tmp = p