Harryxun/stf_run huggingface dataset:
import heapq, bisect
n = int(input())
s = list(input())
alp = 'abcdefghijklmnopqrstuvwxyz'
cnt = {c: set() for c in alp}

for i in range(n):
    cnt[s[i]].add(i)

q = int(input())
for _ in range(q):
    t, x, y = input().split()
    ans = 0
    if t == '1':
        i, c = int(x) - 1, y
        cnt[s[i]].remove(i)
        cnt[c].add(i)
    else:
        l, r = int(x) - 1, int(y) - 1
        for c in alp:
            sort_cnt = sorted(cnt[c])
            a = bisect.bisect_left(sort_cnt, l)
            if a < len(cnt[c]) and sort_cnt[a] <= r:
                ans += 1
        print(ans)

### FIXED CODE ###

import bisect
n = int(input())
s = list(input())
alp = 'abcdefghijklmnopqrstuvwxyz'
cnt = {c: [] for c in alp}

for i, c in enumerate(s):
    cnt[c].append(i)

q = int(input())
for _ in range(q):
    t, x, y = input().split()
    ans = 0
    if t == '1':
        i, c = int(x) - 1, y
        if s[i] == c:
            continue
        a = bisect.bisect_left(cnt[s[i]], i)
        cnt[s[i]].pop(a)
        s[i] = c
        b = bisect.bisect_left(cnt[c], i)
        cnt[c].insert(b, i)
    else:
        l, r = int(x) - 1, int(y) - 1
        for c in alp:
            a = bisect.bisect_left(cnt[c], l)
            if a < len(cnt[c]) and cnt[c][a] <= r:
                ans += 1

        print(ans)
def gcd(a, b):
    if b == 1:
        return 1
    # a > b　を仮定
    r = a % b
    if r == 0:
        return b
    else:
        return gcd(b, r)

def lcm(A, n):
    if n == 2:
        return A[0]* (A[1] // gcd(A[0], A[1]))
    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
    a = lcm(A, n-1)
    return a* (A[n-1] // gcd(a, A[n-1]))

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a.sort(reverse = True)
ans = lcm(a, n)
print(str(ans))

### FIXED CODE ###

def gcd(a, b):
    if b == 1:
        return 1
    # a > b　を仮定
    r = a % b
    if r == 0:
        return b
    else:
        return gcd(b, r)

#def lcm(A, n):
#    if n == 2:
#        return A[0]*A[1] // gcd(A[0], A[1])
#    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
#    a = lcm(A, n-1)
#    return a* A[n-1] // gcd(a, A[n-1])

n = int(input())
#a = []
T1 = int(input())
for i in range(n-1):
    T2 = int(input())
    T1 = T1*T2 // gcd(T1, T2)
    #a.append(int(input()))
#a.sort(reverse = True)
#ans = lcm(a, n)
print(str(T1))
N,Q=map(int,input().split())
S=input()
l=list(S)
n=[0]*(N-1)
for i in range(N-1):
    if l[i]=='A':
        if l[i+1]=='C':
            n[i]=1
for i in range(Q):
    l,r=map(int,input().split())
    print(sum(n[l-1:r-1]))

### FIXED CODE ###

base = ['A', 'T', 'A', 'C', 'G', 'C']
str = input()
print(base[base.index(str) + 1])
S=input()
T=input()
length=len(T)
for i in range(0,len(S)-len(T)+1):
	if S[i,i+length]==T:
		print(0)

### FIXED CODE ###

S=input()
T=input()
result=len(T)
for s in range(0,len(S)-len(T)+1):
	diff=0
	for i in range(0,len(T)):
		if T[i]!=S[s+i]:
			diff+=1
	result=min(result,diff)

print(result)
number = int(input())
if number * 2 == 0:
	odd_num = number // 2
	percent = odd_num / number
    print(percent)
else:
	odd_num = number // 2 + 1
    percent = odd_num / number
	print(percent)  


### FIXED CODE ###

number = int(input())
if number % 2 == 0:
	odd_num = number // 2
	percent = odd_num / number
else:
	odd_num = number // 2 + 1
	percent = odd_num / number

print(percent)
max = 0
cnt = 0
N = int(input())
for _ in range(N):
	p = int(input())
	if max < p:
		max = p
		cnt += 1
print(cnt)

### FIXED CODE ###

min = 10000000
cnt = 0
N = int(input())
P = list(map(int, input().split()))

for i in range(N):
	p = P[i]
	if min >= p:
		min = p
		cnt += 1
print(cnt)
import itertools


def main():
    n, m, q = map(int, input().split())

    A, B, C, D = [], [], [], []
    for _ in range(q):
        a, b, c, d = map(int, input().split())
        A.append(a)
        B.append(b)
        C.append(c)
        D.append(d)
    ans = 0
    length = m+n-1
    for item in itertools.combinations(range(length), m-1):
        ptn = []
        num = 1
        p = 0
        for i in range(length):
            if i == item[p]:
                num += 1
                p += 1
                p = min(m-2, p)
                continue
            ptn.append(num)
        tmp = 0
        for k in range(q):
            if (ptn[B[k]-1] - ptn[A[k]-1]) == C[k]:
                tmp += D[k]

        ans = max(tmp, ans)
    return ans

print(main())


### FIXED CODE ###

import itertools


def main():
    n, m, q = map(int, input().split())

    A, B, C, D = [], [], [], []
    for _ in range(q):
        a, b, c, d = map(int, input().split())
        A.append(a)
        B.append(b)
        C.append(c)
        D.append(d)
    if m == 1:
        return sum(D)
    ans = 0
    length = m+n-1
    for item in itertools.combinations(range(length), m-1):
        ptn = []
        num = 1
        p = 0
        for i in range(length):
            if i == item[p]:
                num += 1
                p += 1
                p = min(m-2, p)
                continue
            ptn.append(num)
        tmp = 0
        for k in range(q):
            if (ptn[B[k]-1] - ptn[A[k]-1]) == C[k]:
                tmp += D[k]

        ans = max(tmp, ans)
    return ans

print(main())
w, h, n = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(n)]
 
x1 = 0
x2 = w
y1 = 0
y2 = h
for i in range(n):
    if a[i][2] == 1:
        x1 = max(x1, a[i][0])
    elif a[i][2] == 2:
        x2 = min(x2, a[i][0])
    elif a[i][2] == 3:
        y1 = max(y1,a[i][1])
	elif a[i][2] == 4:
        y2 = min(y2, a[i][1])
print(max(0,(x2-x1)*(y2-y1)))

### FIXED CODE ###

w, h, n = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(n)]
 
