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

N = int(input())

XY = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append((x, y))
    
# BITの定義
import math
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
 
    # index 1からiの値の和を返す
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    # index iの値にxを加算する
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

#######################
# 開始
p_list = XY[:]

# y座標の圧縮
from operator import itemgetter
p_list = sorted(p_list, key=itemgetter(1))
p_list = [ (x, y, i+1) for i, (x, y) in enumerate(p_list)]

# xでソート
p_list= sorted(p_list)

a = [] # 左下
b = [] # 左上
c = [] # 右下
d = [] # 右上

# a,bを求める
bit = Bit(N)
for i, (x, y, r) in enumerate(p_list):
    tmp = bit.sum(r)
    a.append(tmp)
    b.append(i-tmp)
    bit.add(r, 1)

# c,dを求める
bit = Bit(N)
for i, (x, y, r) in enumerate(reversed(p_list)):
    tmp = bit.sum(r)
    c.append(tmp)
    d.append(i-tmp)
    bit.add(r, 1)
c = c[::-1]
d = d[::-1]

# ある点が四角に含まれる場合の総数を求めるメソッド
power = [1] * N
for i in range(1, N):
    power[i] = power[i-1] * 2 % 998244353
def p_comb(a, b, c, d):
    a = power[a] - 1
    b = power[b] - 1
    c = power[c] - 1
    d = power[d] - 1
    
    ret = (a+1) * (d+1) * c * b
    ret += (b+1) * (c+1) * a * d
    ret -= a*b*c*d
    ret += power[N-1]
    return ret % 998244353
 
ans = 0
for i in range(N):
    ans += p_comb(a[i], b[i], c[i], d[i])
    
print(ans % 998244353)   


### FIXED CODE ###

N = int(input())

XY = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append((x, y))
    
# BITの定義
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
 
    # index 1からiの値の和を返す
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    # index iの値にxを加算する
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

#######################
# 開始
from operator import itemgetter
def solve():
    p_list = XY[:]

    # y座標の圧縮
    p_list = sorted(p_list, key=itemgetter(1))
    p_list = [ (x, y, i+1) for i, (x, y) in enumerate(p_list)]

    # xでソート
    p_list= sorted(p_list)

    # ある点が四角に含まれる場合の総数を求めるメソッド
    power = [1] * N
    for i in range(1, N):
        power[i] = power[i-1] * 2 % 998244353

    # a,bを求める
    bit = Bit(N)
    ans = 0
    for i, (x, y, r) in enumerate(p_list):
        tmp = bit.sum(r)
        a = tmp
        b = i-tmp
        c = r-tmp-1
        d = (N-r+1)-(i-tmp)-1
        bit.add(r, 1)
        _a = power[a] - 1
        _b = power[b] - 1
        _c = power[c] - 1
        _d = power[d] - 1

        ret = (_a+1) * (_d+1) * _c * _b
        ret += (_b+1) * (_c+1) * _a * _d
        ret -= _a*_b*_c*_d
        ret += power[N-1]
        ans += ret % 998244353

    print(ans % 998244353)
    
solve()
### BUGGY CODE ###

from collections import deque

Y, X = map(int,input().split())
# sy, sx = map(int, input().split())
# gy, gx = map(int, input().split())
sy,sx = 1,1
gy,gx = Y,X
s = [["#"]*(X+2) for _ in range(Y+2)]
for y in range(Y):
    s[y+1] = list("#"+input()+"#")
inf = Y*X
c = [[inf]*X for _ in range(Y)]
c[sy-1][sx-1] = 0
drs = [[-1,0],[1,0],[0,-1],[0,1]]
q = deque([(sy-1, sx-1)])

while q:
    y,x = q.popleft()
    cost = c[y][x]
    for dx,dy in drs:
        x2 = x+dx
        y2 = y+dy
        if s[y2+1][x2+1] == "." and c[y2][x2] > cost:
            c[y2][x2] = cost+1
            q.appendleft((y2,x2))
if c[gy-1][gx-1] == inf:
    print("-1")
else:
    dots = 0
    for s1 in s:
        dots +=s1.count(".")
    print(dots-c[gy-1][gx-1]-1)

### FIXED CODE ###

H, W = map(int,input().split())
c = [["#"]*(W+2) for _ in range(H+2)]
dots = 0
for y in range(H):
    c[y+1] = "#",*list(input()),"#" 
    dots += c[y+1].count(".")
