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

N = int(input())
A = [input() for i in range(N)]
M = 10465270
T = [0 for i in range(M)]

def convert_str_to_int(s):
    if s == "A":
        return 1
    elif s == "C":
        return 2
    elif s == "G":
        return 3
    elif s == "T":
        return 4
    else:
        return 0

def get_key(value: str) -> int:
    converted_value = ""
    for s in value:
        i = convert_str_to_int(s)
        converted_value += str(i)
    return int(converted_value)

def h1(key: int) -> int:
    return key % M

def h2(key: int) -> int:
    move_value = 1 + (key % (M-1))
    return move_value

def h(key:int, i:int) -> int:
    hash_value = (h1(key) + i+h2(key)) % M
    return hash_value

def find(key: int) -> bool:
    i = 0
    while True:
        j = h(key, i)
        if T[j] == key:
            return True
        elif T[j] == 0 or i >= M:
            return False
        else:
            i += 1


def insert(key: int) -> None:
    i = 0
    while True:
        j = h(key, i)
        if T[j] == 0:
            T[j] = key
            return
        else:
            i += 1


for row in A:
    order, value = row.split()
    key = get_key(value)
    if order[0] == "i":
        insert(key)
    else:
        if find(key):
            print("yes")
        else:
            print("no")


### FIXED CODE ###

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

D = {}
for row in A:
    order, key = row.split()
    if order[0] == "i":
        D[key] = 1
    else:
        if key in D.keys():
            print("yes")
        else:
            print("no")
### BUGGY CODE ###

r,g,b,n=map(int,input().split())

lst=[r,g,b]
lst.sort()
r=lst[2]
g=lst[1]
b=lst[0]

rlim=n//r

blim=n//b

blist=[]
for i in range(blim+1):
    blist.append(i*b)


cnt=0
for i in range(rlim+1):
    glim=(n-i*r)//g
    for j in range(glim+1):
        rlim=(n-i*r-j*g)//b
        for k in range(rlim+1):
            if i*r+j*g+k*b==n:
                cnt+=1
print(cnt)

### FIXED CODE ###

r,g,b,n=map(int,input().split())

lst=[r,g,b]
lst.sort()
r=lst[2]
g=lst[1]
b=lst[0]

rlim=n//r
glim=n//g
blim=n//b

"""
blist = [i*b for i in range(blim+1)]

glist = [i*g for i in range(glim+1)]

def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1
    return False
"""

cnt=0

for i in range(rlim+1):
    glim=(n-i*r)//g
    for j in range(glim+1):
        if (n-i*r-j*g)%b==0:
            cnt+=1
print(cnt)
### BUGGY CODE ###

from collections import defaultdict
N = int(input())
X = list(input())
d = defaultdict(int)

for i in range(1, N):
    c = 0
    t = 0
    k = format(i, "b")
    for j in k:
        if j == "1":
            c += 1
    d[i] = d[i%c] + 1


n = 0
for i in X:
    if i == "1":
        n += 1

p = 1
total1 = 0
total2 = 0
for i in X[::-1]:
    if i == "1":
        total1 += p % (n+1)
        if n-1 > 0:
            total2 += p % (n-1)
    p *= 2

total1 %= (n+1)
if n-1 > 0:
    total2 %= (n-1)
Ans = []
p = 1
for i in X[::-1]:
    c = 1
    if n - 1 <= 0 and i == "1":
        Ans.append(0)
    else:
        if i == "0":
            start = total1
            start += p % (n+1)
            start %= (n+1)
        else:
            start = total2
            start -= p % (n-1)
            start += n - 1
            start %= (n-1)
        Ans.append(c+d[start])
    p *= 2

for i in Ans[::-1]:
    print(i)

### FIXED CODE ###

from collections import defaultdict
N = int(input())
X = list(input())
d = defaultdict(int)

for i in range(1, N):
    c = 0
    t = 0
    k = format(i, "b")
    for j in k:
        if j == "1":
            c += 1
    d[i] = d[i%c] + 1


n = 0
for i in X:
    if i == "1":
        n += 1

p1 = 1
p2 = 1
total1 = 0
total2 = 0
for i in X[::-1]:
    if i == "1":
        total1 += p1 % (n+1)
        if n-1 > 0:
            total2 += p2 % (n-1)
    p1 *= 2
    p1 %= n+1
    if n-1 > 0:
        p2 *= 2
        p2 %= n-1

total1 %= (n+1)
if n-1 > 0:
    total2 %= (n-1)
