Harryxun/stf_run huggingface dataset:
n,k=map(int,input().split())
a=list(map(int,input().split()))
result=[1]
temp=1
i=0
count=0
while i<k:
  temp=a[temp-1]
  result.append(temp)
  i=i+1
  for j in range(0,i-1):
    if temp==result[j]:
      count=count+1
  if count==1:
    break
temp=0
l=len(result)
for i in range(0,l):
  if result[l-1]==result[i]:
    temp=i
    break
if k<l:
  print(result[k+1])
else:
  l2=l-1-temp
  print(result[temp+(k-temp)%l2])

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
result=[1]
temp=1
for i in range(n):
  temp=a[temp-1]
  result.append(temp)
temp=result.index(result[len(result)-1])
c=len(result)-temp-1
if k<n:
  print(result[k])
else:
  print(result[temp+(k-temp)%c])
sys.stdin = io.StringIO(lines)

line1 = sys.stdin.readline().rstrip()
lista = []
for i in range(int(line1)):
    line2 = sys.stdin.readline().rstrip()
    lista.append(line2)
    #print(line1,lista)
def ans(lista):    
    listb = []
    hantei = "true"
    for i in lista:
        if i not in listb:
            listb.append(i)
        else:
            hantei = "false"
    for i in range(len(listb)-1):
        if listb[i][-1] != listb[i+1][0]:
            hantei = "false"
    if hantei == "true":
        return("Yes")
    else:
        return("No")
ans(lista)

### FIXED CODE ###

import io
import sys
def solve(lista):    
    listb = []
    hantei = "true"
    for i in lista:
        if i not in listb:
            listb.append(i)
        else:
            hantei = "false"
    for i in range(len(listb)-1):
        if listb[i][-1] != listb[i+1][0]:
            hantei = "false"
    if hantei == "true":
        return("Yes")
    else:
        return("No")
# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    lista = []
    for i in range(int(line1)):
        line2 = sys.stdin.readline().rstrip()
        lista.append(line2)
    return (lista)

def main():
    a = readQuestion()
    answer = solve(a)
    print(answer)
    
if __name__ == '__main__':
    main()
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def solve():
    n, c = map(int, input().split())
    c_info = [[int(i) for i in input().split()] for _ in range(n)]
    c_info.sort(key=lambda x: (x[2], x[0]))
    info = []
    cnt = 0
    while cnt < n:
        if cnt == n - 1:
            info.append(c_info[cnt])
            break
        if c_info[cnt][1] == c_info[cnt + 1][0] and c_info[cnt][2] == c_info[cnt + 1][2]:
            tc = c_info[cnt][2]
            t = [c_info[cnt][0], c_info[cnt + 1][1], tc]
            cnt += 1
            while cnt < n - 1 and t[1] == c_info[cnt + 1][0] and tc == c_info[cnt + 1][2]:
                t = [t[1], c_info[cnt + 1][1], tc]
                cnt += 1
            info.append(t)
            if cnt == n - 1:
                break
        else:
            info.append(c_info[cnt])
        cnt += 1

    tarr = [0] * (1 + 10 ** 5)
    for elem in info:
       tarr[elem[0]] += 1
       tarr[elem[1] + 1] -= 1
    
    ans = 1
    tans = 0
    for elem in tarr:
        tans += elem
        ans = max(ans, tans)
    print(ans)

if __name__=="__main__":
    solve()


### FIXED CODE ###

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

def solve():
    n, c = map(int, input().split())
    c_info = [[int(i) for i in input().split()] for _ in range(n)]
    c_info.sort(key=lambda x: (x[2], x[0]))
    info = []
    cnt = 0
    
    while cnt < n:
        if cnt == n - 1:
            info.append(c_info[cnt])
            break
        if c_info[cnt][1] == c_info[cnt + 1][0] and c_info[cnt][2] == c_info[cnt + 1][2]:
            tc = c_info[cnt][2]
            t = [c_info[cnt][0], c_info[cnt + 1][1], tc]
            cnt += 1
            while cnt < n - 1 and t[1] == c_info[cnt + 1][0] and tc == c_info[cnt + 1][2]:
                t = [t[0], c_info[cnt + 1][1], tc]
                cnt += 1
            info.append(t)
            if cnt == n - 1:
                break
        else:
            info.append(c_info[cnt])
        cnt += 1

    tarr = [0] * (2 + 10 ** 5)
    for elem in info:
       tarr[elem[0]] += 1
       tarr[elem[1] + 1] -= 1
    
    ans = 1
    tans = 0
    for elem in tarr:
        tans += elem
        ans = max(ans, tans)
    print(ans)

