Harryxun/stf_run huggingface dataset:
import collections
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=[1]
now=0
passed = set()
for i in range(n+1):
    if a[now] in passed:
        ans.append(a[now])
        break
    else:
        ans.append(a[now])
        passed.add(a[now])
        now=a[now]-1
#print(ans)
#変更
passed = set()
index = ans[:-1].index(ans[-1])
index_1 = len(ans)-2
#print(index)
#print(index_1)
print(ans[(k-index-1)%(index_1-index)+index])



### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
n,k = map(int, input().split())
a = list(map(int, input().split()))
adjacent_list = [[] for i in range(n+1)]
for i in range(n):
    adjacent_list[i+1].append(a[i])
finished = set()
route = []
def dfs(node):
    finished.add(node)
    route.append(node)
    for i in adjacent_list[node]:
        if i not in finished:
            dfs(i)
dfs(1)
if len(route) > k:
    print(route[k])
else:
    index = route.index(adjacent_list[route[-1]][0])
    k -= index
    route = route[index:]
    print(route[k % len(route)])
n=int(input())
A=list(map(int,input().split()))
f=0
g=1
for i in range(0,n):
    if A[i]!=g:
      f++
    else:
      g++
    #printf("%d %d\n",f,g)
if g!=1:
    print(f)
else:
    print(-1)
 

### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
#print(A)
f=0
g=1
for i in range(0,n):
    if A[i]!=g:
        f+=1
    else:
        g+=1
#printf("%d %d\n",f,g)
if g!=1:
    print(f)
else:
    print(-1)
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
for i in range(n):
  if i==0:
    s+=b[a[0]]
  elif a[i]==a[i-1]+1:
    s=s+b[a[i]]+c[a[i-1]]
  else:
    s=s+b[a[i]]
print(s)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
for i in range(n):
  if i==0:
    s+=b[a[0]-1]
  elif a[i]==a[i-1]+1:
    s=s+b[a[i]-1]+c[a[i]-2]
  else:
    s=s+b[a[i]-1]
print(s)
def op_print(data,a,b):
    for i in range(a,b+1):
        print(data[i])
def op_reverse(data,a,b):
    return data[:a] + data[::-1][-b:-a] + data[:b]
def op_replace(data,a,b,q):
    return data.replace(data[a:b],q) 

data = input()
q = int(input())
for _ in range(q):
    op = list(map(str,input().split()))
    if(op[0] == "print"):
        op_print(data,int(op[0]),int(op[1]))
    elif(op[0] == "reverse"):
        data = op_reverse(data,int(op[0]),int(op[1]))
    elif(op[0] == "replace"):
        data = op_replace(data,int(op[0]),int(op[1]),op[2])


### FIXED CODE ###

s=input()
for _ in range(int(input())):
    o=input().split()
    a,b=map(int,o[1:3]);b+=1
    c=o[0][2]
    if c=='p':s=s[:a]+o[3]+s[b:]
    elif c=='i':print(s[a:b])
    elif c=='v':s=s[:a]+s[a:b][::-1]+s[b:]
tt,ta,at,aa=map(int,input().split())
 
for i in range(100):
 at-=ta 
 if at-ta>0:
    pass
 elif at-ta<=0:
    print("Yes")
    exit
 tt-=aa
 elif tt-aa>0:
    pass
 elif tt-aa<=0:
    print("No")

### FIXED CODE ###

tt,ta,at,aa=map(int,input().split())
 
for i in range(100):
 at-=ta 
 if at>0:
    pass
 elif at<=0:
    print("Yes")
    exit()
 tt-=aa
 if tt>0:
    pass
 elif tt<=0:
    print("No")
    exit()
import math
from fractions import gcd

def number_calc(A,B,x):
    left = math.ceil(A/x)
    right = math.floor(B/x)
    res = max(right-left+1,0)
    return res

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

ans = B-A+1
ans -=number_calc(A,B,C)
ans -=number_calc(A,B,D)
ans +=number_calc(A,B,(C*D)/math.gcd(C,D))

print(ans)



### FIXED CODE ###

import math
from fractions import gcd


A,B,C,D = map(int,input().split())
lcm = C//gcd(C,D)*D
ans = B - B//C - B//D + B//lcm
a = A-1
ans -= a - a//C - a//D + a//lcm 

print(ans)
from collections import Counter
n= int(input())
xy=[[int(x) for x in input().split()] for _ in range(n)]
gr = [[[0,0]for _ in range(n)]for _ in range(n)]
for i in range(n):
  a,b = xy[i]
  for j in range(n):
    gr[i][j] = [abs(xy[j][0]-a),abs(xy[j][1]-b)]