Ans = []
p1 = 1
p2 = 1
for i in X[::-1]:
    c = 1
    if n - 1 <= 0 and i == "1":
        Ans.append(0)
    else:
        if i == "0":
            start = total1
            start += p1
            start %= (n+1)
        else:
            start = total2
            start -= p2
            start += n - 1
            start %= (n-1)
        Ans.append(c+d[start])
    p1 *= 2
    p1 %= n+1
    if n-1 > 0:
        p2 *= 2
        p2 %= n-1

for i in Ans[::-1]:
    print(i)
### BUGGY CODE ###

x=int(input())
a=0
b=0
t=0
while a**5<x:
    while b**5<x:
        if a**+b**5==x:
            print(a,-b)
            t=1
            break
        if -a**5-b**5==x:
            print(-a,b)
            t=1
            break
    if t==0:
        break

### FIXED CODE ###

x=int(input())
ma=200
for i in range(ma):
    for j in range(-ma,ma):
        if (i**5 - j**5) ==x:
            print(i,j)
            exit()
### BUGGY CODE ###

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

o = []
for i in range(n):
    if i % 2:
        o.insert(0,a[i])
    else:
        o.append(a[i])

print(' '.join(map(str,o[::-1] if n%2 else o)))

### FIXED CODE ###

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

o = [0] * n
c = n//2
r = c
l = c - 1
for i in range(n):
    if i % 2:
        o[l] = a[i]
        l -= 1
    else:
        o[r] = a[i]
        r += 1

if n % 2:
    for i in range(n):
        if i:
            print(' ',end='')
        print(o[n-1-i],end='')
else:
    for i in range(n):
        if i:
            print(' ',end='')
        print(o[i],end='')
### BUGGY CODE ###

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

ans = '-1 -1 -1'
#for i in range(N+1):
#    for j in range(N+1 -i):
#        for k in range(N+1 -i -j):
#            if (i*10000 + j*5000 + k*1000) == Y:
#                ans = '{} {} {}'.format(i, j, k)
#                break

count_max = Y / 1000  # all 1000
ans_list = []


