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

N = int(input())
X = str(input())
count = X.count("1")
num, nump, numm = 0, 0, 0
now, nowp, nowm = 1, 1, 1

xx = [0] * N
x_plus = [0] * N
x_minus = [0] * N
for i in range(1, N + 1):
  if i != 1:
    if count > 0:
      now *= 2
      nowp *= 2
    
    now %= count
    nowp %= (count + 1)
    
    if count >= 2:
      nowm *= 2
      nowm %= (count - 1)
  
  else:
    if count >= 1:
      now %= count
    nowp %= (count + 1)
    if count >= 2:
      nowm %= (count - 1) 
  xx[i - 1] = now
  x_plus[i - 1] = nowp
  x_minus[i - 1] = nowm
  if X[-i] == "1":
    if count > 0:
      num += now
      num %= count
    nump += nowp
    nump %= count + 1
    if count > 1:
      numm += nowm
      numm %= count - 1
    
#print(num, xx, x_plus, x_minus)    

nextn = [0] * N
#ans = [1] * N
for i in range(N):
  if count == 0:
    nextn[i] = 0
  else:  
    if X[i] == "0":
      a = nump + x_plus[N - 1 - i]
      b = count + 1
      #print(a, b)
      nextn[i] = a % b
    else:
      #if count == 2:
      #  nextn[i] = 0
      #else:
        a = numm - x_minus[N - 1 - i]
        b = count - 1
        if b > 0:
          nextn[i] = a % b
        else:
          while True:
            a = 1
          nextn[i] = 0
        
#print(nextn)    
for i in range(N):
  if nextn[i] == 0:
    print("1")
  else:
    nownow = nextn[i]
    ans = 1
    while nownow != 0:
      alpha = bin(nownow)[2:]
      beta = str(alpha).count("1")
      nownow %= beta
      ans += 1
    print(ans)







### FIXED CODE ###

N = int(input())
X = str(input())
count = X.count("1")
num, nump, numm = 0, 0, 0
now, nowp, nowm = 1, 1, 1

if count == 0:
  for i in range(N):
    print(1)
    quit()
elif count == 1:
  if X[-1] == "1":
    for i in range(N):
      if i != N - 1:
        print(2)
      else:
        print(0)
  else:
    for i in range(N):
      if i!= N - 1:
        if X[i] == "1":
          print(0)
        else:
          print(1)
      else:
        print(2)
  quit()
  

xx = [0] * N
x_plus = [0] * N
x_minus = [0] * N
for i in range(1, N + 1):
  if i != 1:
    now *= 2
    nowp *= 2
    
    now %= count
    nowp %= (count + 1)
    

    nowm *= 2
    nowm %= (count - 1)
  
  else:
    now %= count
    nowp %= (count + 1)
    nowm %= (count - 1) 
  xx[i - 1] = now
  x_plus[i - 1] = nowp
  x_minus[i - 1] = nowm
  if X[-i] == "1":
    num += now
    num %= count
    nump += nowp
    nump %= count + 1
    numm += nowm
    numm %= count - 1
    
#print(num, xx, x_plus, x_minus)    

nextn = [0] * N
#ans = [1] * N
for i in range(N):
    if X[i] == "0":
      a = nump + x_plus[N - 1 - i]
      b = count + 1
      #print(a, b)
      nextn[i] = a % b
    else:
      #if count == 2:
      #  nextn[i] = 0
      #else:
        a = numm - x_minus[N - 1 - i]
        b = count - 1
        nextn[i] = a % b
        
#print(nextn)    
for i in range(N):
  if nextn[i] == 0:
    print("1")
  else:
    nownow = nextn[i]
    ans = 1
    while nownow != 0:
      alpha = bin(nownow)[2:]
      beta = str(alpha).count("1")
      nownow %= beta
      ans += 1
    print(ans)
### BUGGY CODE ###

from collections import deque
h,w = list(map(int,input().split()))
f = []
q = deque()
for i in range(h):
    a = list(input())
    for j in range(w):
        if a[j] == '#':
            q.append([0,i,j])
    f.append(a)

ans =0
dxy = [0,1,0,-1,0]
while(len(q)):
    c,y,x = q.popleft()
    for i in range(4):
        ny = y+dxy[i]
        nx = x+dxy[i+1]
        if nx >= w or ny >= h or nx <0 or ny <0:
            continue
        if f[ny][nx] == '.':
            f[ny][nx] = c+1
            q.append([c+1,ny,nx])
        elif f[ny][nx] != '#' and f[ny][nx] > c+1:
            f[ny][nx] = c+1
            q.append([c+1,ny,nx])