gr1 = []
for i in gr:
  for j in i:
    gr1.append(tuple(j))
#print(gr1)
c = Counter(gr1)
l,f = c.most_common()[0]
if l!=(0,0):
  print(n-f//2)
else:
  l,f = c.most_common()[1]
  print(n-f//2)

### FIXED CODE ###

from collections import Counter
n= int(input())
if n==1:
  print(1)
  exit()
xy=[[int(x) for x in input().split()] for _ in range(n)]
gr = [[[0,0]for _ in range(n)]for _ in range(n)]
for i in range(n):
  a,b = xy[i]
  for j in range(n):
    gr[i][j] = [xy[j][0]-a,xy[j][1]-b]
gr1 = []
for i in gr:
  for j in i:
    gr1.append(tuple(j))
#print(gr1)
c = Counter(gr1)
l,f = c.most_common()[0]
if l!=(0,0):
  print(n-f)
else:
  l,f = c.most_common()[1]
  print(n-f)
n = input()
s = input()
flag = 0
for i in range(1,int(n)-1):
	if s[i-1]+s[i]+[i+1] = "ABC"
    	flag += 1
print(flag)      

### FIXED CODE ###

N = int(input())
S = input()
print(S.count("ABC"))
x = input().split()

a = int(x[0])
b = int(x[1])

print((a * b),(a + b) * 2))

### FIXED CODE ###

x = input().split()

a = int(x[0])
b = int(x[1])

print((a * b),((a + b) * 2))
n = int(input())

f = [0] * 1001

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            s = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if s <= 1000:
                f[s] += 1

for i in range(n):
    print(f[i+1])

### FIXED CODE ###

n = int(input())

f = [0] * (n+1)

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            s = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if s < n + 1:
                f[s] += 1

for i in range(n):
    print(f[i+1])
menu = [0]*5
md = 300
time = 0
for i in range(5):
    menu[i] = int(input())
for i in range(5):
    if(((menu[i]%10)<md)and(menu[i]%10)!=0):
        md = menu[i]
        index = i
#        print(md,index)
menu.pop(index)
for i in range(4):
    hoge = menu[i] % 10
    if hoge != 0:
        time = time + menu[i] + (10 - hoge)
    else:
        time = time + menu[i]

time  = time + md
print(time)

### FIXED CODE ###

A=[int(input())for _ in[0]*5]
B=[-(-a//10)*10-a for a in A]
print(sum(B)+sum(A)-max(B))
s = input()
cnt=0
for i in range(len(s)-3):
    for j in range(i+4,len(s)):
        if int(s[i:j+1]) % 2019 == 0:
            cnt+= 1
print(cnt)

### FIXED CODE ###

s,w = map(int,input().split())
if w>=s:
    print("unsafe")
else:
    print("safe")
N=int(input())

if N%2==0:
  print(0.5)
else:
  print((N+1)/2*n)

### FIXED CODE ###

N=int(input())
if N%2==0:
  print(0.5)
else:
  print((N+1)/(2*N))
import math
import numpy as np
A,B,N=map(int,input().split())
range_list=list(range(0,N+1))
data2 = np.array(list(map(lambda x: A*math.floor(x/B), range_list)))
data1 = np.array(list(map(lambda x: math.floor(A*x/B), range_list)))

print(max(data1-data2))


### FIXED CODE ###

A,B,N=map(int,input().split())
if B<=N:
    print(int(A*(B-1)/B)-A*int((B-1)/B))
else:
    print(int(A*(N)/B)-A*int(N/B))
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

S_A = [0] * (N + 1)
S_B = [0] * (N + 1)
for i in range(N):
  S_A[i+1] = S_A[i] + A[i]

for i in range(M):
  S_B[i+1] = S_B[i] + B[i]
  
ans = 0
a = 0
for i in range(M, -1, -1):
  s = S_B[i]
  while a<N:
    if s + S_A[a + 1]<=K:
      a += 1
    else:
      break
  ans = max(ans, i + a)
print(ans)

### FIXED CODE ###

N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
S = 0
ans = 0
for i in range(M):
  S += B[i]
  if S > K:
    b = i - 1
    S -= B[i]
    break
  else:
    ans += 1
    if i==M-1:
      b = M-1
if b==0:
  ans = 0
  S = 0
  for a in A:
    if S + a <= K:
      S += a
      ans += 1
    else:
      break
  if S + B[0]<=K:
    ans+=1
  print(ans)
else:
  a = 0
  max_ans = ans
  while a<N:
    if S + A[a] <= K:
      S += A[a]
      ans += 1
      a += 1
    else:
      break
  max_ans = max(max_ans, ans)
  for j in range(b, -1, -1):
    S -= B[j]
    ans -= 1
    while a<N:
      if S + A[a] <= K:
        S += A[a]
        ans += 1
        a += 1
      else:
        break
      
    max_ans = max(max_ans, ans)
  print(max_ans)
S=input()
K=input()
if l>=int(S):
    print(K[:1]+'...')
else:
    print(K)

### FIXED CODE ###

S=int(input())
K=input()
k=len(K)

if k>S:
    print(K[:S]+'...')
else:
    print(K)
a = input()
b = input()
if int(a) * int(b) % 2 == 0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a,b=map(int,input().split())
if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")
import math

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))

### FIXED CODE ###

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

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

#最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)
print(lcm(A,B))
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
al = sum(l)-l[:n-k]
print(al)

### FIXED CODE ###

n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
al=sum(l)
for i in range(n-k):
    al -= l[i]
print(al)
import sys
input = sys.stdin.readline

from collections import deque

# 伸ばせる限り伸ばせば答

N,M = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

path = deque(AB[0])
visited = set(AB[0])

while True:
    x = path[0]
    update = False
    for y in graph[x]:
        if y not in visited:
            path.appendleft(y)
            visited.add(y)
            update = True
            break
    if update:
        continue
    x = path[-1]
    for y in graph[x]:
        if y not in visited:
            path.append(y)
            visited.add(y)
            update = True
            break
    if update:
        continue
    break

print(len(path))
print(*path)

### FIXED CODE ###

import sys
input = sys.stdin.readline

from collections import deque

# 伸ばせる限り伸ばせば答

N,M = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(M)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

path = deque(AB[0])
visited = set(AB[0])

while True:
    x = path[0]
    update = False
    for y in graph[x]:
        if y not in visited:
            path.appendleft(y)
            visited.add(y)
            update = True
            break
    if not update:
        break
while True:
    x = path[-1]
    update = False
    for y in graph[x]:
        if y not in visited:
            path.append(y)
            visited.add(y)
            update = True
            break
    if not update:
        break

print(len(path))
print(*path)
N=int(input())
A = list(map(int, input().split()))

if N==2:
    print(1)
    print(0)
else:
    from collections import deque
    da=deque(A)
    
    import numpy as np
    ansl=np.array([0]*N)
    
    for i in range(N-1):
        ansl[da.pop()-1]+=1
    
    for i in ansl:
        print(i)

### FIXED CODE ###

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

if N==2:
    print(1)
    print(0)
else:
    from collections import deque
    da=deque(A)
    
    import numpy as np
    ansl=np.array([0]*N)
    
    for i in range(N-1):
        ansl[da.pop()-1]+=1
    
    for i in ansl:
        print(i)
n = int(input())
s = input()
if n%2 != 0 or n == 1:
  prtin("No")
elif s[:int(n/2)] == s[int(n/2):]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())
s = input()
if n%2 != 0 or n == 1:
  print("No")
