Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

s = input()
q = int(input())
for i in range(1, q+1):
    try:
        t, f, c = input().split()
    except ValueError:
        t = '1'
    if t == '1':
        s = s[::-1]
    else:
        if f == '1':
            s = c + s
        else:
            s = s + c
print(s)

### FIXED CODE ###

s = input()
q = int(input())
inv = False
left =''
right = ''

for i in range(1, q+1):
    try:
        t, f, c = input().split()
    except ValueError:
        t = '1'
    if t == '1':
        inv = not inv
    else:
        if inv:
            if f == '1':
                right = right + c
            else:
                left = c + left
        else:
            if f == '1':
                left = c + left
            else:
                right = right + c
#     print('%s, %s, %s, %s, %s' %(left, right, inv, t, f))

# # print(left)
# # print(right)
if inv:
    right = right[::-1]
    left = left[::-1]
    s = s[::-1]
    print(right + s + left)
else:
    print(left + s + right)
### BUGGY CODE ###

import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N,K = LI()
A = LI()

hyoten = [1] * (N-K+1)

for i in range(N-K+1):
    for q in range(K):
        hyoten[i] *= A[i+q]


for j in range(len(hyoten)-1):
    if (hyoten[j+1]>hyoten[j]):
        print('Yes')
    else:
        print('No')

    

### FIXED CODE ###

import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N,K = LI()
A = LI()

# hyoten = [1] * (N-K+1)

# for i in range(N-K+1):
#     for q in range(K):
#         hyoten[i] *= A[i+q]


# for j in range(len(hyoten)-1):
#     if (hyoten[j+1]>hyoten[j]):
#         print('Yes')
#     else:
#         print('No')

for i in range(N-K):
    if A[i] < A[i+K]:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

import sys

n = int(input())
a = []
for i in range(n):
    a.append(list(map(int, input().split())) + [-1])
day = 0
match = [0 for i in range(n)]
while match != [n - 1 for i in range(n)]:
    add = [False for i in range(n)]
    for i in range(n):
        j = a[i][match[i]] - 1
        if a[j][match[j]] - 1 == i:
            add[i] = True
            add[j] = True
    if add != [False for i in range(n)]:
        match = [match[i] + int(add[i]) for i in range(n)]
        day += 1
    else:
        break
else:
    print(day)
    sys.exit()
print(-1)

### FIXED CODE ###

import sys, collections
input = sys.stdin.readline

n = int(input())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
nums = [0 for i in range(n)]
day = 0
match = 0
flag = True
queue = collections.deque([])
temp = set()
for i in range(1, n + 1):
    i2 = a[i - 1][0]
    if a[i2 - 1][0] == i:
        if i not in temp:
            queue.append([i, i2])
            temp.add(i)
            temp.add(i2)
if not queue:
    flag = False
while queue:
    temp = []
    while queue:
        test = queue.popleft()
        match += 1
        num1, num2 = test[0], test[1]
        nums[num1 - 1] += 1
        nums[num2 - 1] += 1
        temp.append(num1)
        temp.append(num2)
    flag2 = False
    temp2 = set()
    for i in temp:
        if nums[i - 1] <= n - 2:
            new_num = a[i - 1][nums[i - 1]]
            if nums[new_num - 1] <= n - 2 and a[new_num - 1][nums[new_num - 1]] == i:
                if i not in temp2:
                    queue.append([i, new_num])
                    flag2 = True
                    temp2.add(i)
                    temp2.add(new_num)
    if flag2 == False and match < n * (n - 1) // 2:
        flag = False
        break
    day += 1

if flag == True:
    print(day)
else:
    print(-1)
### BUGGY CODE ###

import itertools
import numpy as np

N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(Q)]
ans = 0
A = [1 for i in range(N)]
for A in np.array(list(itertools.combinations_with_replacement(range(1, M + 1), N))):
  score = 0
  for i in range(Q):
    a = abcd[i][0]
    b = abcd[i][1]
    c = abcd[i][2]
    d = abcd[i][3]
    if A[b-1] - A[a-1] == c:
      score += d
  if ans < score:
    ans = score