if __name__=="__main__":
    solve()
/Users/miyauchitoru/Python_Competitive-programming/bin/python "/Users/miyauchitoru/PycharmProjects/Competitive_Programming/AtCorder/AtCoder Beginner Contest 077/compe.py"
123456789012345678901234567890
234567890123456789012345678901
LESS

Process finished with exit code 0


### FIXED CODE ###

val =[]
val.append(int(input()))
val.append(int(input()))

if val[1] == val[0]:
    print("EQUAL")
elif val[0] > val[1]:
    print("GREATER")
else:
    print("LESS")
from sys import stdin
import math
from itertools import groupby

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

li.sort()

if li[0] == 0 and li[1] == 0:
    print(0)
    exit()

lin = []
for key, value in groupby(li):
    lin.append(len(list(value)))

point = 1

for i in lin:
    if i >= 3:
        print(0)
        exit()
    point *= math.factorial(i)
    point %= 10**9+7

print(point)

### FIXED CODE ###

from sys import stdin
import math
from itertools import groupby

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

li.sort()

if len(li) == 1:
    if li[0] != 0:
        print(0)
        exit()
    else:
        print(1)
        exit()

if li[0] == 0 and li[1] == 0:
    print(0)
    exit()
    
lin = []
for key, value in groupby(li):
    lin.append(len(list(value)))

point = 1

for i in lin:
    if i >= 3:
        print(0)
        exit()
    point *= math.factorial(i)
    point %= 10**9+7

print(point)
n = int(input())
c, *lst = [int(i) for i in input().split()]
for i in range(1, n):
  if lst[i] > lst[i - 1]:
      c += lst[i] - lst[i - 1]
print(c)

### FIXED CODE ###

n = int(input())
lst = [int(i) for i in input().split()]
c = lst[0]
for i in range(1, n):
  if lst[i] > lst[i - 1]:
      c += lst[i] - lst[i - 1]
print(c)
def calculate(arr,M):
    sum = 0
    for i in range(M):
        index = 0
        value = 0
        for j in range(len(arr)):
            lastDay = i + arr[j][0]
            if lastDay <= M:
                # if arr[j][1] > value:
                #     index = j
                #     value = arr[j][1]
                # 
                # if (arr[j][1] == value) and (arr[index][0] < arr[j][0]):
                #         index = j
                #         value = arr[j][i]

        if len(arr) > 0:
            sum += value
            arr.pop(index)

        if len(arr) == 0:
            break

    return sum

N, M = map(int, input().split())
arr = []
for i in range(N):
    day, mount = map(int, input().split())
    arr.append([day,mount])
result = calculate(arr,M)
print(result)

### FIXED CODE ###

from heapq import heappush, heappop
n, m = map(int, input().split())
jobs = {}
for _ in range(n):
  a, b = map(int, input().split())
  if a > m:
    continue
  if a in jobs:
    jobs[a].append(b)
  else:
    jobs[a] = [b]
result = 0
candidates = []
for a in range(1, m + 1):
  if a in jobs:
    for b in jobs[a]:
      heappush(candidates, -b)
  else:
    if len(candidates) == 0:
      continue
  result += -heappop(candidates)
print(result)
_, k = input().split()

prices = input().split().map(lambda x : int(x))

prices.sort()

sum = 0
for i in range(k):
	sum += prices(i)
print(sum)

### FIXED CODE ###

_, k = input().split()
 
prices = list(map(lambda x : int(x), input().split()))
 
prices.sort()
 
sum = 0
for i in range(int(k)):
	sum += prices[i]
print(sum)
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

N,K = II()
S = str(input())

num = 0
for i in range(N):
    if S[i]=='0' and S[i+1]=='1':
        num += 1
        place = i+1
    if num==K:
        break