x1 = 0
x2 = w
y1 = 0
y2 = h
for i in range(n):
	if a[i][2] == 1:
		x1 = max(x1, a[i][0])
	elif a[i][2] == 2:
		x2 = min(x2, a[i][0])
	elif a[i][2] == 3:
		y1 = max(y1,a[i][1])
	elif a[i][2] == 4:
		y2 = min(y2, a[i][1])

if (x2-x1) < 0 or (y2-y1) < 0:
	print(0)
else:
	print((x2-x1)*(y2-y1))
n = int(input())
p = list(map(int, input().split()))

import numpy
p = np.array(p)
cnt = 0
for i in range(1, n-1):
    pi = np.array(p[i-1:i +2])
    #print(pi)
    if np.argsort(pi)[1] == 1:
        cnt += 1
print(cnt)

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
import numpy as np
p = np.array(p)
cnt = 0
for i in range(1, n-1):
    pi = np.array(p[i-1:i+2])
    #print(pi)
    if np.argsort(pi)[1] == 1:
        cnt += 1
print(cnt)
def isDivBy9(n): 
  
    # Base cases 
    if (n == 0 or n == 9): 
        return True
    if (n < 9): 
        return False
   
    # If n is greater than 9, 
    # then recur for [floor(n / 9) - n % 8] 
    return isDivBy9((int)(n>>3) - (int)(n&7)) 
  



if __name__ == "__main__":
    N = int(input())

    if(isDivBy9(N)):
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

def check(st) : 
  
    # Compute sum of digits 
    n = len(st) 
    digitSum = 0
      
    for i in range(0,n) : 
        digitSum = digitSum + (int)(st[i]) 
  
    # Check if sum of digits 
    # is divisible by 9. 
    return (digitSum % 9 == 0) 
  
# Driver code 
x = input()
st= str(x)
  
if(check(st)) : 
    print("Yes") 
else :  
    print("No")
a,b,c,d=input()
count=0

if(a==b or a==c or a==d):
    count+=1