print(ans)


### FIXED CODE ###

import itertools
import numpy
N, M, Q = map(int,input().split())
abcd = []*Q
d_list = []
sum_d = 0
for _ in range(Q):
  abcd.append(list(map(int,input().split())))

A = [1 for i in range(N)]
for A in itertools.combinations_with_replacement(range(1, M+1), N):
  for i in range(Q):
    if A[abcd[i][1]-1]-A[abcd[i][0]-1] == abcd[i][2]:
      d_list.append(abcd[i][3])
  if sum_d <= sum(d_list):
    sum_d = sum(d_list)
  d_list.clear()
print(sum_d)
### BUGGY CODE ###

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

ls = list(map(int, input().split()))
ans = []

for i in range(2**N):
  num = 0
  s = 0
  for j in range(N):
    if ((i >> j) & 1):
      if num < K:
        s += ls[j]
        num += 1
  if num == K:
    ans.append(s)

ans2 = sorted(ans)
print(ans2[0])

### FIXED CODE ###

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

ls = list(map(int, input().split()))
ans = 0

ls2 = sorted(ls)

for i in range(K):
  ans += ls2[i]

print(ans)
### BUGGY CODE ###

a,b = map(int, input().split())
l = [i for i in range(a,b+1)]
ans =1
for i in range(len(l)):
  ans = ans *l[i]
if ans <0:
  print('Negative')
elif ans >0:
  print('Positive')
else:
  print('Zero')

### FIXED CODE ###

a, b = map(int, input().split())

if a>0 and b>0:
  print('Positive')
elif a <= 0 and b >=0:
  print('Zero')
else:
  print('Positive' if (b-a +1)%2 ==0 else 'Negative')
### BUGGY CODE ###

N,S = map(int,input().split())
A = list(map(int,input().split()))
from collections import deque
import itertools
import numpy as np
ls = deque([])

A = np.array(A)
for v in itertools.product([0,1], repeat=N):
    u = np.array(v)
    if S == np.dot(A,u):
        u = list(u)
        i = N
        j = 0
        for k in range(N):
            if u[k] == 1:
                i = min(i,k)
                j = k
        ls.append([i,j])

ans = 0
MOD = 998244353

while ls:
    a = ls.pop()
    ans += (a[0]+1)*(N-a[1]) % MOD

print(ans)


### FIXED CODE ###

N, S = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353
ans = 0
dp = [0]*S

for i, a in enumerate(A):
    dp[0] +=1
    if a > S:
        continue

    ans = (ans + dp[S-a]*(N-i)% mod) % mod

    for j, x in enumerate(dp[:S-a]):
        dp[j+a] += x
print(ans)
### BUGGY CODE ###

import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
def ddprint(x):
  if DBG:
    print(x)

def foo(x):
    sum = 0
    for y in a:
        sum += abs(y-x)
    return sum+b

a = []
b = 0
q = inn()
for i in range(q):
    x = inl()
    if len(x)==1:
        z = (len(a)-1)//2
        print("{} {}".format(a[z],foo(a[z])))
    else:
        a.append(x[1])
        a.sort()
        b += x[2]


### FIXED CODE ###

import heapq
#printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
#inm   = lambda:      map(int, input().split())
DBG = True  and False
#def ddprint(x):
#  if DBG:
#    print(x)