if num<K:
    print(N)
    exit()

for i in range(place+1,N):
    if i==N-1 and S[i]=='1':
        print(N)
        exit()
    if S[i]=='0':
        break

place = i-1

ans = place+1

for i in range(1,N):
    if S[i-1]=='0' and S[i]=='1':
        val = N-1
        count = 0
        for j in range(place+2,N):
            val = j
            if S[j]=='1':
                count += 1
            if count==2:
                break
        if val-i+1>ans:
            ans = val-i+1
        place = val

print(ans)

### FIXED CODE ###

#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

N,K = II()
S = str(input())

num = 0
for i in range(N):
    if i==N-1:
        print(N)
        exit()
    if S[i]=='0' and S[i+1]=='1':
        num += 1
        place = i+1
    if num==K:
        break

if num<K:
    print(N)
    exit()

for i in range(place+1,N):
    if i==N-1 and S[i]=='1':
        print(N)
        exit()
    if S[i]=='0':
        break

place = i-1

ans = place+1

for i in range(1,N):
    if S[i-1]=='0' and S[i]=='1':
        val = N-1
        for j in range(place+2,N):
            val = j
            if j==N-1:
                break
            if S[j]=='1' and S[j+1]=='0':
                break
        if val-i+1>ans:
            ans = val-i+1
        place = val

print(ans)
N,R = map(int,input().split())

if N <= 10:
    print(100*(10-N)+R)
else:
    print(B)

### FIXED CODE ###

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

if N <= 10:
    print(100*(10-N)+R)
else:
    print(R)
for letter in listofentries[1]:
    letters.append(letters)
numbertoindex= listofentries[0]/2-1
 
for index in range(numbertoindex):
	letters1.append(index)
for index in range(numberofindex, listofentries[0]-1)
	letters2.append(index)
  
if letters1==letters2:
	return print(Yes)
else:
  	return print(No)

### FIXED CODE ###

n=int(raw_input())
ch=raw_input()
if ch[:n//2]==ch[n//2:]:
        print('Yes')
else:
        print('No')
n=int(input())
k=n/2;
s=input()
p=s[k:]
t=s[:k]
if p=t print 'Yes' else print 'No'

### FIXED CODE ###

n = int(raw_input())
s = str(raw_input())
h=n/2
if s[0:h] == s[h:n]:
    print 'Yes'
else:
    print 'No'
x,y = map(int, input().split())

a = x # A[i]
for i in range(1,y):
            
    if (i==1 and a<=y) or a*2 <= y: 
        a *= 2 # A[i+1]
        continue
    else: break

print(i)

### FIXED CODE ###

x,y = map(int, input().split())

a = x # A[i]
for i in range(1,70):
            
    if (i==1 and a<y) or a*2 <= y: 
        a *= 2 # A[i+1]
        continue
    else: break

print(i)
S = input()
# L = len(S) % 2
for i in range()
  if i % 2 == 0:
    if S[i] == "R" or S[i] == "U" or S[L] == "D":
      print("Yes")
  else:
    print("No")

### FIXED CODE ###

S = input()
# L = len(S) % 2
youtube = 0

for i in range(len(S)):
  if i % 2 == 0: # 奇数
    if S[i] == "L":
      youtube += 1
  else:#偶数
    if S[i] == "R":
      youtube += 1
if youtube > 0:
  print("No")
else:
  print("Yes")
from collections import deque
import sys
H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1

maze = []
for i in range(H):
    maze.append(list(input()))

cnt = 0
reached = [[False]*W for _ in range(H)]
def bfs(sh, sw):
    global cnt
    d = deque()
    #reached[Ch][Cw] = True
    d.append((sh, sw))
    while d:
        while d:
            h, w = d.popleft()
            dh = [-1, 0, 1, 0]
            dw = [0, -1, 0, 1]
            reached[h][w] = True
            for i in range(4):
                next_h = h + dh[i]
                next_w = w + dw[i]
                if 0 <= next_h <= H-1 and 0 <= next_w <= W-1 and maze[next_h][next_w] != "#" and not reached[next_h][next_w]:
                    d.append((next_h, next_w))
        if reached[Dh][Dw]:
            print(cnt)
            sys.exit(0)
        for i in range(H):
            for j in range(W):
                if reached[i][j] or maze[i][j] == "#":
                    continue
                for n in range(i-2, i+3):
                    for m in range(j-2, j+3):
                        if 0 <= n <= H-1 and 0 <= m <= W-1 and reached[n][m]:
                            cnt += 1
                            bfs(i, j)


bfs(Ch, Cw)
print(-1)

### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1

INF = 1e10
maze = []

dh = [-1,0,1,0]
dw = [0,1,0,-1]

for i in range(H):
    tmp = list(input())
    maze.append(tmp)

reached = [[INF]*W for _ in range(H)]

l = deque()
l.appendleft((Ch, Cw))
reached[Ch][Cw] = 0
while l:
    h, w = l.popleft()
    d = reached[h][w]
    for i in range(4):
        nh = h + dh[i]
        nw = w + dw[i]
        if not (0 <= nh <= H-1 and 0 <= nw <= W-1):
            continue
        if not maze[nh][nw] != "#":
            continue
        if not reached[nh][nw] > d:
            continue
        reached[nh][nw] = d
        l.appendleft((nh, nw))
    for i in range(-2, 3):
        for j in range(-2, 3):
            nh = h + i
            nw = w + j
            if not (0 <= nh <= H-1 and 0 <= nw <= W-1):
                continue
            if not maze[nh][nw] != "#":
                continue
            if not reached[nh][nw] > d + 1:
                continue
            reached[nh][nw] = d + 1
            l.append((nh, nw))

ans = reached[Dh][Dw]
if ans != INF:
    print(ans)
else:
    print(-1)
N,Q = map(int,input().split())
par = [i for i in range(N+1)]
def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x]) #経路圧縮
        return par[x]