for i in range(Y // 10000 + 1):
    count_tmp1 = count_max - 9 * i
    price_tmp1 = Y - 10000 * i
    if count_tmp1 < 0 or price_tmp1 < 0:
        break

    if count_tmp1 == N:
        ans = '{} {} {}'.format(i, 0, N - i)
        ans_list.append(ans)
        break

    if count_tmp1 == 0 or price_tmp1 == 0:
        break

    is_continue = True
    for j in range(price_tmp1 // 5000 + 1):
        count_tmp2 = count_tmp1 - 4 * j
        price_tmp2 = price_tmp1 - 5000 * j
        if count_tmp1 < 0 or price_tmp1 < 0:
            break
        if count_tmp2 == N:
            ans = '{} {} {}'.format(i, j, N - i -j)
            ans_list.append(ans)
            is_continue = False
            break
        if count_tmp2 == 0 or price_tmp2 == 0:
            break
    if not is_continue:
        break
print(ans)
#print(ans_list)

### FIXED CODE ###

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

count_max = Y / 1000  # all 1000

ans = '-1 -1 -1'
for i in range(N+1):  # 10000
    for j in range(N+1 - i):  # 5000
        k = N - i - j
        if k < 0:
            continue
        total = 10000 * i + 5000 * j + 1000 * k
        if total == Y:
            ans = '{} {} {}'.format(i, j, k)
            break
print(ans)
### BUGGY CODE ###

X = input()

len_prev = -1
while len_prev != len(X):
    len_prev = len(X)
    X = X.replace('ST', '')
print(len(X))


### FIXED CODE ###

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

x = input()
n = len(x)

s, t = 0, 0
cnt = 0
for i in range(n):
    if x[i] == 'T':
        if s > 0:
            s -= 1
            cnt += 2
    elif x[i] == 'S':
        s += 1

# i = 0
# s = 0
# t = 0
# cnt = 0
# while i < n:
#     while i < n and x[i] == 'T':
#         i += 1
#         t += 1
#     tmp = min(t, s)
#     cnt += tmp * 2
#     if t - tmp == 0:
#         s -= tmp
#     else:
#         s = 0
#         t = 0

#     while i < n and x[i] == 'S':
#         i += 1
#         s += 1
print(n - cnt)
### BUGGY CODE ###

n = int(input())
stmp = list(input())
Q = int(input())
target = ord("a")
s = [ord(stmp[i])-target for i in range(n)]

class BIT:
	"""
	<Attention> 0-indexed.
	query ... return the sum [0 to m]
	sum ... return the sum [a to b]
	sumall ... return the sum [all]
	add ... 'add' number to element (be careful that it doesn't set a value.)
	search ... the sum version of bisect.right
	output ... return the n-th element
	listout ... return the BIT list
	"""
	
	def query(self, m):
		res = 0
		while m > 0:
			res += self.bit[m]
			m -= m&(-m)
		return res
	
	def sum(self, a, b):
		return self.query(b)-self.query(a)
	
	def sumall(self):
		bitlen = self.bitlen-1
		return self.query(bitlen)
	
	def add(self, m, x):
		m += 1
		bitlen = len(self.bit)
		while m <= bitlen-1:
			self.bit[m] += x
			m += m&(-m)
		return
	
	def __init__(self, a):
		self.bitlen = len(a)+1
		self.bit = [0]*(len(a)+1)
		for i, j in enumerate(a):
			self.add(i, j)

b = [BIT([0 for _ in range(n)]) for i in range(26)]
for i in range(n):
	b[s[i]].add(i, 1)

for _ in range(Q):
	q,qtmpa,qtmpb = input().split()
	if q[0] == "1":
		qa = int(qtmpa)
		t = ord(qtmpb)-target
		b[t].add(qa-1, 1)
		b[s[qa-1]].add(qa-1, -1)
		s[qa-1] = t
	else:
		ans = 0
		qta = int(qtmpa)
		qtb = int(qtmpb)
		for i in range(26):
			if b[i].sum(qta-1, qtb) != 0:
				ans += 1
		print(ans)


### FIXED CODE ###

n = int(input())
stmp = list(input())
Q = int(input())
target = ord("a")
s = [ord(stmp[i])-target for i in range(n)]

class BIT:
	"""
	<Attention> 0-indexed.
	query ... return the sum [0 to m]
	sum ... return the sum [a to b]
	sumall ... return the sum [all]
	add ... 'add' number to element (be careful that it doesn't set a value.)
	search ... the sum version of bisect.right
	output ... return the n-th element
	listout ... return the BIT list
	"""
	
	def query(self, m):
		res = 0
		while m > 0:
			res += self.bit[m]
			m -= m&(-m)
		return res
	
	def sum(self, a, b):
		return self.query(b)-self.query(a)
	
	def sumall(self):
		bitlen = self.bitlen-1
		return self.query(bitlen)
	
	def add(self, m, x):
		m += 1
		bitlen = len(self.bit)
		while m <= bitlen-1:
			self.bit[m] += x
			m += m&(-m)
		return
	
	def __init__(self, n):
		self.bitlen = n+1
		self.bit = [0]*(n+1)

b = [BIT(n) for i in range(26)]
for i in range(n):
	b[s[i]].add(i, 1)

for _ in range(Q):
	q,qtmpa,qtmpb = input().split()
	if q[0] == "1":
		qa = int(qtmpa)
		t = ord(qtmpb)-target
		b[t].add(qa-1, 1)
		b[s[qa-1]].add(qa-1, -1)
		s[qa-1] = t
	else:
		ans = 0
		qta = int(qtmpa)
		qtb = int(qtmpb)
		for i in range(26):
			if b[i].sum(qta-1, qtb) != 0:
				ans += 1
		print(ans)
### BUGGY CODE ###

n = int(input())
point = []
for _ in range(n):
    point.append((tuple(map(int, input().split()))))
point = set(point)
max_d = 0
for p in point:
    for q in point:
        d = abs(p[0] - q[0]) + abs(p[1] - q[1])
        if d > max_d:
            max_d = d
print(max_d)

### FIXED CODE ###

n = int(input())
point = []
for _ in range(n):
    point.append((tuple(map(int, input().split()))))
point = list(set(point))
point = sorted(point)
if len(point) == 1: print(0)
else:  
    d1 = max([(x+y) for x,y in point])- min([(x+y) for x,y in point])
    d2 = max([(x-y) for x,y in point]) - min([(x-y) for x,y in point])
    print(max(d1,d2))
### BUGGY CODE ###

import sys
from collections import deque, Counter, defaultdict
from fractions import gcd

input = sys.stdin.readline  


def main():
    n, w = map(int, input().split())
    WVs = [list(map(int, input().split())) for i in range(n)]
    #i個目の品物を取る場合
    dp = [[0]*(w+1) for _ in range (n)]
    dp[0] = [0]*(w+1)

    for i in range(n):
        for j in range(w+1):
            wi = WVs[i][0]
            vi = WVs[i][1]

            if j - wi >= 0:
                dp[i][j] = max([dp[i-1][j-wi] + vi, dp[i-1][j]])
            else:
                dp[i][j] = dp[i-1][j] 

    print(dp[n-1][w]) 
    return

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from collections import deque, Counter, defaultdict
from fractions import gcd

input = sys.stdin.readline  


def main():
    n, w = map(int, input().split())
    WVs = [list(map(int, input().split())) for i in range(n)]
    #i個目の品物を取る場合
    dp = [[0]*(w+1) for _ in range (n)]
    dp[0] = [0]*(w+1)

    for i in range(n):
        for j in range(w+1):
            wi = WVs[i][0]
            vi = WVs[i][1]

            if j - wi >= 0:
                dp[i][j] = max([dp[i-1][j-wi] + vi, dp[i-1][j]])
            else:
                dp[i][j] = dp[i-1][j] 

    print(dp[n-1][w]) 
    return

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

import queue
import itertools

def bfs(top_dict, first, end):
    q = queue.Queue()
    visited = []
    
    dist = {}
    for i in range(1, end+1):
        dist[i] = 0 
    q.put(first)
    
    while not q.empty():
        label = q.get(0)
        if label not in visited:
            visited.append(label)
            for i in top_dict[label]:
                if dist[i] != 0 or i== first:
                    continue
                dist[i] =  dist[label] +1
                q.put(i)
    return dist  

N, X, Y= map(int, input().split(' '))

top_dict = {}
for i in range(1, N+1):
    if i == N:
        top_dict[i] = [i-1]
    elif i==1:
        top_dict[i] = [i+1]
    else:
        top_dict[i] = [i-1, i+1]


top_dict[X].append(Y)
top_dict[Y].append(X)
res = list(itertools.chain(*[bfs(top_dict, i, N).values() for i in range(1, N+1)]))

for i in range(1, N):
    print(res.count(i)//2)

### FIXED CODE ###

N, X, Y= map(int, input().split(' '))
 
array=[None]*N
for i in range(N):
    array[i]=0
    
for k in range(1, N+1):
    for v in range(k, N+1):
       array[min([abs(k-v), abs(X-k)+abs(v-Y)+1, abs(Y-k)+abs(X-v)+1])] += 1 

for i in range(1, N):
    print(array[i])
### BUGGY CODE ###

n,m=list(map(int,input().split(" ")))
al=[0 for i in range(n)]
bl=[0 for i in range(n)]
for i in range(n):
    al[i],bl[i]=tuple(map(int,input().split(" ")))
have=0
yen=0
while have<m:
    k=al.index(min(al))
    pri=al.pop(k)
    num=bl.pop(k)
    have+=num
    yen+=pri*num
if have>m:
    yen-=(have-m)*pri
print(yen)

### FIXED CODE ###

n,m=list(map(int,input().split(" ")))
l=[]
l=[list(map(int,input().split(" "))) for i in range(n)]
have=0
yen=0
i=0
l.sort(key=lambda x: x[0])
while have<m:
    pri=l[i][0]
    num=l[i][1]
    i+=1
    have+=num
    yen+=pri*num
if have>m:
    yen-=(have-m)*pri
print(yen)
### BUGGY CODE ###

import math
N = int(input())
count = 0
flag = False
# n = int(math.sqrt(N))
n = N // 5

for i in range(1, N + 1):
    
    for j in range(1, n):
        for l in range(1, n):
            for r in range(1, n):
                if (j + l + r) * 2 > N:
                    continue
                if j ** 2 + l ** 2 + r ** 2 + j * l + j * r + l * r == i:
                    if j == l == r:
                        flag = True
                        count = 1
                        break
                    else:
                        flag = True
                        count = 3
                        break
            if flag:
                break
        if flag:
            break            
    print(count)
    count = 0
    flag = False

### FIXED CODE ###

# # import math
N = int(input())
# # count = 0
# # flag = False
# # # n = int(math.sqrt(N))
n = 105

# # for i in range(1, N + 1):
    
# #     for j in range(1, n):
# #         for l in range(1, n):
# #             for r in range(1, n):
# #                 if j + l + r > N // 2:
# #                     continue
# #                 if j ** 2 + l ** 2 + r ** 2 + j * l + j * r + l * r == i:
# #                     if j == l == r:
# #                         flag = True
# #                         count = 1
# #                         break
# #                     else:
# #                         flag = True
# #                         count = 3
# #                         break
# #             if flag:
# #                 break
# #         if flag:
# #             break            
# #     print(count)
# #     count = 0
# #     flag = False
ans = [0] * 10050
for j in range(1, n):
    for l in range(1, n):
        for r in range(1, n):
            value = j * j  + l * l + r * r + j * l + j * r + l * r
            if value < 10050:
                ans[value] += 1

for i in range(N):
    print(ans[i + 1])
# n = int(input())
# ans = [0 for _ in range(10050)]
# for i in range(1,105):
#     for j in range(1,105):
#         for k in range(1,105):
#             v = i*i+j*j+k*k+i*j+j*k+k*i;
#             if v<10050:
#                 ans[v]+=1   
# for i in range(n):
#     print(ans[i+1])
### BUGGY CODE ###

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

def calc(k):
    d = 0
    m = 0
    c = 0
    M = 0
    for s in S[:k]:
        if s == 'D':
            d += 1
        elif s == 'M':
            m += d
            M += 1
        elif s == 'C':
            c += m
    # print (d, m, c)
    for index, x in enumerate(S[k:]):
        if S[index] == 'D':
            m -= M
            d -= 1
        elif S[index] == 'M':
            M -= 1

        if x == 'D':
            d += 1
        elif x == 'M':
            m += d
            M += 1
        elif x == 'C':
            c += m            
        # print (d, m, c)
            
    return c

for k in K:
    print (calc(k))

# print (calc(5))

### FIXED CODE ###

def main():
    N = int(input())
    S = list(input())
    Q = int(input())
    K = tuple(map(int, input().split()))
    d_list = [0] * N
    m_list = [0] * N
    c_list = [0] * N
    M_list = [0] * N
    for index, s in enumerate(S):
        if s == 'D':
            d_list[index] += 1
        elif s == 'M':
            m_list[index] += d_list[index - 1]
            M_list[index] += 1
        elif s == 'C':
            c_list[index] += m_list[index - 1]
        d_list[index] += d_list[index - 1]
        m_list[index] += m_list[index - 1]
        c_list[index] += c_list[index - 1]
        M_list[index] += M_list[index - 1]



    for k in K:
        d = d_list[k - 1]
        m = m_list[k - 1]
        c = c_list[k - 1]
        M = M_list[k - 1]

        for index, x in enumerate(S[k:]):
            if S[index] == 'D':
                m -= M
                d -= 1
            elif S[index] == 'M':
                M -= 1

            if x == 'D':
                d += 1
            elif x == 'M':
                m += d
                M += 1
            elif x == 'C':
                c += m            
        print (c)                


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

N = int(input())
S = [list(input()) for i in range(N)]
for i in range(N):
    Si = S[i]
    Si.sort()
    S[i] = Si
ans = 0
for i in range(N-1):
    Si = S[i]
    for j in range(i+1,N):
        Sj = S[j]
        if Si == Sj:
            ans += 1
print(ans)

### FIXED CODE ###

import collections
N = int(input())
S = [list(input()) for i in range(N)]

for i in range(N):
    Si = S[i]
    Si.sort()
    Si2 = ''.join(Si)
    S[i] = Si2

ans = 0
Sc = collections.Counter(S).most_common()
for s in Sc:
    ans += s[1]*(s[1]-1)//2

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

n = int(input())
s = [input() for i in range(n)]
s = sorted(s)

s_cnt = [0]*n
for i in range(n):
  s_cnt[s.index(s[i])] += 1

s_cnt_max = max(s_cnt)
for i in range(n):
  if (s_cnt[i] == s_cnt_max):
  	print(s[i])

### FIXED CODE ###

from collections import Counter

n = int(input())
s = [input() for i in range(n)]
s = Counter(s)
s = s.most_common()

# ansの初期化
ans = []
ans.append(s[0][0])
cnt = s[0][1]

if (len(s) != 1):
  for i in range(1, n):
    if (s[i][1] < cnt):
      break
    else:
      ans.append(s[i][0])

for s in sorted(ans):
  print(s)
### BUGGY CODE ###

import math
n = int(input())
p = list(map(int,input().split()))


cnt = 0

for i in range(n):
    now_list = p[0:i+1]
    Pi = p[i]
    Pj = min(now_list)
    #print(now_list,Pi,Pj)
    if Pi > Pj:
        cnt += 1
print(n-cnt)


     

### FIXED CODE ###

import math
n = int(input())
p = list(map(int,input().split()))

temp = 11111111111111111
cnt = 0
for i in p:
    temp = min(temp,i)
    if temp >= i:
        cnt += 1
print(cnt)
### BUGGY CODE ###

from collections import deque
N = int(input())
G = {i:[] for i in range(1,N+1)}
E = {}
A = []
for _ in range(N-1):
    a,b = map(int,input().split())
    A.append((a,b))
    G[a].append(b)
    G[b].append(a)
    E[(a,b)] = 0
hist = [0 for _ in range(N+1)]
heap = deque([1])
c = 1
for y in G[1]:
    E[(1,y)]=c
    c += 1
K = c-1
hist[1]=1
while heap:
    x = heap.popleft()
    for y in G[x]:
        if hist[y]==0:
            K = max(K,len(G[y]))
            col = [0 for _ in range(K+1)]
            for z in G[y]:
                if y<z:
                    col[E[(y,z)]]=1
                else:
                    col[E[(z,y)]]=1
            cur = 1
            for z in G[y]:
                if y<z and E[(y,z)]==0:
                    for i in range(cur,K+1):
                        if col[i]==0:
                            E[(y,z)]=i
                            col[i]=1
                            cur = i+1
                            break
                elif z<y and E[(z,y)]==0:
                    for i in range(cur,K+1):
                        if col[i]==0:
                            E[(z,y)]=i
                            col[i]=1
                            cur = i+1
                            break
            heap.append(y)
            hist[y]=1
print(K)
for e in A:
    print(E[e])

### FIXED CODE ###

from collections import deque         
N = int(input())
G = {}
E = {}
E1 = []
for _ in range(N-1):
    a,b = map(int,input().split())
    if a not in G:
        G[a] = []
    G[a].append(b)
    if b not in G:
        G[b] = []
    G[b].append(a)
    E[(a,b)] = 0
    E[(b,a)] = 0
    E1.append((a,b))
col = 0
for x in G:
    col = max(col,len(G[x]))
hist = [0 for _ in range(N+1)]
heap = deque([(1,0)])
while heap:
    x = heap.popleft()
    hist[x[0]] = 1
    if x[1]!=0:
        c = E[(x[0],x[1])]
    else:
        c = 0
    for y in G[x[0]]:
        if hist[y]==0:
            c = c%col+1
            E[(x[0],y)] = c
            E[(y,x[0])] = c
            heap.append((y,x[0]))
print(col)
for i in range(N-1):
    print(E[E1[i]])
### BUGGY CODE ###

[N, K] = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

S = 1
i = 0
p = A[i]
i += 1

for s in A[:K]:
  S *= s 

for s in A[K:]:
  _S = S
  S = (S // p) * s
  p = A[i]
  i += 1
  if _S < S:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

[N, K] = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

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

import collections as coll
n,m=map(int,input().split())
py=[list(map(int,input().split())) for _ in range(m)]
a=coll.defaultdict(list)
for x,y in sorted(py): a[x].append(y)
for x,y in py:
    z=a[x].index(y)+1
    print('%06d%06d'%(x,z))

### FIXED CODE ###

import collections as coll
import bisect
n,m=map(int,input().split())
py=[list(map(int,input().split())) for _ in range(m)]
a=coll.defaultdict(list)
for x,y in sorted(py): a[x].append(y)
for x,y in py:
    z=bisect.bisect(a[x],y)
    print('%06d%06d'%(x,z))
### BUGGY 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

N = int(input())
facts = prime_factorize(N)
ans = float('inf')
for i in range(2**len(facts)):
  x1 = 1
  for idx1, flag in enumerate(bin(i)[2:]):
    if flag == '0':
      x1 *= facts[idx1]
  ans = min(ans, x1+N//x1-2)
print(ans)


### FIXED CODE ###

def make_divisors(n):
    ans = float('inf')
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ans = min(ans, i+N//i-2)
            if i != n // i:
                ans = min(ans, n//i+N//(n//i)-2)

    return ans

N = int(input())
print(make_divisors(N))
### BUGGY CODE ###

import itertools

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

ans = set(itertools.combinations(S, 3))
print(len(ans))

### FIXED CODE ###

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

cnt = 0
for i in range(1000):
    key = str(i).zfill(3)
    ki = 0
    for j in range(N):
        if key[ki] == S[j]: ki += 1
        if ki == 3:
            cnt += 1
            break

print(cnt)