elif s[:int(n/2)] == s[int(n/2):]:
  print("Yes")
else:
  print("No")
n , x = map(int,input().split())

field = [int(i) for i in input().split()]

diff = list(map(lambda a:abs(a-x),field))

def gcd(x,y):

    if x < y:
        x,y = y,x

    if x % y == 0:
        return y
    else:
        gcd(y,x%y)

ans = diff[0]


for i in diff[1:]:
    ans = gcd(i,ans)

print(ans)

### FIXED CODE ###

h,w = map(int,input().split())

a = [[int(i) for i in input().split()] for _ in range(h)]

total = 0

ans = []

for i,row in enumerate(a):
    for j,cell in enumerate(row):
        if(cell % 2 == 0):
            continue
        
        if(i == h - 1 and j == w -1):
            break
        
        if(j != w - 1):
            a[i][j+1] += 1
            ans.append([i+1,j+1,i+1,j+2])
            total += 1
        elif(i != h - 1):
            a[i+1][j] += 1
            ans.append([i+1,j+1,i+2,j+1])
            total += 1

        
print(total)

for a in ans:
    print(*a)
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n=input()
print(n*n*n)

### FIXED CODE ###

import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n=int(input())
print(n*n*n)
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0

for a in range(a+1):
    for b in range(b+1):
        for c in range(c+1):
            if (500*a + 100*b + 50*c) == x:
            count += 1