q = inn()
x = inl()
root = x[1]
b = x[2]
tl = []
tr = []
nl = nr = suml = sumr = 0
#ddprint("q " + str(q))
for i in range(1,q):
    #ddprint("i " + str(i))
    x = inl()
    if len(x)==1:
        z = sumr - suml - (root if nr>nl else 0) + b
        print("{} {}".format(root,z))
    else:
        a = x[1]
        b += x[2]
        if nl == nr:
            aa = -heapq.heappushpop(tl,-a)
            suml += a - aa
            if aa<root:
                aa,root = root,aa
            heapq.heappush(tr,aa)
            sumr += aa
            nr += 1
        else:
            aa = heapq.heappushpop(tr,a)
            sumr += a - aa
            if aa>root:
                aa,root = root,aa
            heapq.heappush(tl,-aa)
            suml += aa
            nl += 1
        #ddprint("b {} root {} nl {} nr {} suml {} sumr {}".format(b,root,nl,nr,suml,sumr))
        #ddprint(tl)
        #ddprint(tr)
### BUGGY CODE ###

#import numpy as np
#import math
from fractions import gcd

def main():

    ##get int
    first_input = list(map(lambda x:int(x), input().split(" ")))
    #second_input = list(map(lambda x:int(x), input().split(" ")))

    ##get float
    #first_input = list(map(lambda x:float(x), input().split(" ")))
    #second_input = list(map(lambda x:float(x), input().split(" ")))

    ##get string
    #first_input = input().split(" ")

    K = first_input[0]

    gcd_sum = 0
    for a in range(1,K+1):
        for b in range(1,K+1):
            for c in range(1,K+1):
                gcd_sum = gcd_sum + gcd(gcd(a,b),c)

    print(gcd_sum)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#import numpy as np
import math
#from fractions import gcd

def main():

    ##get int
    first_input = list(map(lambda x:int(x), input().split(" ")))
    #second_input = list(map(lambda x:int(x), input().split(" ")))

    ##get float
    #first_input = list(map(lambda x:float(x), input().split(" ")))
    #second_input = list(map(lambda x:float(x), input().split(" ")))

    ##get string
    #first_input = input().split(" ")

    K = first_input[0]

    gcd_sum = 0
    for a in range(1,K+1):
        for b in range(1,K+1):
            for c in range(1,K+1):
                gcd_sum = gcd_sum + math.gcd(math.gcd(a,b),c)

    print(gcd_sum)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

n=int(input())
arr=list(map(float,input().split()))
dp=[1]*(n+1)
dp[0]=(1-arr[0])
dp[1]=arr[0]
for i in range(1,n):
  dp[i+1]=dp[i]*arr[i]
  for j in range(1,i+1):
    dp[i+1-j]=dp[i-j]*arr[i]+dp[i+1-j]*(1-arr[i])
  dp[0]=dp[0]*(1-arr[i])
ans=0
for i in range(int(n/2)+1,n+1):
  ans+=dp[i]
print(ans)

### FIXED CODE ###

n=int(input())
arr=list(map(float,input().split()))
dp=[1]*(n+1)
dp[0]=(1-arr[0])
dp[1]=arr[0]
for i in range(1,n):
  for j in range(i+2):
    if j==0:
      dp[i+1-j]=dp[i-j]*arr[i]
    elif j==i+1:
      dp[i+1-j]=dp[i+1-j]*(1-arr[i])
    else:
      dp[i+1-j]=dp[i-j]*arr[i]+dp[i+1-j]*(1-arr[i])
ans=0
for i in range(int(n/2)+1,n+1):
  ans+=dp[i]
print(ans)
### BUGGY CODE ###

a=input().split()
A=int(a[0])
B=int(a[1])
li=[2]
li2=[]
p=0
if B>A:
    c=A
    A=B
    B=c
for i in range(3,A+1):
    for j in range(2,i+1):
        if j==i:
            li.append(i)
        if i%j==0:
            break
while p==0:
    for s in li:
        if A%s==0 and B%s==0:
            A/=s
            B/=s
            li2.append(s)
            break
        if A%s==0 and B%s!=0:
            A/=s
            li2.append(s)
            break
        if A%s!=0 and B%s==0:
            B/=s
            li2.append(s)
            break
        if s==li[-1]:
            p=1
n=1
for m in li2:
    n*=m