def same(x,y):
    return find(x) == find(y)
def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    par[x] = y
for i in range(Q):
    x,y,z=map(int,input().split())
    unite(x,y)
    
for i in range(1,Q+1):
    find(i)
print(len(set(par[1:])))

### FIXED CODE ###

n,m=map(int,input().split())
xy=[[] for _ in range(n+1)]
for _ in range(m):
    x,y,z=map(int,input().split())
    xy[x].append(y)
    xy[y].append(x)

from collections import deque

visited=[0]*(n+1)
count=0

for i in range(1,n+1):
    if visited[i]==0:
        stack=deque()
        stack.append(i)
        visited[i]+=1
        while stack:
            a=stack.pop()
            for j in xy[a]:
                if visited[j]==0:
                    visited[j]+=1
                    stack.append(j)
        count+=1
print(count)
N, K = map(int, input().split(" "))
routs = {}
location = [0 for i in range(N + 1)]
tereporter = list(map(int, input().split()))
for i in range(N):
  routs[i] = tereporter[i] - 1
present_location = 0
n = 0
for i in range(K):
  n += 1
  present_location = routs[present_location]
  if location[present_location] == 0:
    location[present_location] = n
  else:
    break
loop = n - location[present_location]
if (K - location[present_location]) % loop == 0:
  print(present_location + 1)
else:
  for i in range((K - location[present_location]) % loop):
    present_location = routs[present_location]
  print(present_location + 1)



### FIXED CODE ###

N, K = map(int, input().split(" "))
routs = {}
location = [0 for i in range(N + 1)]
tereporter = list(map(int, input().split()))
for i in range(N):
  routs[i] = tereporter[i] - 1
present_location = 0
n = 0
for i in range(K):
  n += 1
  present_location = routs[present_location]
  if location[present_location] == 0:
    location[present_location] = n
  else:
    loop = n - location[present_location]
    if (K - location[present_location]) % loop == 0:
      break
    else:
      for i in range((K - location[present_location]) % loop):
        present_location = routs[present_location]
      break
print(present_location + 1)
N, M, K = map(int, input().split())

for i in range(N+1):
    for j in range(M+1):
        if(i*(M-j)+(N-i)*j == K):
            print("Yes")
            quit()
else:
    print("No")

### FIXED CODE ###

s=input()
if('YAKI' == s[0:4]):
    print('Yes')
else:
    print('No')
N,M = map(int,input().split())
L = []
R = []
for i in range(1,M+1):
  x,y = map(int,input().split())
  L.append(L_val)
  R.append(R_val)
