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

n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))

c = list()
i = 1
while True:
    if a[i] in c:
        break
    else:
        c.append(a[i])
        i = a[i]

s = c.index(a[i])

if k < s:
    print(c[k-1])
else:
    k -= s
    c = c[s:]
    ans = c[k % len(c) - 1]
    print(ans)

### FIXED CODE ###

import sys
import numpy as np

read = sys.stdin.read

def dubbling(a:np.array, k:int, MAXk=10**12) -> np.array:
    bl = MAXk.bit_length()
    b = np.empty([bl,len(a)+1], dtype=np.int64)
    b[0] = np.append(a, -1)
    for i in range(1,bl):
        x = b[i-1]
        b[i] = x[x]
    X1 = b[np.array(list(format(k,'0'+str(bl)+'b')), dtype=np.int8).astype(np.bool)[::-1]]
    ret = np.append(np.arange(len(a)), -1)
    for i in X1:
        ret = ret[i]
    return ret

n, k = map(int, input().split())
a = np.array(read().split(), dtype=np.int64)
maxk = 10**18

ans = dubbling(a-1, k, MAXk=maxk)[0] + 1
print(ans)
### BUGGY CODE ###

from copy import deepcopy
mod = 10 ** 9 + 7
n, m = map(int, input().split())
s = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = [1 for i in range(m + 1)]
for i in s:
    ans2 = deepcopy(ans)
    cnt = 0
    for j in range(m):
        ans2[j] = (cnt + ans2[j]) % mod
        if i == t[j]:
            cnt = (cnt + ans[j]) % mod
    ans2[-1] = (cnt+ ans2[-1]) % mod
    ans = deepcopy(ans2)
print(ans[-1])

### FIXED CODE ###

from copy import deepcopy
mod = 10 ** 9 + 7
n, m = map(int, input().split())
s = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = [1 for i in range(m + 1)]
for i in s:
    ans2 = deepcopy(ans)
    cnt = 0
    for j in range(m):
        ans2[j] = (cnt + ans2[j]) % mod
        if i == t[j]:
            cnt = (cnt + ans[j]) % mod
    ans2[-1] = (cnt+ ans2[-1]) % mod
    ans = deepcopy(ans2)
print(ans[-1])
### BUGGY CODE ###

nk = input().split()
seisuuretu = input().split()

for i in range(len(seisuuretu)):
    seisuuretu[i] = int(seisuuretu[i])

all_seisuuretu = []

for start in range(len(seisuuretu) + 1):
    for end in range(len(seisuuretu) + 1):
        if start < end:
            all_seisuuretu.append(seisuuretu[start:end])

beautiful_list = []
for pattern in all_seisuuretu:
    beautiful_list.append(sum(pattern))

for i in range(len(beautiful_list)):
    beautiful_list[i] = bin(beautiful_list[i])[2:]

list_max = []
for i in beautiful_list:
    list_max.append(len(i))
list_max = max(list_max)
list_max = -list_max

status = True
while status == True:
    temp = []
    count = 0
    for i in beautiful_list:
        try:
            if int(i[list_max]) == 1:
                count += 1
                temp.append(i)
        except:
            continue
    if count > int(nk[1]):
        list_max += 1
        beautiful_list = temp
    elif count == int(nk[1]):
        beautiful_list = temp
        for num in range(len(beautiful_list)):
            if num == 0:
                ronriseki = int(beautiful_list[num], 2)
            else:
                ronriseki = ronriseki & int(beautiful_list[num], 2)
        print(ronriseki)
        status = False
    elif list_max == -1:
        for num in range(len(beautiful_list)):
            if num == 0:
                ronriseki = int(beautiful_list[num], 2)
            else:
                ronriseki = ronriseki & int(beautiful_list[num], 2)
        print(ronriseki)
        status = False
    else:
        list_max += 1


### FIXED CODE ###

nk = input().split()
seisuuretu_2 = input().split()
nk1 = int(nk[1])

#seisuuretu = [int(i) for i in seisuuretu_2]
seisuuretu = list(map(int, seisuuretu_2))

list_max = set()
beautiful_list = []
for start in range(len(seisuuretu) + 1):
    for end in range(len(seisuuretu) + 1):
        if start < end:
            temp_pattern = bin(sum(seisuuretu[start:end]))[2:]
            beautiful_list.append(temp_pattern)
            list_max |= {len(temp_pattern),}