print(n)



### FIXED CODE ###

import fractions
a=input().split()
A=int(a[0])
B=int(a[1])
def lcm(x,y):
  return(x*y)//fractions.gcd(x,y)
print(lcm(A,B))
### BUGGY CODE ###

N=int(input())
from collections import defaultdict
from collections import deque
branch=defaultdict(set)
for i in range(N-1):
    a,b,c=map(int,input().split())
    branch[a]|={(b,c),}
    branch[b]|={(a,c),}
Q,K=map(int,input().split())
dist=[float('inf')]*(N+1)
dist[K]=0
check=deque([(K,set())])

while len(check)>0:
    now=check.popleft()
    for nex,c in branch[now[0]]:
        if nex not in now[1]:
            dist[nex]=min(dist[nex],dist[now[0]]+c)
            check.append((nex,now[1]|{now[0]}))
for q in range(Q):
    x,y=map(int,input().split())
    print(dist[x]+dist[y])

### FIXED CODE ###

N=int(input())
from collections import defaultdict
from collections import deque
branch=defaultdict(set)
for i in range(N-1):
    a,b,c=map(int,input().split())
    branch[a]|={(b,c),}
    branch[b]|={(a,c),}
Q,K=map(int,input().split())
dist=[float('inf')]*(N+1)
dist[K]=0
check=deque([K])
while len(check)>0:
    now=check.popleft()
    for nex,c in branch[now]:
        if dist[nex]>dist[now]+c:
            dist[nex]=dist[now]+c
            check.append(nex)
for q in range(Q):
    x,y=map(int,input().split())
    print(dist[x]+dist[y])
### BUGGY CODE ###

# -*- coding:utf-8 -*-
import sys

from fractions import gcd

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


def solve():
    A, B = list(map(int, sys.stdin.readline().split()))
    cd = gcd(A, B)

    if cd == 1:
        print(1)
        return

    ans = 1 # 1
    primes = get_sieve_of_eratosthenes(cd)
    for prime in primes:
        if cd%prime == 0:
            ans += 1

    print(ans)
    return


if __name__ == "__main__":
    solve()


### FIXED CODE ###

# -*- coding:utf-8 -*-
import sys
from fractions import gcd
from collections import Counter

def prime_factorization(n):
    """nを素因数分解する
    return d(dict): 素因数をキー、素因数の指数部を値とするディクショナリを返す

    n=140: d = {2: 2, 5: 1, 7: 1}
    """
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m = m + 1 if m == 2 else m + 2

    if n > 1:
        d[n] += 1
    return d


def solve():
    A, B = list(map(int, sys.stdin.readline().split()))
    cd = gcd(A, B)

    if cd == 1:
        print(1)
        return

    """
    (素因数分解の素因数の個数)+1が答え
    """

    prime_d = prime_factorization(cd)
    print(len(prime_d)+1)


if __name__ == "__main__":
    solve()
### BUGGY CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
    
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
    
A, B = map(int, input().split())

gcd_AB = gcd(A, B)
cd = []
for i in range(2, gcd_AB + 1):
    if A % i == 0 and B % i == 0:
        cd.append(i)

count = 1
for i in range(len(cd)):
    if is_prime(cd[i]) == True:
        count += 1

print(count)

### FIXED CODE ###

import fractions
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
    
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
    
A, B = map(int, input().split())

ans = 1
tmp = make_divisors(fractions.gcd(A ,B))
for x in tmp:
    if is_prime(x):
        ans += 1

print(ans)
### BUGGY CODE ###

n = int(raw_input().rstrip("\n"))
piles = map(int, raw_input().rstrip("\n").split(" "))

limits = [(0, piles[0])]
from collections import defaultdict
counter = defaultdict(int)
for i , pile in enumerate(piles):
  count = pile
  for pile_index, limit in limits:
    if count <= limit:
      counter[pile_index] += count
      count = 0
    else:
      counter[pile_index] += limit
      count -= limit
    if count == 0:
      break
  if count > 0:
    limits.append((i, count))
    counter[i] += count