for i in range(h):
    for j in range(w):
        if f[i][j] != '#':
            ans = max(ans,f[i][j])
print(ans)


### FIXED CODE ###

from collections import deque
h,w = list(map(int,input().split()))
f = []
q = deque()
for i in range(h):
    a = list(input())
    for j in range(w):
        if a[j] == '#':
            q.append([0,i,j])
    f.append(a)

ans =0
dxy = [0,1,0,-1,0]
while(len(q)):
    c,y,x = q.popleft()
    for i in range(4):
        ny = y+dxy[i]
        nx = x+dxy[i+1]
        if nx >= w or ny >= h or nx <0 or ny <0:
            continue
        if f[ny][nx] == '.':
            f[ny][nx] = c+1
            q.append([c+1,ny,nx])
            ans = max(ans,c+1)
        elif f[ny][nx] != '#' and f[ny][nx] > c+1:
            f[ny][nx] = c+1
            q.append([c+1,ny,nx])
            ans = max(ans,c+1)

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

#D
n,k = map(int,input().split())

MOD = 10 ** 9 + 7

def nCr(a,b):
    bunshi = 1
    bunbo = 1
    
    for i in range(b):
        bunshi *= a-i
    for j in range(b):
        bunbo *= b-j
        
    return bunshi//bunbo

for i in range(1,k+1):
    a1 = nCr(n-k+1,i)
    if i > 1:
        a2 = nCr(k-1,i-1)
    else:
        a2 = 1
    print(a1*a2 % MOD)

### FIXED CODE ###

#D
n,k = map(int,input().split())

MOD = 10 ** 9 + 7

from operator import mul
from functools import reduce

def nCr(n,r):
    if n < r:
        return 0
    r = min(n-r,r)
    if r == 0: 
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under % MOD



for i in range(1,k+1):
    a1 = nCr(n-k+1,i)
    a2 = nCr(k-1,i-1)
    print(a1*a2 % MOD)
### BUGGY CODE ###

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

def P(m):
    pf={}
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:
        pf[m]=1
    return pf

dictlist = []
for i in range(N):
    dictlist.append(P(A[i]))

dict = dictlist[0].copy()
for i in range(1,N):
    new = dictlist[i]
    for k in new.keys():
        if k not in dict:
            dict[k]=new[k]
        elif dict[k]<new[k]:
            dict[k]=new[k]

output = 0
for i in range(N):
    out = 1
    tmp = dictlist[i]
    for k in dict.keys():
        if k in tmp:
            G = dict[k]-tmp[k]
        else:
            G = dict[k]
        out *= int(k)**G %(10**9+7)
    output += out %(10**9+7)
    output = output % (10**9+7)
print(output)

### FIXED CODE ###

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

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i])

output = 0
D =10**9+7
X = X%D

for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))
### BUGGY CODE ###

N, M = map(int,input().split())
L = []
for i in range(M):
    p, y = map(int,input().split())
    L.append((p,y,i))
PY = sorted(L)
from collections import defaultdict
d = defaultdict(list)
for p,y,i in PY:
    d[p].append(y)
for i in range(M):
    p,y,j = L[i]
    print("{:06}{:06}".format(p, d[p].index(y)+1))

### FIXED CODE ###

N, M = map(int,input().split())
L = []
for i in range(M):
    p, y = map(int,input().split())
    L.append((p,y,i))
PY = sorted(L)
from collections import defaultdict
d = defaultdict(int)
ID = [None]*M
for p,y,i in PY:
    d[p] += 1
    ID[i] = d[p]
for i in range(M):
    p,y,j = L[i]
    print("{:06}{:06}".format(p, ID[i]))
### BUGGY CODE ###

S = input()[::-1]
MOD = 10**9+7
dp = [1,0,0,0,0,0,0,0,0,0,0,0,0]
p = 1
for i, s in enumerate(S):
    nx = [0]*13
    for j in range(10) if s=='?' else [int(s)]:
        for k, d in enumerate(dp):
            nx[(k+j*p)%13] += d
    dp = [n % MOD for n in nx]
    p = (10*p)%13
print(dp[5])

### FIXED CODE ###