inf = H*W
m = [[inf]*W for _ in range(H)]
m[0][0] = 0
drs = [[-1,0],[1,0],[0,-1],[0,1]]

s = 0
yx = [[1, 1]]
notgoal = True
while notgoal and yx:
    yx2 = []
    s += 1
    for y,x in yx:
        for dy, dx in drs:
            x2 = x+dx
            y2 = y+dy
            if c[y2][x2] == "." and m[y2-1][x2-1] == inf:
                m[y2-1][x2-1] = s
                if (y2,x2) == (H,W):
                    notgoal = False
                else:
                    yx2.append([y2, x2])
    yx = yx2

if notgoal:
    print("-1")
else:
    print(dots-s-1)
### BUGGY CODE ###

import fractions
import itertools as it

N = int(input())
a = list(map(int, input().split()))
ccb = it.combinations(a, int(N-1))

tmp = []
for element in ccb:
	tmp.append((element))

ans = 0

for i in tmp:
    hoge = list(i)
    pairgcd = hoge[0]
    for k in range(len(hoge)):
        pairgcd = fractions.gcd(pairgcd, hoge[k])
    if pairgcd > ans:
        ans = pairgcd

print(ans)

### FIXED CODE ###

import fractions

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

ans = 0

lf = [0]*N
rf = [0]*N

for i in range(1,N):
    lf[i] = fractions.gcd(lf[i-1],a[i-1])
    rf[i] = fractions.gcd(rf[i-1],a[-i])

ans = 0
for i in range(N):
    ans = max(ans,fractions.gcd(lf[i],rf[-i-1]))

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

M,a,t,p=2019,0,0,1;l=[0]*M
for i in input()[::-1]:l[t]+=1;t=(t+int(i)*p)%M;a+=l[t];p*=10
print(a)

### FIXED CODE ###

M=2019
s=input()[::-1]
a=t=0
p=1
l=[0]*M
for i in s:
  l[t]+=1
  t+=int(i)*p
  t%=M
  a+=l[t]
  p=p*10%M
print(a)
### BUGGY CODE ###

n = int(raw_input())

aa = []
for i in range(n):
    t = int(raw_input())
    aa.append(t)

cnt = 0
b = [1]
a = aa[0]
while 1:
    cnt += 1
    if a == 2:
        print cnt
        exit()
    a = aa[a-1]
    if a in b:
        print -1
        exit()
    b.append(a)
    if cnt == n:
        print -1
        exit()

### FIXED CODE ###

n = int(raw_input())

aa = []
for i in range(n):
    t = int(raw_input())
    aa.append(t)

cnt = 0
b = dict({1: True})
a = aa[0]
while 1:
    cnt += 1
    if a == 2:
        print cnt
        exit()
    a = aa[a-1]
    if a in b:
        print -1
        exit()
    b[a] = True
    if cnt == n:
        print -1
        exit()
### BUGGY CODE ###

def main():
    S = list(input())
    N = len(S)

    P = 2019
    num = [0] * P
    num[0] = 1
    now, ans = 0, 0
    _10 = 1
    for s in S[::-1]:
        now = (now + int(s)*_10) % P
        _10 *= 10
        ans += num[now]
        num[now] += 1
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    import sys

    S = list(input())
    N = len(S)

    # c = 0
    # for i in range(0, N-3):
    #     for j in range(i+4, N+1):
    #         num = int(''.join(S[i:j]))
    #         if num % 2019 == 0:
    #             c += 1
    #             print(num)
    # print(c)

    P = 2019
    num = [0] * P
    num[0] = 1
    now, ans = 0, 0
    _10 = 1
    for i in range(N-1, -1, -1):
        now = (now + int(S[i])*_10) % P
        _10 *= 10
        _10 %= P
        ans += num[now]
        num[now] += 1
    print(ans)


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

s = input()
s = s.split('BC')
count = 0

for i in range(0,len(s)-1):
    j = 1
    while(j<=len(s[i]) and s[i][-j]=='A'):
        count = count + 1
        s[i+1] = 'A' + s[i+1]
        j = j + 1
        
print(count)

### FIXED CODE ###

s = input()
s = s.split('BC')
count = [0]
count_all = 0
Icount = 0