for i in xrange(n):
  print counter[i]


### FIXED CODE ###

def binary_search(item, values):
  top = 0
  bottom = len(values) - 1
  length = bottom - top + 1
  middle = top + (length // 2)
  while length >= 1:
    middle_item = values[middle][1]
    if middle_item == item:
      break
    if middle_item < item:
      top = middle + 1
    else:
      bottom = middle - 1
    length = bottom - top + 1
    middle = top + (length // 2)
  if middle <= (len(values) - 1):
    return middle
  else:
    return -1

n = int(raw_input().rstrip("\n"))
piles = map(int, raw_input().rstrip("\n").split(" "))

limits = [(-1, 0)]
from collections import defaultdict
counter = defaultdict(int)
gaps = defaultdict(int)
for i , count in enumerate(piles):
  position = binary_search(count, limits)
  if position == -1:
    limits.append((i, count))
    counter[i] += 1
  else:
    limit_index, limit = limits[position]
    counter[limit_index] += 1
    gaps[limit_index] -= limit - count
    
results = defaultdict(int)
#print limits
total = 0
for position in xrange(len(limits)-1,0,-1):
  limit_index, limit = limits[position]
  #print (total + counter[limit_index]) ,  (limit - limits[position -1][1]) ,gaps[limit_index]
  results[limit_index] = (total + counter[limit_index]) * (limit - limits[position -1][1]) + gaps[limit_index]
  total += counter[limit_index]

for i in xrange(n):
  print results[i]
### BUGGY CODE ###

# ABC 065 B

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

q = []
i = 1
while i != 2:
    if A[i-1] in q:
        print(-1)
        break
    q.append(i)
    i = A[i-1]
else:
    print(len(q))

### FIXED CODE ###

# ABC 065 B

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

i = 1
s = 0
while i != 2:
    s += 1
    A[i-1], i = 1, A[i-1]
    if i == 1:
        print(-1)
        break
else:
    print(s)
### BUGGY CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
for _ in range(m):
  b, c = map(int, input().split())
  a += [c for _ in range(b)]
desc = sorted(a, reverse=True)
ans = sum(desc[:n])
print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
d = []
for _ in range(m):
  b, c = map(int, input().split())
  d.append((b, c))
d.sort(key=lambda x: x[1], reverse=True)
l = 0
for bc in d:
  a.extend([bc[1] for _ in range(bc[0])])
  l += bc[0]
  if l > n: break
desc = sorted(a, reverse=True)
ans = sum(desc[:n])
print(ans)
### BUGGY CODE ###

a, b = map(int, input().split())
a_factorization = set()
b_factorization = set()

while a != 1:
    for i in range(2, a+1):
        if a % i == 0:
            a //= i
            a_factorization.add(i)

while b != 1:
    for i in range(2, b+1):
        if b % i == 0:
            b //= i
            b_factorization.add(i)

a_factorization &= b_factorization
ans = len(a_factorization) + 1
print(ans)

### FIXED CODE ###


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a, b = map(int, input().split())

s1 = set(prime_factorize(a))
s2 = set(prime_factorize(b))

ans = len(s1 & s2) + 1
print(ans)
### BUGGY CODE ###

N, M = map(int,input().split())
L = [0] * M
R = [0] * M
for i in range(M):
    L[i], R[i] = map(int, input().split())

skylist = []
for i in range(M):
    key = list(range(L[i], R[i] + 1))
    skylist.append(key)

for i in range(M):
    if M != 1:
        nice_key = list(set(skylist[0])&set(skylist[1]))
        try:
            nice_key = list(set(nice_key)&set(skylist[i+1]))
        except:
            last_key = list(set(nice_key)&set(skylist[-1]))
    elif M ==1:
            last_key = skylist[0][::]

print(len(last_key))


### FIXED CODE ###

n, m = map(int, input().split())
l_lst = [0] * m
r_lst = [0] * m
for i in range(m):
    l, r = map(int, input().split())
    l_lst[i] = l
    r_lst[i] = r

if max(l_lst) <= min(r_lst):
    print(min(r_lst) - max(l_lst) + 1)
else:
    print(0)
### BUGGY CODE ###

from math import floor


def main():
    result = 0
    N = int(input())
    if N % 2 == 0:
        N //= 2
        while N > 0:
            result += floor(N / 5)
            N //= N / 5
        print(result)
    else:
        print(0)


if __name__ == '__main__':
    main()



### FIXED CODE ###

def main():
    result = 0
    N = int(input())
    if N % 2 == 0:
        N //= 2
        while N > 0:
            N //= 5
            result += N
        print(result)
    else:
        print(0)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

def solve(Card):
  if len(Card)==1: return 0
  X = []
  for i in range(len(Card)-1):
    A = Card[:]
    tmp = tuple(A[i]+A[i+1])
    if tmp in d: cost = d[tmp]
    else:
      cost = reduce(lambda a,b: a*b, tmp)
      d[tmp] = cost
    tmp = list(tmp)
    tmp[1:3] = []
    A[i:i+2] = [tmp]
    X.append(cost+solve(A))
  return min(X)
    
d={}
n = int(raw_input())
Card = [map(int,raw_input().split()) for _ in [0]*n]
print solve(Card)

### FIXED CODE ###

n = int(raw_input())
C = [[] for _ in [0]*n]
W = {}
for i in range(n):
  C[i] = map(int, raw_input().split())
  W[(i, i)] = 0
for i in range(1, n):
  for j in range(0, n-i):
    a = j+i
    W[(j, a)] = min([C[j][0] * C[k][1] * C[k+1][0] * C[a][1] + W[(j, k)] + W[(k+1, a)] for k in range(j, a)])
print W[0, n-1]
### BUGGY CODE ###

x, y, z, k = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
t = []
for i in range(x):
    for j in range(y):
        for l in range(z):
            if i * j * l < k:
                t.append(a[i]+b[j]+c[l])
t.sort(reverse=True)
for i in range(k):
    print(t[i])

### FIXED CODE ###

x,y,z,K=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans=[]
for i in range(x):
  for j in range(y):
    for k in range(z):
      if (i+1)*(j+1)*(k+1)<=K:
        ans.append(a[i]+b[j]+c[k])
      else:
        break
ans.sort(reverse=True)
for i in range(K):
  print(ans[i])
### BUGGY CODE ###

from collections import deque
n, q = map(int,input().split())
s = input()
ans = deque()
for i in range(q):
    l, r = map(int,input().split())
    ans.append(s[l-1:r].count('AC'))
for i in ans:
    print(i)

### FIXED CODE ###

n, q = map(int,input().split())
s = input()
t = [0]*(n+1)
for i in range(n):
    t[i+1] = t[i] + (1 if s[i:i+2] == 'AC' else 0)
for i in range(q):
    l, r = map(int,input().split())
    print(t[r-1]-t[l-1])
### BUGGY CODE ###

import functools

def read():
    N, K = map(int, input().split(' '))
    As = list(map(int, input().split(' ')))
    return N, K, As

def mul(l):
    return functools.reduce(lambda x, y: x * y, l)

def fun(N, K, As):
    for i in range(N - K):
        prev = mul(As[i:i+K])
        current = mul(As[i+1:i+K+1])
        if current > prev:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    N, K, As = read()
    fun(N, K, As)

### FIXED CODE ###

def read():
    N, K = map(int, input().split(' '))
    As = list(map(int, input().split(' ')))
    return N, K, As


def fun(N, K, As):
    for i in range(N - K):
        prev = As[i]
        current = As[i+K]
        if current > prev:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    N, K, As = read()
    fun(N, K, As)