if(b==c or b==d or c==d):
    if(b!=a and c!=a and d!=a)
    count+=1

if(count==2):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a,b,c,d=input()
count=0

if(a==b):
    count+=1
    if(c==d and a!=c):
        count+=1
elif(a==c):
    count+=1
    if(b==d and a!=b):
        count+=1
elif(a==d):
    count+=1
    if(b==c and a!=b):
        count+=1

if(count==2):
    print("Yes")
else:
    print("No")
num = input()
if num[0] < num[2]:
print('0')
else:
print('10')

### FIXED CODE ###

num = input()
if num[0] < num[2]:
	print('0')
else:
	print('10')
A, B = map(int,input().split())

Amin = A/0.08
if Amin != int(Amin):
  Amin = int(Amin)+1
else Amin = int(Amin)

Bmin = B/0.1
if Bmin != int(Bmin):
  Bmin = int(Bmin)+1
else Bmin = int(Bmin)

rangea = set(range(Amin,int((A+1)/0.08),1))
rangeb = set(range(Bmin,int((B+1)/0.10),1))

intersection = rangea & rangeb

if len(intersection)==0:
  print(-1)
else:
  print(min(intersection))

### FIXED CODE ###

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

Amin = A/0.08
if Amin != int(Amin):
  Amin = int(Amin)+1
else:
  Amin = int(Amin)

Bmin = B/0.1
if Bmin != int(Bmin):
  Bmin = int(Bmin)+1
else:
  Bmin = int(Bmin)

rangea = set(range(Amin,int((A+1)/0.08),1))
rangeb = set(range(Bmin,int((B+1)/0.10),1))

intersection = rangea & rangeb

if len(intersection)==0:
  print(-1)
else:
  print(min(intersection))
a,b=map(input().split(" "))

if a>b:
 print(a-1)
else:
 print(a)

### FIXED CODE ###

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

if a<=b:
    print(a)
else:
    print(a-1)
li = list(map(input().split()))
sum = 0;
for i in li:
  if(li[i] != li[i + 1]):
    sum += 1
  if((i+1) >= len(li)):
    break;
print(sum)


### FIXED CODE ###

li = list(input())
sums = 0
leng = int(len(li))

for i in range(leng):
    now = i
    if (now + 1) >= leng:
        break
    if(li[now] == li[now + 1]):
        if(li[now + 1] == '0'):
            li[now + 1] = '1'
        else:
            li[now + 1] = '0'
        sums += 1
print(sums)
a= int(input())
b = list(map(int, input().split()))
answe = True


for i in range(a-1):
    if b[i] - b[i+1] >0:
        b[i] = b[i]-1

for i in range(a-1):
    if b[i] - b[i+1] >0:
        answe= False

if b[i] > b[i+1]:
    answe= False

if answe == True:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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

min = 0
for i in b:
    if min == i:
        continue
    if min > i:
        print("No")
        exit()
    if min < i :
        min = i-1



print("Yes")
import math

nm = list(map(int,input().split(" ")))
N = nm[0]
M = nm[1]

A = list(map(int,input().split(" ")))
A.sort(reverse=True)
hmax = math.floor(A[0]/2)
index = 0
while M > 0:
    if index != len(A):
        if A[index] >= hmax:
            A[index] = math.floor(A[index]/2)
            M = M -1
            index = index + 1
        else:
            index = 0
            A.sort(reverse=True)
            hmax = math.floor(A[0])
    else:
        index = 0
    if hmax == 0:
        break
print(sum(A))

### FIXED CODE ###

S = input()

if S == "Sunny":
    print("Cloudy")
elif S == "Cloudy":
    print("Rainy")
else:
    print("Sunny")
def fact(n):
    if n <= 0:
        return 1
    return n * fact(n - 1)

n = input()
print(fact(n))


### FIXED CODE ###

def acum(n):
    if n <= 1:
        return 1
    return n + acum(n - 1)
print(acum(int(input())))
N = int(input())

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

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

d = prime_factorize(N)

import math
ans = math.inf

A = d

for i in range(1 << len(A)):
    a = []
    b = []
    ao = 1
    bo = 1
    for j in range(len(A)):
        if ((i >> j) & 1) == 1:
            a.append(A[j])
        else:
            b.append(A[j])
            
    for j in range(len(a)):
        ao *= a[j]
    for j in range(len(b)):
        bo *= b[j]
        
    ans = min(ans, ao+bo-2)
    