for i in range(0,len(s)-1):
    Icount = 0
    j = 1
    while(j<=len(s[i]) and s[i][-j]=='A'):
        Icount = Icount + 1
        j = j + 1
        
    if (s[i]=='' or s[i]=='A'*len(s[i])):
        Icount = Icount + count[-1]
   
    count.append(Icount)
  
        
count_all = sum(count)  
print(count_all)
### BUGGY CODE ###

from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
import sys
input=sys.stdin.readline

def calc():
  n,m,s,t=map(int,input().split())
  s,t=s-1,t-1
  row=[]
  col=[]
  data1=[]
  data2=[]
  for _ in range(m):
    u,v,a,b=map(int,input().split())
    row.append(u-1)
    col.append(v-1)
    data1.append(a)
    data2.append(b)
  g1=csr_matrix((data1,(row,col)),shape=(n,n))
  g2=csr_matrix((data2,(row,col)),shape=(n,n))
  d1=dijkstra(g1,directed=False,indices=s)
  d2=dijkstra(g2,directed=False,indices=t)
  INF=10**15
  ans=[INF]*n
  ans[n-1]=int(d1[n-1]+d2[n-1])
  for i in range(n-2,-1,-1):
    tmp=int(d1[i]+d2[i])
    ans[i]=min(tmp,ans[i+1])
  for i in range(n):
    print(INF-ans[i])
calc()

### FIXED CODE ###

import sys
input=sys.stdin.readline

import heapq

def dijkstra(s,edge):
    #始点sから各頂点への最短距離
    d = [float("inf")] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,[e[0]+d[v],e[1]])
    return d

n,m,s,t=map(int,input().split())
s,t=s-1,t-1
edge1=[[] for _ in range(n)]
edge2=[[] for _ in range(n)]
for _ in range(m):
  u,v,a,b=map(int,input().split())
  edge1[u-1].append([a,v-1])
  edge1[v-1].append([a,u-1])
  edge2[u-1].append([b,v-1])
  edge2[v-1].append([b,u-1])
d1=dijkstra(s,edge1)
d2=dijkstra(t,edge2)
INF=10**15
ans=[INF]*n
ans[n-1]=int(d1[n-1]+d2[n-1])
for i in range(n-2,-1,-1):
  tmp=int(d1[i]+d2[i])
  ans[i]=min(tmp,ans[i+1])
for i in range(n):
  print(INF-ans[i])
### BUGGY CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
prev = 1
for i in range(K):
  prev *= A[i]

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


### FIXED CODE ###

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

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

n = int(input())
a = list(map(int, input().split()))
q = int(input())
from collections import Counter
x = Counter(a)
for i in range(q):
    b, c = map(int, input().split())
    if b in x:
        m = x[b]
        x.pop(b)
        if c in x:
            x[c] += m
        else:
            x[c] = m
    print(sum(i*j for i, j in x.items()))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
q = int(input())
from collections import Counter
x = Counter(a)
r = sum(a)
for i in range(q):
    b, c = map(int, input().split())
    m = 0
    if b in x:
        m = x[b]
        x.pop(b)
        if c in x:
            x[c] += m
        else:
            x[c] = m
    r += m*(c-b)
    print(r)
### BUGGY CODE ###

import sys
from collections import Counter

read = sys.stdin.read


def sieve_of_eratosthenes(n):
    sieve = [True] * n
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i]:
            sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
    return [2] + [i for i in range(3, n, 2) if sieve[i]]


def prime_factorize(n):
    a = []
    if n == 1:
        return [1]
    for i in primes:
        if n % i != 0:
            continue
        while n % i == 0:
            a.append(i)
            n //= i
        if n == 1:
            return a


N, *A = map(int, read().split())
mod = 10 ** 9 + 7

primes = sieve_of_eratosthenes(10 ** 6)
dic = {i: 0 for i in primes}

n = len(primes)
p = [0] * n
for i in A:
    if i == 1:
        continue
    tmp = Counter(prime_factorize(i))
    for key, value in tmp.items():
        # print(key, value)
        if dic[key] < value:
            dic[key] = value

lcm = 1
for i, j in dic.items():
    if j == 0:
        continue
    lcm *= pow(i, j, mod)
    lcm %= mod

answer = 0
for i in A:
    answer += lcm * pow(i, mod - 2, mod)
    answer %= mod

print(answer)


### FIXED CODE ###

import sys
from collections import Counter