S = input()[::-1]
MOD = 10**9+7
dp = [1,0,0,0,0,0,0,0,0,0,0,0,0]
p = 1
for i, s in enumerate(S):
    nx = [0,]*13
    if s == '?':
        for k in range(10):
            q = (k*p)%13
            for j, d in enumerate(dp):
                nx[(j+q)%13] += d
    else:
        q = (int(s)*p)%13
        for j, d in enumerate(dp):
            nx[(j+q)%13] += d
    dp = [n % MOD for n in nx]
    p = (10*p)%13
print(dp[5])
### BUGGY CODE ###

from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

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

al = [[] for i in range(N+1)]
for i in range(M):
    a, b = map(int, input().split())
    al[a].append(b)
    al[b].append(a)

block = [[] for i in range(N+1)]
for i in range(K):
    c, d = map(int, input().split())
    block[c].append(d)
    block[d].append(c)

seen = [0 for i in range(N+1)]
num_connect = [0 for i in range(N+1)]
cluster = [0 for i in range(N+1)]

def bfs(u, c):
    visited = [0 for i in range(N+1)]
    stack = deque([u])
    seen[u] = 1
    count = 1

    while len(stack) > 0:
        v = stack.popleft()
        visited[v] = 1
        cluster[v] = c
        for w in al[v]:
            if seen[w] == 0:
                stack.append(w)
                count += 1
                seen[w] = 1

    for i in range(1,N+1):
        if visited[i] == 1:
            num_connect[i] = count

c = 1
for i in range(1,N+1):
    if seen[i] == 0:
        bfs(i, c)
        c += 1

for i in range(1,N+1):
    bl = 0
    for d in block[i]:
        if cluster[i] == cluster[d]:
            bl += 1
    print(num_connect[i] - 1 - len(al[i]) - bl, end=" ")
print()


### FIXED CODE ###

from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

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

al = [[] for i in range(N+1)]
for i in range(M):
    a, b = map(int, input().split())
    al[a].append(b)
    al[b].append(a)

block = [[] for i in range(N+1)]
for i in range(K):
    c, d = map(int, input().split())
    block[c].append(d)
    block[d].append(c)

seen = [0 for i in range(N+1)]
num_connect = [0 for i in range(N+1)]
cluster = [0 for i in range(N+1)]

def bfs(u, c):
    visited = []
    stack = deque([u])
    seen[u] = 1
    count = 1

    while len(stack) > 0:
        v = stack.popleft()
        visited.append(v)
        cluster[v] = c
        for w in al[v]:
            if seen[w] == 0:
                stack.append(w)
                count += 1
                seen[w] = 1

    for v in visited:
        num_connect[v] = count

c = 1
for i in range(1,N+1):
    if seen[i] == 0:
        bfs(i, c)
        c += 1

for i in range(1,N+1):
    bl = 0
    for d in block[i]:
        if cluster[i] == cluster[d]:
            bl += 1
    print(num_connect[i] - 1 - len(al[i]) - bl, end=" ")
print()
### BUGGY CODE ###

H,W = map(int,input().split())
grid = [0] * H
for i in range(H):
    grid[i] = input()
right = [[0]*W for _ in range(H)]
left = [[0]*W for _ in range(H)]
up = [[0]*W for _ in range(H)]
down = [[0]*W for _ in range(H)]
for y in range(H):
    for x in range(W):
        if grid[y][x] == '.':
            r = 0
            while True:
                if x+r+1 == W or grid[y][x+r+1] == '#':
                    break
                r += 1
            right[y][x] = r
            l = 0
            while True:
                if x-l-1 == -1 or grid[y][x-l-1] == '#':
                    break
                l += 1
            left[y][x] = l
            u = 0
            while True:
                if y-u-1 == -1 or grid[y-u-1][x] == '#':
                    break
                u += 1
            up[y][x] = u
            d = 0
            while True:
                if y+d+1 == H or grid[y+d+1][x] == '#':
                    break
                d += 1
            down[y][x] = d
ans = 0
for y in range(H):
    for x in range(W):
        if grid[y][x] == '.':
            can = 1 + right[y][x] + left[y][x] + up[y][x] + down[y][x]
            ans = max(ans,can)
print(ans)



### FIXED CODE ###

H,W = map(int,input().split())
grid = [0] * H
for i in range(H):
    grid[i] = input()
right = [[0]*W for _ in range(H)]
left = [[0]*W for _ in range(H)]
up = [[0]*W for _ in range(H)]
down = [[0]*W for _ in range(H)]
for i in range(H):
    now = 0
    for x in range(W):
        if grid[i][x] == '.':
            left[i][x] = now
            now += 1
        else:
            now = 0
    now = 0
    for x in range(W-1,-1,-1):
        if grid[i][x] == '.':
            right[i][x] = now
            now += 1
        else:
            now = 0