print(ans)




### FIXED CODE ###

N = int(input())

a = 1
ans = 2**64
while a*a<=N:
    b = N/a
    if b!=int(b):
        a += 1
        continue
    b = int(b)
    ans = min(ans, a+b-2)

    a += 1

print(ans)
import math

N = int(input())
a, *A = map(int, input().split())

for x in A:
    a = math.gcd(x, a)

print(a)

### FIXED CODE ###

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

while len(A) > 1:
    a = min(A)
    A = set(x % a if x % a != 0 else a for x in A)
    if 1 in A:
        A = {1}
print(list(A)[0])
a,b,k=map(int,input().split())
num=list(range(a,b+1))
ans=[]
if (2*k>b-a+1):
    for i in num:
        print(i)
    exit()
for i in range(k):
    ans.append(num[i])
    ans.append(num[-(i+1)])
ans=list(set(ans)) #重複を削除
ans.sort() #ソート
for i in ans:
    print(i)

### FIXED CODE ###

a,b,k=map(int,input().split())
ans=[]
for i in range(a,min(a+k,b+1),1):
    ans.append(i)
for i in range(b,max(a,b-k),-1):
    ans.append(i)
ans=list(set(ans)) #重複を削除
ans.sort() #ソート
for i in ans:
    print(i)
import sys

sys.setrecursionlimit(50000)
ERROR_INPUT = 'input is invalid'
ERROR_INPUT_NOT_UNIQUE = 'input is not unique'