list_max = -max(list_max)

status = True
while status == True:
    temp = []
    count = 0
    for i in beautiful_list:
        try:
            if i[list_max] == "1":
                count += 1
                temp.append(i)
        except:
            continue
    if count > nk1:
        list_max += 1
        beautiful_list = temp
    elif count == nk1:
        num_count = True
        for num in temp:
            if num_count == True:
                ronriseki = int(num, 2)
            else:
                ronriseki = ronriseki & int(num, 2)
            num_count = False
        print(ronriseki)
        exit()
        status = False
    elif list_max == -1:
        num_count = True
        for num in beautiful_list:
            if num_count == True:
                ronriseki = int(num, 2)
            else:
                ronriseki = ronriseki & int(num, 2)
            num_count = False
        print(ronriseki)
        exit()
        status = False
    else:
        list_max += 1
### BUGGY CODE ###

k, s = map(int,input().split())

ans = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s :
                ans += 1

print(ans)

### FIXED CODE ###

k, s = map(int,input().split())

ans = 0
for x in range(k+1):
    for y in range(k+1):
            z = s - x - y 
            if z <= k and z >= 0 :
                ans += 1

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

def sq(a, b, mod):  # aのb乗を剰余,kは初期値#20191116-D-Knight
    if b == 0:
        return 1
    elif b % 2 == 0:
        return sq(a, b // 2, mod)**2 % mod
    else:
        return sq(a, b - 1, mod) * a % mod


def nCk(n, k, mod=10 ** 9 + 7):
    x = max(k, n - k)
    y = min(k, n - k)
    kkai = 1
    for i in range(2, y + 1):
        kkai = (kkai * i) % mod
    nkkai = 1
    for i in range(x + 1, n + 1):
        nkkai = (nkkai * i) % mod
    answer = sq(kkai, mod - 2, mod) * nkkai % mod
    return answer


n = int(input())
alist = sorted(list(set(map(int, input().split()))))[::-1]
a, b = 0, 0
ans = 0
for i in range(n - 1):
    ai = alist[i]
    for j in range(i + 1, n):
        com = nCk(ai, alist[j])
        if com > ans:
            ans = com
            a, b = ai, alist[j]
print(a, b)


### FIXED CODE ###

n = map(int, input().split())
alist = list(map(int, input().split()))
m = max(alist)
sbn = 10**10
for a in alist:
    if abs(m/2 - a) < sbn and a != m:
        ans = a
        sbn = abs(m/2 - a)
print(m, ans)
### BUGGY CODE ###

K,S = map(int,input().split(" "))
a = 0
ans = 0
while a <= K:
  b = 0
  while b <= K:
    c = S-a-b
    if c <= K and c >= 0:
       ans+=1
    b += 1
  a+=1
print(ans)

### FIXED CODE ###

#B問題
K,S=map(int,input().split())
count=0
for y in range(K+1):
    x=0
    for x in range(K+1):
        z=S-(x+y)
        if z <= K and z >= 0:
            count+=1
print(count)
### BUGGY CODE ###

N,T = [int(x) for x in raw_input().split(" ")]

A = [int(x) for x in raw_input().split(" ")]


mx = -1e10
cnt = 0

for i in range(len(A)-1):
	if max(A[i+1:]) - A[i] > mx:
		mx = max(A[i+1:]) - A[i]
		cnt = 1

	elif max(A[i+1:]) - A[i] == mx:
		cnt += 1

print cnt

### FIXED CODE ###

N,T = [int(x) for x in raw_input().split(" ")]

A = [int(x) for x in raw_input().split(" ")]

mx = -1e10
cnt = 0
X = []

for i in range(len(A)):
	mx = max(A[-i-1],mx)
	
	dif = mx - A[-i-1]
	
	X.append(dif)



mxx = max(X)

for i in X:
	if i == mxx:
		cnt += 1

print cnt
### BUGGY CODE ###

import math

n = int(input())
rn = int(math.sqrt(n))
for i in range(1, n+1):
  count = 0
  for x in range(1, rn):
    for y in range(1, rn):
      for z in range(1, rn):
        if x*x + y*y + z*z + x*z + x*y + y*z == i:
          count += 1
  print(count)

### FIXED CODE ###

n = int(input())
arr = [0] * (n + 1)

for x in range(1, 101):
  for y in range(1, 101):
    for z in range(1, 101):
      a = x**2 + y**2 + z**2 + x*z + y*z + x*y
      if a<= n:
        arr[a] += 1
        
for i in range(1,n+1):
    print(arr[i])
### BUGGY CODE ###

from functools import reduce
from itertools import permutations
import sys
for n, s in (map(int, l.rstrip().split()) for l in sys.stdin):
    print(len([1 for a in permutations(range(10), n) if sum(i*n for i,n in enumerate(a, start=1))==s]))


### FIXED CODE ###

from itertools import combinations
import sys

# dp[n][使った数字(bit)][合計] = count
dp = [[[0]*331 for _ in [0]*2048] for _ in [0]*11]
for i in range(11):
    dp[1][2**i][i] = 1

for i in range(2, 11):
    for used in (sum(comb) for comb in combinations([2**n for n in range(10)], i-1)):
        for j in filter(lambda x: used & 2**x == 0, range(10)):
            for total, count in filter(lambda p: p[1]>0, enumerate(dp[i-1][used])):
                dp[i][used|2**j][total+j*i] += count

for n, s in (map(int, l.rstrip().split()) for l in sys.stdin):
    print(sum(a[s] for a in dp[n] if a[s]) if s<331 else 0)
### BUGGY CODE ###

n = int(input())
A_list = list(map(int, input().split()))
for i in range(n):
    A_list[i] -= i
A_list.sort()
A_cum = [0] * n
for i in range(n):
    if i == 0:
        A_cum[0] = A_list[0]
    else:
        A_cum[i] = A_cum[i-1] + A_list[i]
def findinfindex(sortedlist, key, l, r):
    if r - l <= 0:
        return l
    m = (l+r+1)//2
    if sortedlist[m] > key:
        return findinfindex(sortedlist, key, l, m-1)
    else:
        return findinfindex(sortedlist, key, m, r)
sadmin = -1
for b in range(A_list[0],A_list[n-1]+1):
    lastminus = findinfindex(A_list, b, 0, n-1)
    sadness = (2*lastminus - n + 2)*b - 2*A_cum[lastminus] + A_cum[n-1]
    if sadmin == -1:
        sadmin = sadness
    elif sadness < sadmin:
        sadmin = sadness
    else:
        break
print(sadmin)


### FIXED CODE ###

n = int(input())
A_list = list(map(int, input().split()))
for i in range(n):
    A_list[i] -= i
A_list.sort()

def sadness(a, mid):
    sad = 0
    for i in range(mid):
        sad += a[mid] - a[i]
    for i in range(mid+1,len(a)):
        sad += a[i] - a[mid]
    return sad

if n % 2 != 0:
    print(sadness(A_list, n//2))
else:
    print(min(sadness(A_list, n//2), sadness(A_list, n//2+1)))
### BUGGY CODE ###

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

n,m = inm()
dst = [ set() for i in range(n) ]
for i in range(m):
    u,v = inm()
    u -= 1
    v -= 1
    dst[v].add(u)
s,t = inm()
s -= 1
t -= 1

reach2 = [ set() for i in range(n) ]
m2done = [ False for i in range(n) ]
reach3 = [ set() for i in range(n) ]
m3done = [ False for i in range(n) ]

def mark(f):
    x = set()
    for v1 in dst[f]:
        if not m2done[v1]:
            y = set()
            for v2 in dst[v1]:
                for v3 in dst[v2]:
                    y.add(v3)
            reach2[v1] = y
            m2done[v1] = True

        for v3 in reach2[v1]:
                    if v3 == f:
                        continue
                    x.add(v3)
    reach3[f] = x
    m3done[f] = True

dist = [-1] * n
dist[t] = 0
q = deque([(t,0)])
while len(q)>0:
    v,d = q.popleft()
    if not m3done[v]:
        mark(v)
    for nxt in reach3[v]:
        if dist[nxt] > -1:
            continue
        if nxt==s:
            print(d+1)
            exit()
        dist[nxt] = d+1
        q.append((nxt,d+1))
print(-1)


### FIXED CODE ###

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

n,m = inm()
dst = [ [] for i in range(n*3) ]
for i in range(m):
    u,v = inm()
    u -= 1
    v -= 1
    dst[u].append(v+n)
    dst[u+n].append(v+n*2)
    dst[u+n*2].append(v)
s,t = inm()
s -= 1
t -= 1
ddprint(dst)

dist = [-1] * (n*3)
dist[s] = 0
q = deque([s])
while len(q)>0:
    v = q.popleft()
    #ddprint('v='+str(v))
    for nxt in dst[v]:
        #ddprint('nxt='+str(nxt))
        if nxt==t:
            print((dist[v]+1)//3)
            exit()
        if dist[nxt] > -1:
            continue
        dist[nxt] = dist[v]+1
        q.append(nxt)
    #ddprint(dist)
    #ddprint(q)
print(-1)
### BUGGY CODE ###

from sys import setrecursionlimit as SRL, stdin

SRL(10 ** 7)
rd = stdin.readline
rrd = lambda: map(int, rd().strip().split())

n, m, l = rrd()
dis = [[10 ** 10] * 305 for _i in range(305)]
need = [[10 ** 10] * 305 for _i in range(305)]
for i in range(n):
    dis[i][i] = 0
for i in range(m):
    a, b, c = rrd()
    dis[a][b] = c
    dis[b][a] = c

for k in range(1, n + 1):
    for i in range(1, n + 1):
        for j in range(1, n + 1):
            if k in [i, j] or i in [k, j] or j in [i, k]:
                continue
            dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])

for i in range(1, n + 1):
    for j in range(1, n + 1):
        if i == j:
            need[i][j] = 0
        elif dis[i][j] <= l:
            need[i][j] = 1

for k in range(1, n + 1):
    for i in range(1, n + 1):
        for j in range(1, n + 1):
            if k in [i, j] or i in [k, j] or j in [i, k]:
                continue
            need[i][j] = min(need[i][j], need[i][k] + need[k][j])
q = int(input())

while q:
    s, t = rrd()
    if need[s][t] < 10 ** 10:
        print(need[s][t]-1)
    else:
        print(-1)
    q -= 1










### FIXED CODE ###

from sys import setrecursionlimit as SRL, stdin
inf = 10**15
SRL(10 ** 7)
rd = stdin.readline
rrd = lambda: map(int, rd().strip().split())

n, m, l = rrd()
dis = [[inf] * 305 for _i in range(305)]
need = [[inf] * 305 for _i in range(305)]
for i in range(n):
    dis[i][i] = 0
for i in range(m):
    a, b, c = rrd()
    dis[a][b] = c
    dis[b][a] = c

for k in range(1, n + 1):
    for i in range(1, n + 1):
        for j in range(1, n + 1):
            dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])

for i in range(1, n + 1):
    for j in range(1, n + 1):
        if i == j:
            need[i][j] = 0
        elif dis[i][j] <= l:
            need[i][j] = 1

for k in range(1, n + 1):
    for i in range(1, n + 1):
        for j in range(1, n + 1):
            need[i][j] = min(need[i][j], need[i][k] + need[k][j])
q = int(input())

while q:
    s, t = rrd()
    if need[s][t] < inf:
        print(need[s][t]-1)
    else:
        print(-1)
    q -= 1
### BUGGY CODE ###

S = input()
Q = int(input())
Switch = False
Query = []
for i in range(Q):
    Query.append(input())
for s in Query:
    if s[0] == '1':
        if Switch:
            Switch = False
        else:
            Switch = True
    if s[0] == '2':
        if s[2] == '1' and Switch==False:
            S = s[4]+S
        elif s[2]=='1' and Switch==True:
            S = S+s[4]
        elif s[2] == '2' and Switch==False:
            S = S+s[4]
        else:
            S = s[4]+S
if Switch == False:
    print(S)
else:
    print(S[::-1])

### FIXED CODE ###

S = input()
Q = int(input())
Switch = False
Query = []

import collections
dq = collections.deque(S)

for i in range(Q):
    s = input()
    if s[0] == '1':
        if Switch:
            Switch = False
        else:
            Switch = True
    if s[0] == '2':
        if s[2] == '1' and Switch==False:
            dq.appendleft(s[4])
#             S = s[4]+S
        elif s[2]=='1' and Switch==True:
            dq.append(s[4])
#             S = S+s[4]
        elif s[2] == '2' and Switch==False:
            dq.append(s[4])
#             S = S+s[4]
        else:
#             S = s[4]+S
            dq.appendleft(s[4])

if Switch == False:
    print(''.join(dq))
else:
    print(''.join(dq)[::-1])
### BUGGY CODE ###

n, k = map(int, input().split())
*a, = map(int, input().split())
tmp = 1
for i in range(k):
    tmp *= a[i]
ans = [tmp]
for i in range(k, n):
    tmp //= a[i - k]
    tmp *= a[i]
    ans += [tmp]
for i, j in zip(ans, ans[1:]):
    print('Yes' if i < j else 'No')

### FIXED CODE ###

n, k = map(int, input().split())
*a, = map(int, input().split())
for i, j in zip(a, a[k:]):
    print('Yes' if i < j else 'No')
### BUGGY CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

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

List2=[list(map(int,input().split())) for i in range(M)]
uf = UnionFind(N+1)

for i in range(M):
  a = List2[i][0]
  b = List2[i][1]  
  uf.union(a, b)
  
cnt = 0
G = uf.all_group_members()
for i,w in enumerate(List):
  if uf.find(i+1) == uf.find(w):
    cnt += 1
  
print(cnt)

### FIXED CODE ###

class UnionFindTree():
    
    def __init__(self, N):
        self.parent = [-1]*(N+1)
        self.rank = [1]*(N+1)
        self.size = [1]*(N+1)
  
    def find(self, i):
        if self.parent[i] == -1:
            group = i
        else:
            group = self.find(self.parent[i]) 
            self.parent[i] = group
        return group
      
    def unite(self, x, y):
        px = self.find(x)
        py = self.find(y)
        if px != py:
            if self.rank[px] == self.rank[py]: # rank is same
                self.rank[px] += 1
            elif self.rank[px] < self.rank[py]:
                px, py = py, px
                
            self.parent[py] = px
            self.size[px] += self.size[py]
    
    def getsize(self, x):
        return self.size[self.find(x)]
    
    def groups(self, index1=True):
        return set([self.find(i) for i in range(0+index1, N+index1)])
      
N,M = map(int,input().split())
List=list(map(int,input().split()))

List2=[list(map(int,input().split())) for i in range(M)]
uf = UnionFindTree(N+1)

for i in range(M):
  a = List2[i][0]
  b = List2[i][1]  
  uf.unite(a, b)
  
cnt = 0
for i,w in enumerate(List):
  if uf.find(i+1) == uf.find(w):
    cnt += 1
  
print(cnt)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def send_query(n):
    print(n)
    resp = int(input())
    return resp


N = int(input())
l = 0
r = N-1

cur = send_query(0)
while True:
    mid = (l+r)//2
    resp = send_query(mid)
    if resp == "Vacant":
        print(mid)
        break
    elif resp == cur:
        r = mid-1
    else:
        l = mid+1
    cur = resp


### FIXED CODE ###

n = int(input())
s = [0]*(n+1)

print(0)
a = input()
if a == "Vacant":
    exit()
s[0] = a
s[n] = a

l = 0
r = n
while True:
    m = (r+l)//2
    print(m)
    a = input()
    if a == "Vacant":
        exit()

    s[m] = a
    if s[l] == s[r]:
        if s[l] == s[m]:
            if (m-l) % 2 == 1:
                r = m
            else:
                l = m
        else:
            if (m-l) % 2 == 1:
                l = m
            else:
                r = m
    else:
        if s[l] == s[m]:
            if(m-l) % 2 == 1:
                r = m
            else:
                l = m
        else:
            if(m-l) % 2 == 1:
                l = m
            else:
                r = m
### BUGGY CODE ###

# -*- coding: utf-8 -*-

R,C,K = map(int, input().split())

items = [[0 for _ in range(C+1)] for _ in range(R+1)]
for i in range(K):
  r,c,v = map(int, input().split())
  items[r][c] = v

DP = [[[0,0,0] for _ in range(C+1)] for _ in range(R+1)]

for r in range(1,R+1):
  for c in range(1,C+1):
    item = items[r][c]
    DP1 = max(DP[r-1][c][2]+item,DP[r][c-1][0])
    DP2 = max(DP1,DP[r][c-1][1],DP[r][c-1][0]+item)
    DP3 = max(DP2,DP[r][c-1][2],DP[r][c-1][1]+item)
    DP[r][c][0] = DP1
    DP[r][c][1] = DP2
    DP[r][c][2] = DP3
        
print(DP[R][C][2])

### FIXED CODE ###

# -*- coding: utf-8 -*-

R,C,K = map(int, input().split())

items = [[0 for _ in range(C+1)] for _ in range(R+1)]
for i in range(K):
  r,c,v = map(int, input().split())
  items[r][c] = v

DP_prev = [0 for _ in range(C+1)]

for r in range(1,R+1):
  DP = [[0 for _ in range(C+1)],[0 for _ in range(C+1)],[0 for _ in range(C+1)]]
  for c in range(1,C+1):
    item = items[r][c]
    DP1 = max(DP_prev[c]+item,DP[0][c-1])
    DP2 = max(DP1,DP[1][c-1],DP[0][c-1]+item)
    DP3 = max(DP2,DP[2][c-1],DP[1][c-1]+item)
    DP[0][c] = DP1
    DP[1][c] = DP2
    DP[2][c] = DP3
  DP_prev = DP[2]
        
print(DP_prev[C])
### BUGGY CODE ###

import re

N = int(input())
S = input().strip()

count = 0
for c1 in range(10):
	for c2 in range(10):
		for c3 in range(10):
			if re.search("{}.*{}.*{}".format(c1, c2, c3), S):
				count += 1
print(count)



### FIXED CODE ###

import re

N = int(input())
S = [int(c) for c in input().strip()]
length = len(S)

count = 0
for c1 in range(10):
	index1 = 0
	while index1 < length:
		if S[index1] == c1:
			index1 += 1
			break
		index1 += 1
	if index1 < length:
		for c2 in range(10):
			index2 = index1
			while index2 < length:
				if S[index2] == c2:
					index2 += 1
					break
				index2 += 1
			if index2 < length:
				for c3 in range(10):
					index3 = index2
					while index3 < length:
						if S[index3] == c3:
							count += 1
							break
						index3 += 1
print(count)
### BUGGY CODE ###

ans = 0
n, m = map(int, input().split())
listL, listR = [], []

for i in range(m):
    l, r = map(int, input().split())
    listL.append(l)
    listR.append(r)

for j in range(n):
    for i in range(m):
        if not (listL[i] <= j + 1 <= listR[i]):
            break
    else:
        ans += 1


print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
l, r = 1, n

for _ in range(m):
    tmpL, tmpR = map(int, input().split())
    l = max(l, tmpL)
    r = min(r, tmpR)

print(max(0, r - l + 1))
### BUGGY CODE ###

n = int(input())
s = input()
t = 0

for i in range(1, n+1):
    for j in range(i+1, n+1):
        for k in range(j+1, n+1):
            if s[i-1] != s[j-1] and s[i-1] != s[k-1] and s[j-1] != s[k-1]:
                if j-i != k-j:
                    t += 1

print(t)


### FIXED CODE ###

n = int(input())
s = input()
t = s.count("R")*s.count("G")*s.count("B")
for i in range(n):
    for j in range(i+1, n):
        k = 2*j - i
        if k < n and s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            t -= 1

print(t)
### BUGGY CODE ###

n,q=map(int,input().split())
s=input()
ans=0
for i in range(q):
    l,r=map(int,input().split())
    st=s[l-1:r]
    t=st.count('AC')
    print(t)

### FIXED CODE ###

N,Q = map(int,input().split())
S = input()
t = [0] * (N + 1)

for i in range(N):
    if S[i : i + 2] == 'AC':
        t[i + 1] = t[i] + 1
    else:
        t[i + 1] = t[i]

for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])
### BUGGY CODE ###

import sys
s=input()
t=input()


    
l=[]

for i in range(len(t)):
    if s[i]!=t[i]:
        for j in l:
            if s[i]==j:
                print("No")
                sys.exit()
        l.append(t[i])
        u=s.replace(s[i],"A")
        v=u.replace(t[i],s[i])
        s=v.replace("A",t[i])
    
        

if s==t:
    print("Yes")
else:
    print("No")
        
    

### FIXED CODE ###

s=input()
t=input()


def f(s):
    l=[]
    a="abcdefghijklmnopqrstuvwxyz"
    r=""
    for i in range(len(s)):
        if s[i] in l:
            for j in range(len(l)):
                if s[i]==l[j]:
                    r+=a[j]
        else:
            r+=a[len(l)]
            l.append(s[i])
    return r

if f(s)==f(t):
    print("Yes")
else:
    print("No")