for x in range(W):
    now = 0
    for y in range(H):
        if grid[y][x] == '.':
            up[y][x] = now
            now += 1
        else:
            now = 0
    now = 0
    for y in range(H-1,-1,-1):
        if grid[y][x] == '.':
            down[y][x] = now
            now += 1
        else:
            now = 0
ans = 0
for y in range(H):
    for x in range(W):
        if grid[y][x] == '.':
            can = 1 + right[y][x] + left[y][x] + up[y][x] + down[y][x]
            ans = max(ans,can)
print(ans)
### BUGGY CODE ###

N = int(input())
S = input()

# N = 39
# S = 'RBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB'

n_R = S.count('R')
n_G = S.count('G')
n_B = S.count('B')
ans = n_R * n_G * n_B

for a in range(N - 2):
    # a = 2
    for b in range(1, N // 2 + 1):
        # b = 3
        i = a
        j = a + b
        k = a + 2 * b

        if k > N - 1:
            continue

        if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            ans -= 1
print(ans)


### FIXED CODE ###

N = int(input())
S = input()

# N = 39
# S = 'RBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB'

n_R = S.count('R')
n_G = S.count('G')
n_B = S.count('B')
ans = n_R * n_G * n_B

for b in range(1, N // 2 + 1):
    # b = 2
    for a in range(N - 2 * b):
        # a = 1
        i = a
        j = a + b
        k = a + 2 * b

        if k > N - 1:
            continue

        if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            ans -= 1
print(ans)
### BUGGY CODE ###

X = int(input())
for a in range(0, 10**4):
    for b in range(0, 10**4):
        if X == a**5 - b**5:
            print(a, b)
            exit()
        elif X == a**5 + b**5:
            print(a, -b)
            exit()
        elif X == a**5 - (10**4 - b)**5:
            print(a, 10**4 - b)
            exit()
        elif X == -a**5 - (10**4 - b)**5:
            print(-a, 10**4 - b)
            exit()

### FIXED CODE ###

X = int(input())
for a in range(0, 10**3):
    for b in range(0, 10**3):
        if X == a**5 - b**5:
            print(a, b)
            exit()
        elif X == a**5 + b**5:
            print(a, -b)
            exit()
        elif X == -a**5 - (10**4 - b)**5:
            print(-a, 10**4 - b)
            exit()
### BUGGY CODE ###

n = int(input())
s = input()
attention = []
for i in range(n):
    leader = s[i]
    west = s[0:i+1]
    east = s[i:len(s)]
    count_w = west.count("W")
    count_e = east.count("E")
    count = count_w +count_e
    attention.append(count)
print(min(attention) - 1)

### FIXED CODE ###

n = int(input())
s = input()
west = []
east = []
count_w = 0
count_e = 0

for i in s:
    if i == "W":
        count_w+=1
    west.append(count_w)
for j in reversed(s):
    if j == "E":
        count_e +=1
    east.append(count_e)
r_east = [k for k in reversed(east)]
   
attention = [west[i] + r_east[i] for i in range(n)]
print(min(attention)-1)
### BUGGY CODE ###

import sys
import bisect

N = int(sys.stdin.readline().rstrip())
S = list(sys.stdin.readline().rstrip())
Q = int(sys.stdin.readline().rstrip())

idx = {chr(ord("a") + i): set() for i in range(26)}

for i, s in enumerate(S):
    idx[s].add(i + 1)

for _ in range(Q):
    t, i, c = sys.stdin.readline().rstrip().split()
    i = int(i)
    if t == "1":
        if S[i - 1] != c:
            idx[S[i - 1]].remove(i)
            idx[c].add(i)
            S[i - 1] = c
    else:
        c = int(c)
        ans = 0
        for a, id in idx.items():
            id = sorted(list(id))
            x = bisect.bisect_left(id, i)
            y = bisect.bisect_right(id, c)
            if y - x:
                ans += 1
        print(ans)

### FIXED CODE ###

import sys
import bisect
import copy

N = int(sys.stdin.readline().rstrip())
S = list(sys.stdin.readline().rstrip())
Q = int(sys.stdin.readline().rstrip())

cnt = [0] * 26
cumcnt = [cnt]

for i, s in enumerate(S):
    tmp = copy.copy(cumcnt[i])
    tmp[ord(s) - ord("a")] += 1
    cumcnt.append(tmp)

q_remove = {}
q_add = {}

for _ in range(Q):
    t, i, c = sys.stdin.readline().rstrip().split()
    t = int(t)
    i = int(i)
    d = S[i - 1]
    if t == 1:
        if d != c:
            if d not in q_remove.keys():
                q_remove[d] = [i]
            else:
                bisect.insort(q_remove[d], i)
            if c not in q_add.keys():
                q_add[c] = [i]
            else:
                bisect.insort(q_add[c], i)
            S[i - 1] = c 
    else:
        c = int(c)
        cnt_l = copy.copy(cumcnt[i - 1])
        cnt_r = copy.copy(cumcnt[c])
        for q, idx in q_add.items():
            x = bisect.bisect_right(idx, i - 1)
            y = bisect.bisect_right(idx, c)
            cnt_l[ord(q) - ord("a")] += x
            cnt_r[ord(q) - ord("a")] += y
        for q, idx in q_remove.items():
            x = bisect.bisect_right(idx, i - 1)
            y = bisect.bisect_right(idx, c)
            cnt_l[ord(q) - ord("a")] -= x
            cnt_r[ord(q) - ord("a")] -= y
        ans = 0
        for l, r in zip(cnt_l, cnt_r):
            if r - l > 0:
                ans += 1
        print(ans)
### BUGGY CODE ###

X,Y,Z,K= map(int,input().split())
A = sorted(list(map(int,input().split())), reverse=True)
B = sorted(list(map(int,input().split())), reverse=True)
C = sorted(list(map(int,input().split())), reverse=True)



ab_list = []

for i in range(X):
    for j in range(Y):
        ab_list.append(A[i]+B[j])

ab_list2 = sorted(ab_list,reverse = True)[:min(X*Y,K)]
abc_list = []

count = 0
count2 = 0

for i in range(min(X*Y,K)):
    for j in range(Z):
        abc_list.append(ab_list2[i]+C[j])


abc_list2 = sorted(abc_list,reverse = True)[:K]

for i in range(K):
    print(abc_list2[i])


    
    


    




    

### FIXED CODE ###

X,Y,Z,K= map(int,input().split())
A = sorted(list(map(int,input().split())), reverse=True)
B = sorted(list(map(int,input().split())), reverse=True)
C = sorted(list(map(int,input().split())), reverse=True)



ab_list = []

for i in range(X):
    for j in range(Y):
        ab_list.append(A[i]+B[j])

ab_list2 = sorted(ab_list,reverse = True)[:min(X*Y,K)]
abc_list = []

count = 0
count2 = 0

for i in range(min(X*Y,K)):
    for j in range(Z):
        abc_list.append(ab_list2[i]+C[j])


abc_list2 = sorted(abc_list,reverse = True)[:K]

for i in range(K):
    print(abc_list2[i])
### BUGGY CODE ###

import sys

for line in sys.stdin:
    result = 0
    d = int(line)
    x = d
    while x < 600:
        result += x**2 * d
    print result

### FIXED CODE ###

import sys

for line in sys.stdin:
    result = 0
    d = int(line)
    x = d
    while x < 600:
        result += x**2 * d
        x += d
    print result
### BUGGY CODE ###

from itertools import accumulate
from bisect import bisect
N = int(input())
A = list(map(int,input().split()))
C = [0]+list(accumulate(A))

def helper(i,j):
  m = (C[j]+C[i])/2
  k = bisect(C, m, lo=i,hi=j)
  if k == i:
    k += 1
  elif k == j:
    k -= 1

  if k > 0:
    _,a,b = min((abs(m-C[x]),C[x]-C[i],C[j]-C[x]) for x in (k-1,k))
  else:
    a,b = C[k]-C[i],C[j]-C[k]

  return a,b

m = bisect(C,C[N]/2)
if m < 2:
  m = 2
elif m > N-2:
  m = N-2

L = helper(0,m)+helper(m,N)
best = max(L)-min(L)
i = m+1
while i < N-1 and (2*C[i]-C[N]) < best*2:
  L = helper(0,i)+helper(i,N)
  best = min(best, max(L)-min(L))
  i += 1
i = m-1
while i > 1 and (C[N]-2*C[i]) < best*2:
  L = helper(0,i)+helper(i,N)
  best = min(best, max(L)-min(L))
  i -= 1


print(best)

### FIXED CODE ###

from itertools import accumulate
from bisect import bisect

N = int(input())
C = [0]+list(accumulate(map(int,input().split())))

def h(i,j):
  ci,cj = C[i],C[j]
  k = bisect(C, (ci+cj)//2, lo=i+1,hi=j)
  _,a,b = min((abs(ci+cj-2*c),cj-c,c-ci) for c in (C[k-1],C[k]))
  return a,b

def solve(x):
  L = h(0,x)+h(x,N)
  return max(L)-min(L)

print(min(solve(i) for i in range(2,N-1)))
### BUGGY CODE ###

s = list(input())
t = list(input())
n = len(s)
m = len(t)

dp = [['']*m for i in range(n)]
if s[0] == t[0]:
    dp[0][0] = s[0]

for i in range(1,m):
    if s[0] == t[i]:
        dp[0][i] = s[0]
    else:
        dp[0][i] = dp[0][i-1]
for i in range(1,n):
    if t[0] == s[i]:
        dp[i][0] = t[0]
    else:
        dp[i][0] = dp[i-1][0]

for i in range(1,n):
    for j in range(1,m):
        if s[i] == t[j]:
            dp[i][j] = dp[i-1][j-1] + s[i]
        else:
            if len(dp[i-1][j]) > len(dp[i][j-1]):
                dp[i][j] = dp[i-1][j]
            else:
                dp[i][j] = dp[i][j-1]
print(dp[-1][-1])

### FIXED CODE ###

s = tuple(input())
t = tuple(input())
n = len(s)
m = len(t)

dp = [[0]*(m+1) for i in range(n+1)]

for i in range(1,n+1):
    for j in range(1,m+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = dp[i-1][j-1]  + 1
        else:
            dp[i][j] = max(dp[i-1][j],dp[i][j-1])

res = ''
while n != 0 and m != 0:
    if dp[n][m] == dp[n-1][m]:
        n -= 1
    elif dp[n][m] == dp[n][m-1]:
        m -= 1
    else:
        n -= 1
        m -= 1
        res = s[n] + res
print(res)
### BUGGY CODE ###

from collections import deque
n=int(input())
g=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)
q=deque([[0,[0]]])
v=[0]*n
v[0]=1
f=0
while q:
    p=q.popleft()
    #if p[1][-1]==n-1:
        #break
    v[p[0]]=1
    for i in g[p[0]]:
        if v[i]==0:
            v[i]=1
            #print(i)
            if i==n-1:
                r=p[1]+[i]
                f=1
                break
            q.append([i,p[1]+[i]])
    if f==1:
        break
fe=deque(r[:(-(-len(r)//2))])
v=[0]*n
v[r[(-(-len(r)//2))]]=1
v[0]=1
while fe:
    s=fe.popleft()
    for i in g[s]:
        if v[i]==0:
            fe.append(i)
            v[i]=1
x=sum(v)-1
y=n-x
if x>y:
    print('Fennec')
else:
    print('Snuke')


### FIXED CODE ###

import math
import sys
sys.setrecursionlimit(1000000)
N = int(input())
graph = {}
SCORE = 0
def dfs(visited,v,depth):
    visited[v] = depth
    for next_v in graph[v]:
        if  visited[next_v]  == -1 :
            dfs(visited,next_v,depth + 1)




for _ in range(N-1):
    a,b = map(int,input().split())
    if a not in graph:
        graph[a] = [b]
    else:
        graph[a].append(b)

    if b not in graph:
        graph[b] = [a]
    else:
        graph[b].append(a)

vF = [-1] * (N + 1)
vF[1] = 0
dfs(vF,1,0)
# print(vF)

vS = [-1] * (N + 1)
vS[N] = 0

dfs(vS,N,0)
# print(vS)

fc = 0
sc = 0

for f,s in zip(vF[1:N + 1],vS[1:N + 1]):
    if f <= s:
        fc += 1
    else:
        sc += 1

# print(fc,sc)
if fc > sc:
    print("Fennec")
else:
    print("Snuke")
### BUGGY 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")


### FIXED CODE ###

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

for i in range(k, n):
    if  scs[i] > scs[i - k]:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

from functools import reduce

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

mul = int(reduce(lambda x, y: x * y, A[:K]))

res = [mul]

for i in range(K, N):
    res.append(res[-1]*A[i]//A[i-K])
    print('Yes' if res[-2] < res[-1] else 'No')


### FIXED CODE ###

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

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