def main():
    S = get_input1()
    T = get_input2()

    count = 0
    for t in T:
        if binary_search(S, t, 0, len(S), len(S) // 2):
            print(t)
            count += 1

    print(count)


def binary_search(li, key, left, right, mid):
    if li[mid] == key:
        return True
    elif li[mid] < key:
        left = mid + 1
    elif li[mid] > key:
        right = mid

    if left > right:
        return False
    mid = (left + right) // 2
    return binary_search(li, key, left, right, mid)


def get_input1():
    n = int(input())
    if n > 100000:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        li.append(int(x))

    return li


def get_input2():
    n = int(input())
    if n > 50000:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        elif int(x) in li:
            print(ERROR_INPUT_NOT_UNIQUE)
            sys.exit(1)
        li.append(int(x))

    return li


main()

### FIXED CODE ###

import array

def main():
    n1 = int(input())
    li1 = array.array('l', [int(x) for x in input().split()])
    n2 = int(input())
    li2 = array.array('l', [int(x) for x in input().split()])
    count = 0

    for l in li2:
        if binary_search(li1, l):
            count += 1

    print(count)


def binary_search(li, x):
    if len(li) == 0:
        return False
    
    mid = len(li)//2
    
    k = li[mid]
    if k == x:
        return True
    elif k > x:
        li = li[:mid]
    else:
        li = li[mid+1:]
        
    return binary_search(li, x)

if __name__=='__main__':
    main()
from math import factorial

def cmb(n,r):
    if n == 0 or r == 0:
        return 1 
    return int(factorial(n)/(factorial(r)*factorial(n-r)))

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

blue = K
red = N-K

for i in range(1, blue+1):
    if blue-1 < i-1:
        print(0)
    else:
        ans = cmb(blue-1, i-1) * cmb(red+1, i)
        print(ans%(10**9+7))

### FIXED CODE ###

from math import factorial

def cmb(n,k):
    if n < k or n < 0 or k < 0:
        return 0
    return factorial(n)//(factorial(k)*factorial(n-k))

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

for i in range(1, K+1):
    ans = cmb(K-1, i-1) * cmb(N-K+1, i)
    print(ans%(10**9+7))
import math

r = int(input())
x = math.pi

print(x*r*r + " "+  2*x**r)


### FIXED CODE ###

import math
x = math.pi

r = float(input())
print("{} {}".format(x*r*r,2*x*r))
n = int(raw_input)
lst = []
#store all the cards
for i in ["S","H","C","D"]:
	for j in xrange(1,14):
		lst.append("{0} {1}".format((i,j))
#discard the given cards
for i in xrange(0,n):
	a = raw_input()
	if a in lst:
		lst.remove(a)
#print the result
for i in xrange(0,len(lst)):
	print lst[i]

### FIXED CODE ###

n = int(raw_input())
lst = []
#store all the cards
for i in ["S","H","C","D"]:
	for j in xrange(1,14):
		lst.append("{0} {1}".format(i,j))
#discard the given cards
for i in range(n):
	a = raw_input()
	lst.remove(a)
#print the result
for i in range(len(lst)):
	print lst[i]
from collections import deque, namedtuple
import sys
sys.setrecursionlimit(1000000000)

class RootedTree:
    def __init__(self, t, n):
        self.t = t
        self.n = n
        self.d = [-1] * n
    def setDepth(self, u, p):
        self.d[u] = p
        if self.t[u].r != -1:
            self.setDepth(self.t[u].r, p)
        if self.t[u].l != -1:
            self.setDepth(self.t[u].l, p + 1)
        return(self.d)
    def getChildren(self, u):
        ret = []
        c = self.t[u].l
        while c != -1:
            ret.append(c)
            c = self.t[c].r
        return(ret)
    def printNode(self, i):
        p_ = self.t[i].p
        d_ = self.d[i]
        c_ = self.getChildren(i)
        if p_ == -1:
            t_ = "root"
        elif len(c_) == 0:
            t_ = "leaf"
        else:
            t_ = "internal node"
        print("node {}: parent = {}, depth = {}, {}, {}".format(i, p_, d_, t_, c_))

if __name__ == '__main__':
    n = int(input().rstrip())
    Node = namedtuple('Node', ['p', 'l', 'r'])
    t = [Node(-1, -1, -1)] * n
    r = -1
    for i in range(n):
        tmp = deque([int(i) for i in input().rstrip().split(" ")])
        v = tmp.popleft()
        d = tmp.popleft()
        for j in range(d):
            c = tmp.popleft()
            if j == 0:
                t[v] = t[v]._replace(l = c)
            else:
                t[l] = t[l]._replace(r = c)
            l = c
            t[c] = t[c]._replace(p = v)
    for i in range(n):
        if (t[i].p == -1):
            r = i
    x = RootedTree(t, n)
    x.setDepth(r, 0)
    for i in range(n):
        x.printNode(i)

### FIXED CODE ###

from collections import deque, namedtuple

class RootedTree:
    def __init__(self, t, n):
        self.t = t
        self.n = n
        self.d = [-1] * n

    def setDepth(self, u, p):
        self.t[u] = self.t[u]._replace(d = p)
        for i in self.getChildren(u):
            self.setDepth(i, p + 1)

    def getChildren(self, u):
        ret = []
        c = self.t[u].l
        while c != -1:
            ret.append(c)
            c = self.t[c].r
        return(ret)

    def printNode(self, i):
        p_ = self.t[i].p
        d_ = self.t[i].d
        c_ = self.getChildren(i)
        if p_ == -1:
            t_ = "root"
        elif len(c_) == 0:
            t_ = "leaf"
        else:
            t_ = "internal node"
        print("node {}: parent = {}, depth = {}, {}, {}".format(i, p_, d_, t_, c_))

if __name__ == '__main__':
    n = int(input().rstrip())
    Node = namedtuple('Node', ['p', 'l', 'r', 'd'])
    t = [Node(-1, -1, -1, -1)] * n
    r = -1
    for i in range(n):
        tmp = deque([int(i) for i in input().rstrip().split(" ")])
        v = tmp.popleft()
        d = tmp.popleft()
        for j in range(d):
            c = tmp.popleft()
            if j == 0:
                t[v] = t[v]._replace(l = c)
            else:
                t[l] = t[l]._replace(r = c)
            l = c
            t[c] = t[c]._replace(p = v)
    for i in range(n):
        if (t[i].p == -1):
            r = i
    x = RootedTree(t, n)
    x.setDepth(r, 0)
    for i in range(n):
        x.printNode(i)
n=list(int(input().splice()))
n[1]=K
h=list(int(input().splice()))

count = 0
for hi in h:
  if hi >= K:
    count += 1

print(count)

### FIXED CODE ###

NK = input().split()
K=int(NK[1])
h=list(map(int,input().split()))

count = 0
for hi in h:
  if hi >= K:
    count += 1

print(count)
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
n = int(input())
a = list(map(int,input().split()))
li = []
li2 = []
for i in range(n-1):
    li.append(gcd(a[i],a[i+1]))
for i in range(n-2):
    li2.append(gcd(a[i],a[i+2]))
if n <= 3:
    li = set(li) | set(li2)
    ans = max(li)
    print(ans)
else:
    li = set(li) & set(li2)
    ans = max(li)
    print(ans)

### FIXED CODE ###

def gcd(a,b):
    if a < b:
        a,b = b,a
    if b == 0:
        return a
    return gcd(b,a%b)

n = int(input())
a = list(map(int, input().split()))
rs, ls = [0], [0]
for i in range(n-1):
    rs.append(gcd(rs[i], a[i]))
    ls.append(gcd(ls[i], a[-i-1]))
gcd_list = [gcd(r,l) for r, l in zip(rs, ls[::-1])]
print(max(gcd_list))
import sys
sys.setrecursionlimit(50000)
N,M=map(int,input().split())
L=[int(input()) for _ in range(M)]
ans=0

def dfs(i):
	global ans
	if i==N:
		ans+=1
		return True
	if i>N:return False
	if i in L:return True
	if dfs(i+1)==False:return True
	if dfs(i+2)==False:return True

dfs(0)
print(ans%1000000007) 

### FIXED CODE ###

N,M=map(int,input().split())
A=set([int(input()) for _ in range(M)])
dp=[0]*(N+1)
dp[0]=1
for i in range(1,N+1):
	dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
	if i in A:
		dp[i]=0
print(dp[N])
import sys
import math

def main():
    N = int(input())
    N_x = 100*N
    for x in range(N_x-50, N_x+50):
        if(x%108==0):
            print(x//108)
			sys.exit()
    print(":(")

main()

### FIXED CODE ###

import sys

def main():
    N=int(input())

    for x in range(50001):
        if(int(x*1.08)==N):
            print(x)
            sys.exit()

    print(":(")
main()
n,k = map(int,input().split())
a = [int(i) - 1 for i in input().split()]
r = []
nx = 0
for i in range(n):
    r.append(nx)
    if k < i:
        print(r[k] + 1)
        break
    if a[nx] in r:
        m = r.index(a[nx])
        d = i - m
        k = k - m
        k = k % d
        print(r[k + 1] + 1)
        break  
    nx = a[nx]


### FIXED CODE ###

n,k = map(int,input().split())
a = [int(i) - 1 for i in input().split()]
r = []
nx = 0
sr = set([])
for i in range(n):
    r.append(nx)
    sr.add(nx)
    if k < i:
        print(r[k] + 1)
        break
    tnx = a[nx]
    if tnx in sr:
        m = r.index(a[nx])
        d = i - m + 1
        k = k - m
        k = k % d
        print(r[k + m] + 1)
        break  
    nx = tnx
s = input()

count = 0
ans = []
for i in range(len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        count += 1
    else:
        ans.append(count)
        count = 0
print(max(ans))


### FIXED CODE ###

s = input()

count = 0
ans = [0]
for i in range(len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        count += 1
        if i == (len(s)-1):
            ans.append(count)
        
    else:
        ans.append(count)
        count = 0
print(max(ans))
N = int(input())
list_S = []
for i in range(N):
  list_S.append(input())

list_get = []
for i in list_S:
  if not list_S[i] in list_get: list_get.append(list_S[i])

print(len(list_get))

### FIXED CODE ###

N = int(input())
list_S = [str(input()) for i in range(N)]
print(len(list(set(list_S))))
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

print(math.ceil((N-1)/(K-1))


### FIXED CODE ###

#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

print(math.ceil((N-1)/(K-1)))
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]

sabun = []
for i in range(N):
    for j in range(N-i):
        if i == j+i:
            continue
        else:
            p = xy[i][0] - xy[j+i][0]
            q = xy[i][1] - xy[j+i][1]
            # print(p,q)
            sabun.append([p,q])
count = [sabun.count(i) for i in sabun]
print(N-max(count))


### FIXED CODE ###

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


sabun = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        else:
            p = xy[i][0] - xy[j][0]
            q = xy[i][1] - xy[j][1]
            sabun.append([p,q])
count = [sabun.count(i)+sabun.count([-i[0],-i[1]]) for i in sabun]

if count == []:
    print("1")
else:
    print(int(N-(max(count))/2))