print(count)



### FIXED CODE ###

a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)
import sys,io
from functools import lru_cache
 
#read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def read():
  return int(readline())
def reads():
  return map(int, readline().split())
def mp(arg):
  return map(int,arg.split())
n=read()
h=list(reads())
@lru_cache(None)
def cost(k):
    if k==0:
        return 0
    elif k==1:
        return abs(h[0]-h[1])
    return min(cost(k-1)+abs(h[k-1]-h[k]),cost(k-2)+abs(h[k-2]-h[k]))
print(cost(n-1))

### FIXED CODE ###

import sys,io
from functools import lru_cache
#read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**6)
def read():
  return int(readline())
def reads():
  return map(int, readline().split())
def mp(arg):
  return map(int,arg.split())
n=read()
h=list(reads())
@lru_cache(None)
def cost(k):
    if k==0:
        return 0
    elif k==1:
        return abs(h[0]-h[1])
    return min(cost(k-1)+abs(h[k-1]-h[k]),cost(k-2)+abs(h[k-2]-h[k]))
print(cost(n-1))
a,b=map(int,input().split())
c=0
for i in range(a,b+1):
	o=str(i)
  	if o==o[::-1]:c+=1
print(c)



### FIXED CODE ###

a,b=map(int,input().split())
c=0
for i in range(a,b+1):
  o=str(i)
  if o==o[::-1]:
    c+=1
print(c)
import sys
from collections import Counter
from math import gcd


MOD = 10 ** 9 + 7


def prepare(n):
    global MOD
    modFacts = [0] * (n + 1)
    modFacts[0] = 1
    for i in range(n):
        modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD

    invs = [1] * (n + 1)
    invs[n] = pow(modFacts[n], MOD - 2, MOD)
    for i in range(n, 1, -1):
        invs[i - 1] = (invs[i] * i) % MOD

    return modFacts, invs