read = sys.stdin.read


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


def sieve_of_eratosthenes(n):
    sieve = [True] * n
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i]:
            sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
    return [2] + [i for i in range(3, n, 2) if sieve[i]]


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


N, *A = map(int, read().split())
mod = 10 ** 9 + 7

primes = sieve_of_eratosthenes(max(A) + 1)
dic = {i: 0 for i in primes}

n = len(primes)
p = [0] * n
for i in A:
    tmp = Counter(prime_factorize(i))
    for key, value in tmp.items():
        #print(key, value)
        if dic[key] < value:
            dic[key] = value

lcm = 1
for i, j in dic.items():
    if j == 0:
        continue
    lcm *= pow(i, j, mod)
    lcm %= mod

answer = 0
for i in A:
    answer += lcm * pow(i, mod - 2, mod)
    answer %= mod

print(answer)
### BUGGY CODE ###

import sys
from collections import defaultdict

n, m = map(int, input().split())

pen_dic=defaultdict(lambda: 0)
ac=set()

for line in sys.stdin:
  p, s = line.split()
  if p in set(ac):
    continue

  if s == "AC":
    ac.add(p)
  else:
    pen_dic[p] += 1
print(len(set(ac)), sum(pen_dic[str(i)] for i in list(ac)))

### FIXED CODE ###

import sys
from collections import defaultdict

n, m = map(int, input().split())

wa=defaultdict(lambda: 0)
already=set()
ac = 0
for line in sys.stdin:
  p, s = line.split()
  p = int(p)
  if p in already:
    continue

  if s == "AC":
    ac+=1
    already.add(p)
  else:
    wa[p] += 1

print(ac, sum(wa[i] for i in already))
### BUGGY CODE ###

import math
N,M = list(map(int, input().split()))

X = {}
for i in range(2, M):
  if M == 1:
    break
  while True:
    if M % i == 0:
      if i in X:
        X[i] = X[i] + 1
      else:
        X[i] = 1
      M //= i
    else:
      break

def P(n,r):
  return math.factorial(n) // math.factorial(n-r)
def C(n,r):
  return P(n,r) // math.factorial(r)
       
sum = 1
for i in X.values():
  sum = (sum * C(i + N - 1, i) % 1000000007) % 1000000007
  
  
print(sum)

### FIXED CODE ###

import math
import copy

####################
def prime_decomposition(n):
  i = 2
  X = {}
  while i * i <= n:
    while n % i == 0:
      n /= i
      if i in X:
        X[i] = X[i] + 1
      else:
        X[i] = 1
    i += 1
  if n > 1:
    X[n] = 1
  return X

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n;

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p;
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result;

####################
  
N,M = list(map(int, input().split()))

X = prime_decomposition(M)
       
sum = 1
for i in X.values():
  sum = (sum * cmb(i + N - 1, i) % 1000000007) % 1000000007
  
print(sum)
### BUGGY CODE ###