ans = max(min(R) - max(L) + 1,0)
print(ans)

### FIXED CODE ###

N,M = map(int,input().split())
L = []
R = []
for i in range(1,M+1):
  L_val,R_val = map(int,input().split())
  L.append(L_val)
  R.append(R_val)
ans = max(min(R) - max(L) + 1,0)
print(ans)
n = int(input())
a = [int(i) for i in input().split()]
number =1

for i in a:
    if i==0:
        print(0)
        exit()
    number *= i
    if number > 10**18:
            print(-1)
            exit()

print(number)

### FIXED CODE ###

A,B =(int(x) for x in input().split())
print(A*B)
from functools import lru_cache
n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
a=sorted(a)
@lru_cache(maxsize=None) 
def fib(n): 
    if n <= 1:
        return 1
    else:
        return fib(n - 2) + fib(n - 1)
ans=fib(a[0])*fib(n-a[-1])
for i in range(1,m):
  if a[i]-a[i-1]==1:
    print(0)
    exit()
  elif m==1:
    print(ans)
    exit()
  ans=ans*fib(a[i]-a[i-1]-1)
print(ans%1000000007)

### FIXED CODE ###

import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

mod=1000000007
n,m=mp()
dp=[0]*(n+2)
dp[0]=1
for i in range(m):
    a=int(input())
    dp[a]=-1
for i in range(n):
    if dp[i]==-1:
        continue
    if dp[i+1]>=0:
        dp[i+1]+=dp[i]
        dp[i+1]=dp[i+1]%mod
    if dp[i+2]>=0:
        dp[i+2]+=dp[i]
        dp[i+2]=dp[i+2]%mod
print(dp[-2]%mod)
n = int(input())  # nは入力回数
str_list = [input() for _ in range(n)]


a=0
b=0
c=0                
d=0                
                
for num in range(1, n)
    if str_list[num] == 'AC':
    	a += 1
    elif str_list[num] == 'WA':
    	b += 1
    elif str_list[num] == 'TLE':
    	c +=1
    else str_list[num] == 'RE':
    	d +=1
    		continue;

print('AC x'+ a)
print('WA x'+ b)
print('TLE x'+ c)
print('RE x'+ d)


### FIXED CODE ###

N=int(input())

x = N % 1000

Otsuri = 1000-x

if Otsuri == 1000:
  print(0)
else:
  print(Otsuri)
n = int(input())
a = n** 0.5
if n%a == 0:
    print(int(2*a)-2)