def profile(fish):
    x, y = fish
    GCD = gcd(abs(x), abs(y))

    return (abs(x // GCD), abs(y // GCD), int((x >= 0) ^ (y >= 0)))


N = int(input())
F = [tuple(map(int, s.split())) for s in sys.stdin.readlines()]
modFacts, invs = prepare(N)
B = [tuple(profile(f)) for f in F]

C0 = Counter()
C1 = Counter()
zero = 0
for f in F:
    if f == (0, 0):
        zero += 1
    else:
        x, y, flag = profile(f)
        if x == 0:
            C0[(0, 1, 0)] += 1
            C1[(0, 1, 0)] += 1
        elif y == 0:
            C0[(0, 1, 0)] += 1
            C1[(1, 0, 1)] += 1
        else:
            C1[(x, y, flag)] += 1
            if flag:
                x, y = y, x
                flag = 0
            C0[(x, y, flag)] += 1

ans = 1
for x, y, flag in C0.keys():
    b = C1[(y, x, flag ^ 1)]
    a = C0[(x, y, flag)] - b
    cnt = (pow(2, a, MOD) - 1) + (pow(2, b, MOD) - 1) + 1
    ans *= cnt
    ans %= MOD
ans -= 1
print(ans % MOD)


### FIXED CODE ###

import sys
from collections import Counter
from math import gcd


MOD = 10 ** 9 + 7


def prepare(n):
    global MOD
    modFacts = [0] * (n + 1)
    modFacts[0] = 1
    for i in range(n):
        modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD

    invs = [1] * (n + 1)
    invs[n] = pow(modFacts[n], MOD - 2, MOD)
    for i in range(n, 1, -1):
        invs[i - 1] = (invs[i] * i) % MOD

    return modFacts, invs


def profile(fish):
    x, y = fish
    GCD = gcd(abs(x), abs(y))

    return (abs(x // GCD), abs(y // GCD), int((x >= 0) ^ (y >= 0)))


N = int(input())
F = [tuple(map(int, s.split())) for s in sys.stdin.readlines()]
modFacts, invs = prepare(N)

C0 = Counter()
C1 = Counter()
zero = 0
for f in F:
    if f == (0, 0):
        zero += 1
    else:
        x, y, flag = profile(f)
        if x == 0:
            C0[(0, 1, 0)] += 1
            C1[(0, 1, 0)] += 1
        elif y == 0:
            C0[(0, 1, 0)] += 1
            C1[(1, 0, 1)] += 1
        else:
            C1[(x, y, flag)] += 1
            if flag:
                x, y = y, x
                flag = 0
            C0[(x, y, flag)] += 1

ans = 1
for x, y, flag in C0.keys():
    b = C1[(y, x, flag ^ 1)]
    a = C0[(x, y, flag)] - b
    cnt = (pow(2, a, MOD) - 1) + (pow(2, b, MOD) - 1) + 1
    ans *= cnt
    ans %= MOD
ans -= 1
ans += zero
print(ans % MOD)
A,B,C = map(int, input().split())
if A+B >= C:
  print('Yes')
else:
  print('No)

### FIXED CODE ###

A,B,C = map(int, input().split())
if A+B >= C:
  print('Yes')
else:
  print('No')
N,Q = map(int,input().split()) #Nマス Q呪文回数
s = input()
g_num = [1 for i in range(N)]

def sposi(t):
    s_list = []
    s_size = len(s)
    for ss in range(s_size):
        if s[ss]==t:
            s_list.append(ss)
    return s_list
  
for q in range(Q):
    t,d = map(str,input().split())
    s_posi = sposi(t)
    for k in s_posi:
      	if g_num[k]!=0:
            if k==0 and d=='L':
                g_num[k]-=1
            elif (k==N-1 or k==-1) and d=='R':
                g_num[k]-=1
            elif d=='L':
                g_num[k]-=1
                g_num[k-1]+=1
            elif d=='R':
                g_num[k]-=1
                g_num[k+1]+=1
golem = 0
for i in range(len(g_num)):
    golem+= g_num[i]
print(golem)

### FIXED CODE ###

list = list(map(int,input().split()))
if len(set(list)) == 1:
    print('Yes')
else:
    print('No')
N = int(input())
l = [[int(j) for j in input().split()] for i in range(N)]
l = sorted(l, lambda x:x[1])
s = 0
ans = 'Yes'
for a,b in l:
    s += a
    if s > b:
        ans = 'No'
        break

print('Yes')

### FIXED CODE ###

N = int(input())
l = [[int(j) for j in input().split()] for i in range(N)]
l = sorted(l, key=lambda x:x[1])
s = 0
ans = 'Yes'
for a,b in l:
    s += a
    if s > b:
        ans = 'No'
        break

print(ans)
s, t = input().split()
a. b = map(int, input().split())
u = input()

if s == u:
  print("{} {}".format(a-1, b))
else:
  print("{} {}".format(a, b-1))


### FIXED CODE ###

s, t = input().split()
a, b = map(int, input().split())
u = input()

if s == u:
  print("{} {}".format(a-1, b))
else:
  print("{} {}".format(a, b-1))
import numpy as np

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

dp = np.zeros(W + 1, dtype = np.int64)

for i in range(N):
    w, v = map(int, input().split())
    dp[w:] = np.maximum(dp[w:], dp[:-w] + v)

    print(dp.max())
    


### FIXED CODE ###

import numpy as np

N, W = map(int, input().split())
a = [list(map(int,input().split())) for _ in range(N)]
vmax = sum([a[i][1] for i in range(N)])
INF = float('inf')
dp = np.full(vmax+1, INF)
dp[0] = 0

for i in range(N):
  w, v = a[i-1]
  dp[v:] = np.minimum(dp[v:], dp[:-v]+w)
print(max([i for i in range(vmax+1) if dp[i] <= W]))
from collections import defaultdict
N = int(input())
A = [int(i) for i in input().split()]
A.sort(reverse=True)
d = defaultdict(int)
ls = []
for x in A:
    d[x] += 1
    if d[x] == 2:
        ls.append(x)
        if len(ls) == 2:
            break
    elif d[x] == 4:
        ls.append(x)
        break
if len(ls) == 2:
    print(ls[0]*ls[1])
else:

### FIXED CODE ###

from collections import defaultdict
N = int(input())
A = [int(i) for i in input().split()]
A.sort(reverse=True)
d = defaultdict(int)
ls = []
for x in A:
    d[x] += 1
    if d[x] == 2:
        ls.append(x)
        if len(ls) == 2:
            break
    elif d[x] == 4:
        ls.append(x)
        break
if len(ls) == 2:
    print(ls[0]*ls[1])
else:
    print(0)
N=input()
n=int(N)

p=[]
for i in range(n):
    p.append(input())

ha = {}

for i in p :
    if (i not in ha.keys()) :
        ha[i] = 1
    else :
        ha[i] += 1

res = ha.items()

res = sorted(ha.items(), key = lambda x : x[1] , reverse = True )

i = 1
k = res[0][1]

while (i < len(res) and res[i][1] == k) :
    i += 1

res = res[ : i]

res.sorted()
for i in res :
    print (i[1])

### FIXED CODE ###

n = int(input())
dic = {}
for i in range(n):
    s = input()
    try:
        dic[s] += 1
    except:
        dic[s] = 1
high=max(dic.values())
val= sorted(dic.items())
for i in val:
    if(i[1]==high):
        print(i[0])
a,b,c=map(str,input().split());print((a[0]+b[0]+v[0]).upper())

### FIXED CODE ###

a,b,c=map(str,input().split());print((a[0]+b[0]+c[0]).upper())
a, b = map(int, input())

if a - 2*b >= 0:
  print(a - 2*b)
else:
  print(0)

### FIXED CODE ###

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

if a - 2*b >= 0:
  print(a - 2*b)
else:
  print(0)
N = int(input())
H = list(map(int, input().split())) 
H.reverse()

ans = 0
arr = []

for i in range(N-1):
    if H[i+1] >= H[i]:
        ans += 1
    else:
        arr.append(ans)
        ans = 0

print(max(arr))

### FIXED CODE ###

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

ans = 0
cnt = 0

for i in range(N-1):
    if H[i] < H[i+1]:
        cnt = 0
    else:
        cnt += 1
    ans = max(cnt, ans)

print(ans)
N,M = map(int,input().split())
Xlist = [int(_) for _ in input().split()]
Xlist.sort()

answer = 0

max_difflist = []
salist = []
ilist = []
flg = 0
for i in range(M-1):
    if flg == 1:
        min_n = min(max_difflist)
    else:
        min_n = -1
    sa = abs(Xlist[i]-Xlist[i+1])

    salist.append(sa)


    if len(max_difflist) < N-1:
        flg = 1
        ilist.append(i)
        max_difflist.append(sa)
    elif sa > min_n:
        max_difflist.sort(reverse=True)
        index = max_difflist.index(min_n)
        max_difflist[index] = sa
        ilist[index] = i


for i_ in ilist:
    salist[i_] = 0

print(sum(salist))


### FIXED CODE ###

N, M = map(int, input().split())
Xlist = sorted(list(map(int, input().split())))
Llist = []
for i in range(M - 1):
    Llist.append(Xlist[i + 1] - Xlist[i])
Llist.sort()
print(sum(Llist[:M - N]) if N < M else 0)
N,K = map(int,input().split())
S = input() + "#"
A = []
cnt = 1
for i in range(N) :
    if S[i] == S[i+1] :
        cnt += 1
    else :
        A.append(cnt)
        cnt = 1

if S[0] == "1" :
    ans = sum(A[:2*K+1])
    calc = ans
    for i in range(2*K+1, len(A)) :
        calc += A[i]
        if i % 2 == 1 :
            calc -= (A[i-1-2*K] + A[i-2*K])
        ans = max(ans, calc)
else :
    ans = sum(A[:2*K])
    for i in range(2*K,len(A)) :
        calc += A[i]
        if i == 2*K :
            calc -= A[0]
        elif i % 2 == 0  :
            calc -= (A[i-1-2*K] + A[i-2*K])
        ans = max(ans, calc)

print(ans)


### FIXED CODE ###

N,K = map(int,input().split())
S = input() + "#"
A = []
cnt = 1
for i in range(N) :
    if S[i] == S[i+1] :
        cnt += 1
    else :
        A.append(cnt)
        cnt = 1

if S[0] == "1" :
    ans = sum(A[:2*K+1])
    calc = ans
    for i in range(2*K+1, len(A)) :
        calc += A[i]
        if i % 2 == 1 :
            calc -= (A[i-1-2*K] + A[i-2*K])
        ans = max(ans, calc)
else :
    ans = sum(A[:2*K])
    calc = ans
    for i in range(2*K,len(A)) :
        calc += A[i]
        if i == 2*K :
            calc -= A[0]
        elif i % 2 == 0  :
            calc -= (A[i-1-2*K] + A[i-2*K])
        ans = max(ans, calc)

print(ans)
c=list(input())
s=""
for i in c:
    if i=="B" and len(s)==0:
        pass
    elif i=="B":
        del(s[-1])
    elif i=="0":
        s+="0"
    else:
        s+="1"
print(s)

### FIXED CODE ###

c=list(input())
s=""
for x in c:
    if x!="B":
        s+=x
    else:
        s=s[:-1]
print(s)