import re
s=input()
m=0
s1 = re.compile(r'01|10')
l1 = re.compile(r'0000011111|1111100000|00001111|11110000|000111|111000')
for i in range(len(s)//2):
  dst = re.sub(s1, "", s)
  dst = re.sub(l1, "", dst)
  if dst == s:
    break
  m += len(s) - len(dst)
  s=dst
print(m)

### FIXED CODE ###

s=input();print(min(s.count("0"), s.count("1"))*2)
### BUGGY CODE ###

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

m = 60

A = list(map(int,input().split()))
A = [A[i]-1 for i in range(N)]

D = [A]
for i in range(m):
  temp = []
  for j in range(N):
    temp.append(D[i][D[i][j]])
  D.append(temp)

now = 0
for i in range(m):
  if K >> i&1 == 1:
    now = D[i][now]
print(now+1)

### FIXED CODE ###

N , K = map(int,input().split())
 
A = list(map(int,input().split()))
 
reach = [-1 for i in range(N)]
reach[0] = 0 #最初の町は0回でいく
now = 0
#loop = 1
dic ={}
dic[0] = 0
for i in range(N):
  to = A[now]-1
  if reach[to] != -1:
    ini = i+1
    #print(i,to,reach[to])
    loop = i+1 - reach[to]
    break
  if i+1 not in dic:
    dic[i+1] = to
  reach[to] = i+1
  #loop += 1
  now = to
 
 
#print(dic,reach,loop,ini)
if K < ini:
  print(dic[K]+1)
else:
  t = (ini-loop) + (K-ini)%loop
  print(dic[t]+1)
### BUGGY CODE ###

h,w,n=map(int,input().split())
ab=[list(map(int,input().split())) for _ in [0]*n]
ab_d={a*(10**10)+b for a,b in ab}

ans=[set() for _ in range(9)]
for a,b in ab:
    temp=[None for _ in [0]*25]
    for i in range(5):
        for j in range(5):
            if 0<a+i-2<=h and 0<b+j-2<=w:
                if (a+i-2)*(10**10)+b+j-2 in ab_d:
                    temp[i*5+j]=1
                else:
                    temp[i*5+j]=0
    for i in range(3):
        for j in range(3):
            cnt=[temp[(i+k)*5+j+l] for k in range(3) for l in range(3)]
            if None not in cnt:
                ans[sum(cnt)-1].add((a+i-2)*(10**10)+b+j-2)
                
for i in range(9):
    ans[i]=len(ans[i])

print((h-2)*(w-2)-sum(ans))
for i in ans:
    print(i)

### FIXED CODE ###

h,w,n=map(int,input().split())
ab=[list(map(int,input().split())) for _ in [0]*n]
ab_d={a*(10**9)+b-1 for a,b in ab}

ans=[set() for _ in range(9)]
for a,b in ab:
    temp=[None for _ in [0]*25]
    for i in range(5):
        for j in range(5):
            if 0<a+i-2<=h and 0<b+j-2<=w:
                if (a+i-2)*(10**9)+b+j-3 in ab_d:
                    temp[i*5+j]=1
                else:
                    temp[i*5+j]=0
    for i in range(3):
        for j in range(3):
            cnt=[temp[(i+k)*5+j+l] for k in range(3) for l in range(3)]
            if None not in cnt:
                ans[sum(cnt)-1].add((a+i-2)*(10**9)+b+j-3)
                
for i in range(9):
    ans[i]=len(ans[i])

print((h-2)*(w-2)-sum(ans))
for i in ans:
    print(i)
### BUGGY CODE ###

def countAC(s):
    index = []
    for i in range(N):
        if i == N-1:
            break
        if s[i] == 'A':
            if s[i+1] == 'C':
                index.append(1)
                continue
        index.append(0)
    return index

N,Q = (int(_) for _ in input().split())
S = input()
SIndex = countAC(S)
out = 0
for i in range(Q):
    l,r = (int(_) for _ in input().split())
    s = SIndex[l-1:r-1]
    for x in s:
        out += x
    print(out)
    out = 0


### FIXED CODE ###

def countAC(s):
    counter = 0
    index = [0]
    for i in range(1,N):
        if s[i-1] == 'A':
            if s[i] == 'C':
                counter += 1
                index.append(counter)
                continue
        index.append(counter)
    return index

N,Q = (int(_) for _ in input().split())
S = input()
SIndex = countAC(S)
out = 0
for i in range(Q):
    l,r = (int(_) for _ in input().split())
    print(SIndex[r-1] - SIndex[l-1])
### BUGGY CODE ###

H, N = map(int, input().split())
A_list = []
B_list = []
for i in range(N):
    A, B = map(int, input().split())
    A_list.append(A)
    B_list.append(B)

dp = [[10**8+1]*(H) for _ in range(N+1)] # DPテーブルの作成

for i in range(N):
    for j in range(H):
        if j < A_list[i]: # 選ばない時
            #dp[i+1][j] = dp[i][j]
            dp[i+1][j] = min(dp[i][j],B_list[i])
        else: # 選ぶ時
            dp[i+1][j] = min(dp[i][j],dp[i+1][j-A_list[i]]+B_list[i])
        #print(i,j,dp[i+1]) #debug

#print(dp[N])
print(dp[N][H-1])

### FIXED CODE ###

H, N = map(int, input().split())
A_list = []
B_list = []
for i in range(N):
    A, B = map(int, input().split())
    A_list.append(A)
    B_list.append(B)

dp = [[10**8+1]*(H) for _ in range(N+1)] # DPテーブルの作成

for i in range(N):
    for j in range(H):
        if j < A_list[i]: # 選ばない時
            #dp[i+1][j] = dp[i][j]
            dp[i+1][j] = min(dp[i][j],B_list[i])
        else: # 選ぶ時
            dp[i+1][j] = min(dp[i][j],dp[i+1][j-A_list[i]]+B_list[i])
        #print(i,j,dp[i+1]) #debug

#print(dp[N])
print(dp[N][H-1])
### BUGGY CODE ###

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

score = input().split()

result1 = 1
result2 = 1

for i in range(semester - K + 1) :
    if i == 0 :
        for j in range(K) :
            result1 = result1 * int(score[K - 1 - j])
        continue
    
    result2 = result1 // int(score[K - K + i - 1]) * int(score[K - 1 + i])
    

    if result1 < result2 :
        print("Yes")
    else :
        print("No")

    result1 = result2
    result2 = 1




### FIXED CODE ###

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

score = input().split()

for i in range(semester - K + 1) :
    if i == 0 :
        continue    

    if int(score[K - K + i - 1]) < int(score[K - 1 + i]) :
        print("Yes")
    else :
        print("No")
### BUGGY CODE ###

a=int(input())
l=list(map(int,input().split()))
l1=sorted(l)
for i in range(1,a+1):
    if i>l1[-1]:
        print("0")
    else:
        print(l.count(i))

### FIXED CODE ###

from collections import Counter
a=int(input())
l=list(map(int,input().split()))
d=Counter(l)
# print(d)
for i in range(1,a+1):
    if i in d:
        print(d[i])
    else:
        print("0")
### BUGGY CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
l=[]
for i in range(n):
  if i==0:
    l.append(0)
  else:
    m=10**9
    for j in range(1,min(k,i)+1):
      m=min(m,l[i-j]+abs(a[i]-a[i-j]))
    l.append(m)
print(l[-1])

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
l=[0]
for i in range(1,n):
  b=a[i]
  l.append(min(l[j]+abs(b-a[j])for j in range(i-min(k,i),i)))
print(l[-1])
### BUGGY CODE ###

# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**9)

N = int(input())
a_list=[]
b_list=[]

for i in range(N-1):
    a,b = map(int,input().split())
    a_list.append(a)
    b_list.append(b)

graph = [[] for i in range(N)]
for i in range(N-1):
    graph[a_list[i]-1].append((b_list[i],i))
    graph[b_list[i]-1].append((a_list[i],i))
    
ans = [0 for i in range(N-1)]
ten_col = [[] for i in range(N)]
def dfs(start,now):
    for (future,i) in graph[now-1]:
        if future == start:
            pass
        else:
            new_col = 1
            while True:
                if new_col not in ten_col[now-1]:
                    ten_col[now-1].append(new_col)
                    ten_col[future-1].append(new_col)
                    ans[i] = new_col
                    break
                else:
                    new_col += 1
            dfs(now,future)
            
dfs(-1,1)
print(max(ans))
for i in ans:
    print(i)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

N = int(input())

graph = [[] for i in range(N)]

for i in range(N-1):
    a,b = map(int,input().split())
    graph[a-1].append((b,i))
    graph[b-1].append((a,i))
    
ans = [0]*(N-1)

def dfs(past,now,edge_col):
    new_col = 1
    for (future,i) in graph[now-1]:
        if future == past:
            pass
        else:
            if new_col == edge_col:
                new_col += 1
            ans[i] = new_col
            dfs(now,future,new_col)
            new_col += 1
            
dfs(-1,1,-1)

print(max(ans))
for i in ans:
    print(i)
### BUGGY CODE ###

s = input()
k = int(input())
substrings = []
index = []
for ss in sorted(list(set(s))):
  index_list = [n for n, v in enumerate(s) if v == ss]
  index.append(index_list)
  if len(index) >= k:
    break

for ind in index:
  for i in ind:##初期位置
    for j in range(1,len(s)-i+1):##長さ
      substrings.append(s[i:i+j])
  if len(set(substrings)) >= k:
    break

print(sorted(list(set(substrings)))[k-1])

### FIXED CODE ###

s = input()
k = int(input())
substrings = []
index = []
for ss in sorted(list(set(s))):
  index_list = [n for n, v in enumerate(s) if v == ss]
  for i in index_list:##初期位置
    for j in range(1,min(k+1,len(s)-i+1)):##長さ
      substrings.append(s[i:i+j])
  if len(set(substrings)) >= k:
    break
print(sorted(list(set(substrings)))[k-1])