else:
    while n%a != 0:
        a = a//1-1 
        if n%a == 0:
            print(int(a + n//a-2))
            exit()

### FIXED CODE ###

n = int(input())
#a,b = map(int,input().split())
#li = list(map(int,input().split()))
li = []
for i in range(1,int(n**0.5//1)+1):
    if n%i == 0:
        li.append(i+n//i-2)
        #print(i,n//i)
if len(li)!=0:
    print(min(li))
else:
    print(n-1)
N,K=map(int,input.split())
TMP=K
ANS=1
if N =< K:
  ANS=1
else:
  TMP=(K-1)
  ANS+=1
  if N <= K:
    break
print(ANS)


### FIXED CODE ###

N,K=map(int,input().split())
TMP=K
ANS=1
if N <= K:
  ANS=1
else:
  while True:
    TMP+=(K-1)
    ANS+=1
    if N <= TMP:
      break
print(ANS)
N,Q=map(int,input().split())
S=[i for i in input()]
t=[0]*(N+1)
for i in range(N):
  t[i+1]=t[i]+(1 if S[i]=='A' and S[i+1]=='C' else 0)
for i in range(Q):
  l,r=map(int, input().split())
  print(t[r-1]-t[l-1])

### FIXED CODE ###

N,Q=map(int,input().split())
S=[i for i in input()]
t=[0]*(N+1)
for i in range(N-1):
  t[i+1]=t[i]+(1 if S[i]=='A' and S[i+1]=='C' else 0)
for i in range(Q):
  l,r=map(int, input().split())
  print(t[r-1]-t[l-1])
n = int(input())
a = set(input().split())

print('YES' if len(s) == n else 'NO')

### FIXED CODE ###

n = int(input())
a = set(input().split())

print('YES' if len(a) == n else 'NO')
a = int(raw_input())
b = int(raw_input())
c = int(raw_input())
print (a+b)*h/2

### FIXED CODE ###

a = int(raw_input())
b = int(raw_input())
c = int(raw_input())
print (a+b)*c/2
A = input()
B = input()
C = input()

#配列の次のカードの文字を返す
def next(X, i):
    if X[i] == 'a':
        return A[i+1]
    elif X[i] == 'b':
        return B[i+1]
    else:
        return C[i+1]

xa = 0
xb = 0
xc = 0

h = 'A'
k = next(A, xa) #最初
xa += 1

while xa < len(A) and xb <len(B) and xc < len(C):
    if k == 'a':
        h = 'A'
        k = next(A, xa)
        xa += 1
    elif k == 'b':
        h = 'B'
        k = next(B, xb)
        xb += 1
    else:
        h = 'C'
        k = next(C, xc)
        xc += 1

print(h)


### FIXED CODE ###

A = input()
B = input()
C = input()

xa = 0
xb = 0
xc = 0

h = 'A'
k = A[0] #最初の１枚を抜く
xa += 1

while True:

    if k == 'a':
        h = 'A'
        if xa < len(A):
            k = A[xa]
            xa += 1
        else:
            break
    elif k == 'b':
        h = 'B'
        xb += 1
        if xb < len(B):
            k = B[xb]
            xb += 1
        else:
            break
    elif k == 'c':
        h = 'C'
        xc += 1
        if xc < len(C):
            k = C[xc]
            xc += 1
        else:
            break

print(h)
s = inport()
print("ABC" if s=="ARC" else "ARC")

### FIXED CODE ###

s = input()
print("ABC" if s=="ARC" else "ARC")
# coding: utf-8

s = int(input())

i = 0
while n > 0:
    if n % 2 == 0:
        n = n / 2
    else:
        n = 3n+1
    if n == 4:
        break
    else:
        i += 1

print(i+4)

### FIXED CODE ###

# coding: utf-8

n = int(input())

i = 1
while n > 0:
    if n == 4 or n == 2 or n == 1:
        break
    i += 1
    if n % 2 == 0:
        n = n / 2
    else:
        n = n*3+1

print(i+3)
t = input()
o = ""
for i in range(len(t)):
    if t[i] == "?":
        if i != 0 and t[i - 1] == "P":
            o += "D"
        elif i != len(t) and t[i + 1] == "D":
            o += "P"
        else:
            o += "D"
    else:
        o += t[i]

print(o)

### FIXED CODE ###

print(input().replace('?','D'))
from collections import Counter
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]

counter = Counter(((b1[0] - b2[0], b1[1] - b2[1]) for b1 in xy for b2 in xy if b1 != b2))
print(N - counter.most_common()[0][1])


### FIXED CODE ###

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

dic = dict()
for cx, cy in xy:
    for x, y in xy:
        if cx != x or cy != y:
            w = (x-cx,y-cy)
            if dic.get(w) is None:
                dic[w] = 0
            dic[w] += 1

cnt = 1
m = 0
for x in dic:
    m = max(m, dic[x])
cnt += N - 1 - m
print(cnt)
a=int(input())
b=int(input())
c=int(input())
if a==b or b==c or a==c:
    if not(a==b and b==c):
        print("Yes")
    else:
        print("No")
else:
    print("No")

### FIXED CODE ###

n = list(map(int,input().strip().split()))

c1 = n.count(n[0])
c2 = n.count(n[1])
if c1==2 or c2 == 2:
  print('Yes')
else:
  print("No")
s=split(input())
a=int(s[0])
b=int(s[1])
x=a*b
y=2*(a+b)
print(x,y)

### FIXED CODE ###

a,b=input().split()
a=int(a)
b=int(b)
print(a*b,2*a+2*b)
rt re
s=input()
m=re.match(r'A*KIHA*BA*RA*',s)
if m!=None:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

import re
s=input()
m=re.match(r'A?KIHA?BA?RA?$',s)
if m!=None:
    print("YES")
else:
    print("NO")