Harryxun/stf_run huggingface dataset:
N, C, K = map(int, input().split(" "))
T = sorted([int(input()) for _ in range(N)])

bus = 1
key = T[0]
pas = 0
for i in range(N):
    if T[i] - key > K:
        bus += 1
        key = T[i]
        pas = 0
    else:
        pas += 1
        if pas == C:
            bus += 1
            key = T[i+1]
            pas = 0
print(bus)

### FIXED CODE ###

N, C, K = map(int, input().split(" "))
T = sorted([int(input()) for _ in range(N)])

bus = 0
i = 0
while i < N:
    bus += 1
    start = i
    while i < N and T[i] - T[start] <= K and i - start < C:
        i += 1
print(bus)
x = input()
if x == 'a' || x == 'i' || x == 'u'||x=='e'||x=='o':
  print ('vowel')
else
  print ('consonant')

### FIXED CODE ###

x = input()
if x == 'a' or x == 'i' or x == 'u' or x=='e' or x=='o':
  print ('vowel')
else:
  print ('consonant')
from collections import Counter

_ = int(input())
s = input()
counter = Counter(s)
red = counter.get('R')
white = counter.get('W')

mismatches = 0
for i in range(red):
    if s[i] != 'R':
        mismatches += 1

print(mismatches)



### FIXED CODE ###

from collections import Counter

_ = int(input())
s = input()
counter = Counter(s)
red = counter.get('R', 0)
white = counter.get('W', 0)

mismatches = 0
for i in range(red):
    if s[i] != 'R':
        mismatches += 1

print(mismatches)
s1 = "maerd"
s2 = "remaerd"
s3 = "esare"
s4 = "resare"

i = input()
s = ''
for c in reversed(i):
    s += c

l = len(s)

i = 0


def dfs(i):
    if i == l:
        print("YES")
        exit()
    if i+5 <= l and s[i:i+5] == s1:
        dfs(i+5)
    elif i+7 <= l and s[i:i+7] == s2:
        dfs(i+7)
    elif i+5 <= l and s[i:i+5] == s3:
        dfs(i+5)
    elif i+6 <= l and s[i:i+6] == s4:
        dfs(i+6)
    else:
        print("NO")
        exit()


dfs(0)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

s = input()
l = len(s)


def dfs(i):
   #    print("->", s[i:])
    if i == l:
        print("YES")
        exit()
    if s[i:i+5] == "dream":
        if i+6 < l and s[i+5:i+7] == "er":
            dfs(i+7)
        dfs(i+5)
    elif s[i:i+5] == "erase":
        if i+5 < l and s[i+5] == "r":
            dfs(i+6)
        dfs(i+5)


dfs(0)
print("NO")
n=int(input())
s=list(input())
k=int(input())
s_k=s[k-1]
for i in range(n):
  if s[i]!=s_k:
    s[i]="*"
print("".join(s))

### FIXED CODE ###

a, b, c=map(int,input().split())
if a<=c<=b or b<=c<=a:
  print("Yes")
else:
  print("No")
n = int(input())
b = list(map(int,input().split()))
p = []

for i in range(n):
    nn = len(b)
    for j in range(nn-1,-1,-1):
        if b[j] == j+1:
            b = b[:j]+b[j+1:]
            p.append(c[j])
            break
            
if b == []:
    for i in range(n-1,-1,-1):
        print(p[i])
else:
    print(-1)

### FIXED CODE ###

n = int(input())
b = list(map(int,input().split()))
p = []

for i in range(n):
    nn = len(b)
    for j in range(nn-1,-1,-1):
        if b[j] == j+1:
            p.append(b[j])
            b = b[:j]+b[j+1:]
            break
            
if b == []:
    for i in range(n-1,-1,-1):
        print(p[i])
else:
    print(-1)
import sys
sys.setrecursionlimit(10**9)
def input():
    return sys.stdin.readline().rstrip()

def main():
    W,H,x,y=map(int,input().split())
    S=W*H/2
    b=1 if x==W//2 and y==H//2 else 0
    print(f'%s %s' % (S, b))

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
def input():
    return sys.stdin.readline().rstrip()

def main():
    W,H,x,y=map(int,input().split())
    S=W*H/2
    b=1 if x==W/2 and y==H/2 else 0
    print(str(S)+' '+str(b))

if __name__ == '__main__':
    main()
A, B = map(int, input().split())

judge=0
for i in range(1,4):
	if (j+k+i)*2==1:
      judge=1
if judge==1:
  print ("Yes")
else:
  print ("No")

### FIXED CODE ###

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

judge=0
for C in range(1,4):
  if (A*B*C)%2==1:
    judge=1

if judge==1:
  print ("Yes")
else:
  print ("No")
X=int(input())
n=0
while n<10**9:
    A=X-(n**5)
    check=(A**0.2)**5
    if(int(check)==check):
        AnsA=A**0.2
        AnsB=-n
        print(str(int(AnsA))+" "+str(int(AnsB)))
        break
    else:
        n=n+1

### FIXED CODE ###

X=int(input())

for A in range(-1000,1000):
    for B in range (-1000,1000):
        if(A**5-B**5==X):
            print(A,B)
            break
    else:
        continue
    break
A, B = int(input().split())
print(A, B)

### FIXED CODE ###

A, B = list(map(int, input().split()))
print(A*B)
from collections import Counter
N = int(input())
A = list(map(int, input().split())) 
ans = set(A)
watched = set()
for k, v in Counter(A).items():
    if v != 1:
        ans.remove(k)
    temp = {k*i for i in range(2,10**6//k + 1)}
    ans -= ans&temp
print(len(ans))

### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int, input().split())) 
ans = set(A)
for k, v in Counter(A).items():
    if v != 1:
        ans.discard(k)
    temp = {k*i for i in range(2,10**6//k + 1)}
    ans -= ans&temp
print(len(ans))
from bisect import bisect
N = int(input())
sides = sorted(map(int, input().split()))
print(sum(N - j - bisect(sides, sides[-i] - sides[-j], hi=N-j) for j in range(i + 1, N + 1) for i in range(1, N - 1)))


### FIXED CODE ###

from bisect import bisect
N = int(input())
sides = sorted(map(int, input().split()))

ans = 0
for i in range(1, N - 1):
    for j in range(i + 1, N + 1):
        ans += N - j - bisect(sides, sides[-i] - sides[-j], hi=N-j)
print(ans)
N=int(input())
temp=input().split()
A=[int(temp[i]) for i in range(N)]

A=[A[-1]]+A

for i in range(N):
  print(mean(A[i:1+2]))

### FIXED CODE ###

N=int(input())
temp=input().split()
A=[int(temp[i]) for i in range(N)]
As=[]
As.append(sum([A[i]*pow(-1, i) for i in range(N)]))
for i in range(1, N):
  As.append(A[i-1]-As[i-1])

x1=As[0]/2
print(int(2*x1), end=' ')

for i in range(1, N):
  print(2*int(As[i]-x1*pow(-1, i)), end=' ')
import statistics

N = int(input())
A = [int(c) for c in input().split()]
A = [abs(n - (b+i+1)) for i, n in enumerate(A)]

b = int(statistics.median(A))
print(sum([abs(n - b) for n in A]))

### FIXED CODE ###

import statistics

N = int(input())
A = [int(c) for c in input().split()]
A = [n - (i+1) for i, n in enumerate(A)]

b = int(statistics.median(A))
print(sum([abs(n - b) for n in A]))
N = int(input())
S = input()
stock = []
#INF = 10**9
for i in range(1,len(S)-1):
  if (S[i-1] == "E") & (S[i+1] == "W"): stock.append(i)

dic = {k:0 for k in stock}
dic[0]＝ S.count("E")
dic[len(S)-1] = S.count("W")

for i in stock:
  for j in range(i-1,0,-1):
    if j < 0: break
    else:
      if S[j] == "E" : dic[i] += 1
      else: break

  for j in range(i+1, len(S)):
    if j > len(S)-1: break
    else:
      if S[j] == "W" : dic[i] += 1
      else: break

max_k = max(dic, key=dic.get)


count = 0
for i in range(0,max_k):
  if S[i] == "W": count += 1

for i in range(max_k+1, len(S)):
  if S[i] == "E": count += 1




print(count)

### FIXED CODE ###

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

sum_w = [0]
sum_e = [0]

count = 0
for i in range(N-1):
  if S[i] == "W":
    count += 1
  sum_w.append(count)

count = 0
for i in range(N-1,0,-1):
  if S[i] == "E": 
    count += 1
  sum_e.append(count)
sum_e = sum_e[::-1]

#print(len(sum_e), len(sum_w))
sumu = [x+y for x, y in zip(sum_w, sum_e)]

print(min(sumu))
A = map(int,input())
B = map(int,input())
if 1 <= A <= 9 and 1<= B <= 9:
	print(A*B)
else:
	print(-1)

### FIXED CODE ###

a,b=map(int,input().split())
if 1<=a<=9 and 1<=b<=9:
  print(a*b)
else:
  print(-1)
x = l_a.pop(0)
ans=0
while ans==0:
    if x == "a":
        if len(l_a) != 0: x = l_a.pop(0)
        else:ans = "A"
    if x == "b":
        if len(l_b) != 0: x = l_b.pop(0)
        else:ans = "B"
    if x == "c":
        if len(l_c) != 0: x = l_c.pop(0)
        else:ans = "C"
print(ans)

### FIXED CODE ###

l_a = list(str(input()))
l_b = list(str(input()))
l_c = list(str(input()))

x = l_a.pop(0)
ans=0
while ans==0:
    if x == "a":
        if len(l_a) != 0: x = l_a.pop(0)
        else:ans = "A"
    if x == "b":
        if len(l_b) != 0: x = l_b.pop(0)
        else:ans = "B"
    if x == "c":
        if len(l_c) != 0: x = l_c.pop(0)
        else:ans = "C"
print(ans)
alpha="abcdefghijklmnopqrstuvwxyz"
s=input()
s1=set(s)
s2=sorted(list(s1))
for i in range(len(alpha)):
    if i==len(s2):
        if s2[i]=='a':
            print('b')
        else:
            print('a')
        break
    if s2[i]!=alpha[i]:
        print(alpha[i])
        exit()
print("None")

### FIXED CODE ###

S=input()
alpha="abcdefghijklmnopqrstuvwxyz"
l=[]
for s in alpha:
    if s not in S:
        l.append(s)
if len(l)==0:
    print("None")
    exit()
l.sort()
print(l[0])
import math

print(math.pow(x, 3))



### FIXED CODE ###

x =int(input())
print(x * x * x)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

#debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    l = input()
    li = [int(l[i]) for i in range(len(l))]
    dprint(li)

    # 制約1 a+b は L 以下
    # 制約2 a と b で同じけたは 00 01 10 のいずれか

    mx = 10**9 + 7
    def next_digit_pat(subli, flag):
        ans = -1
        if len(subli) == 1:
            if subli[0] == 1:
                ans = 3
            else:
                if flag:
                    ans = 1
                else:
                    ans = 3
        else:
            if subli[0] == 1:
                ans = 1 * next_digit_pat(subli[1:], False) + 2 * next_digit_pat(subli[1:], True)
            else:
                ans = next_digit_pat(subli[1:], True)

        #dprint(subli, flag, ans)

        return ans % mx
    print(next_digit_pat(li, True))

solve()

### FIXED CODE ###

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

#debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    l = input().rstrip('\n')
    n = len(l)
    # 制約1 a+b は L 以下
    # 制約2 a と b で同じけたは 00 01 10 のいずれか

    mx = 10**9 + 7
    same = 1 # iまでの a+b が l と等しい（a+b <= L となるかは次の桁で気をつける必要あり）
    diff = 0 # iまでの a+b が l と異なっている（すでに a+b <= L が確定）

    for i in range(n):
        if l[i] == "1":
            same_tmp = same * 2
            diff_tmp = same * 1 + diff * 3
        else:
            same_tmp = same * 1
            # diff_tmp = same * 2 + diff * 3 ×sameで次の桁が0の場合、次の桁を1にはできない
            diff_tmp = diff * 3
        same = same_tmp % mx
        diff = diff_tmp % mx

        dprint(i, l[i], same, diff)

    print((same + diff) % mx)

solve()
n, m, k = map(int, input().split())

# if n*m%2 == 0:
#     if k%2 == 0 and k >= min(n, m):
#         ans = 1
#     else:
#         ans = 0
# else:
#     ans = 1

# if ans:
#     print("Yes")
# else:
#     print("No")

n,m,K=map(int,input().split());print("YNeos"[all(k*m-K+l*n-k*l*2for k in range(n+1)for l in range(m+1))::2])


### FIXED CODE ###

from collections import Counter
h,w=map(int,input().split())
s=""
for i in range(h):
  s+=input()
sc=Counter(s)
d=[0,0,0]
for v in sc.values():
    d[0]+=(v//4)*4
    d[1]+=2 if v%4>=2 else 0
    d[2]+=v%2

if w%2==0 and h%2==0:
  print("Yes" if d[0]==h*w else "No")
elif (w%2)*(h%2)==1:
  print("Yes" if d[1]<=(w-1)+(h-1) and d[2]==1 else "No")
elif w%2==0:
  print("Yes" if d[1]<=w and d[2]==0 else "No")
elif h%2==0:
  print("Yes" if d[1]<=h and d[2]==0 else "No")
def resolve():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    path = {}
    c = 1
    i = 1
    while c < k:
        if not i in path.keys():
            path[i] = c
            i = A[i - 1]
            c += 1
        elif i in path.keys():
            start = path[i]
            roop = c - path[i]
            break
    roop += start - 1
    idx = 1
    for r in range(roop):
        idx = A[idx - 1]
    print(idx)

resolve()

### FIXED CODE ###

def resolve():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    s = []
    ord = [-1 for i in range(n + 1)]
    rep = 1
    pos = 1
    while ord[pos] == -1:
        ord[pos] = len(s)
        s.append(pos)
        pos = A[pos - 1]
        rep += 1

    rep = len(s) - ord[pos]
    # l: ループが始まる点
    l = ord[pos]
    if k < l:
        print(s[k])
    else:
        # ループが始まるまでずらす
        k -= l
        k %= rep
        print(s[l + k])
resolve()
from bisect import bisect_right

n, t = map(int, input().split())

shop = []
shop_a0 = []

for i in range(n):
    a, b = map(int, input().split())
    if a != 0:
        shop.append([a, b, a/(b+1)])
    else:
        shop_a0.append(b)

shop = sorted(shop, key=lambda x: -x[2])
shop_a0 = sorted(shop_a0)

n = len(shop)

# dp[i][j]:i番目まで見てj個の店を回るのに掛かる所要時間の最小値
dp = [[10**10]*50 for _ in range(n+1)]
dp[0][0] = 0


for j in range(min(n+1, 50)):
    for i in range(n):
        dp[i+1][j] = min(dp[i][j], dp[i][j-1] + 1 +
                         shop[i][0]*(dp[i][j-1]+1) + shop[i][1])

ss = []
if shop_a0:
    ss.append(1+shop_a0[0])
    for i in range(1, len(shop_a0)):
        ss.append(ss[-1]+1+shop_a0[i])

ans = 0

for i in range(n+1):
    if t - dp[n][i] >= 0:
        ans = max(ans, bisect_right(ss, t-dp[n][i]) + i)

print(ans)


### FIXED CODE ###

from bisect import bisect_right
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline


n, t = map(int, input().split())

shop = []
shop_a0 = []

for i in range(n):
    a, b = map(int, input().split())
    if a != 0:
        shop.append([a, b, a/(b+1)])
    else:
        shop_a0.append(b)

shop = sorted(shop, key=lambda x: -x[2])
shop_a0 = sorted(shop_a0)

n = len(shop)

INF = 10**10
# dp[i][j]:i番目まで見てj個の店を回るのに掛かる所要時間の最小値
dp = [[INF for _ in range(31)] for __ in range(n+1)]
dp[0][0] = 0

m = min(n+1, 30)

for i in range(n):
    for j in range(m):
        if (shop[i][0]+1)*(dp[i][j]+1) + shop[i][1] > t:
            dp[i+1][j+1] = dp[i][j+1]
        else:
            dp[i+1][j+1] = min(dp[i][j+1], (shop[i][0]+1)
                               * (dp[i][j]+1) + shop[i][1])
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])

ss = []
if shop_a0:
    ss.append(1+shop_a0[0])
    for i in range(1, len(shop_a0)):
        ss.append(ss[-1]+1+shop_a0[i])

ans = 0

for i in range(m):
    if t - dp[n][i] >= 0:
        ans = max(ans, bisect_right(ss, t-dp[n][i]) + i)

print(ans)
N, K = map(int, input().split())
P = list(map(int, input().split()))

ans = -1
memo = [-1]*(K-1)

for memo_i in range(K-1):
    memo[memo_i] = P[memo_i]

for i in range(K-1, N):
    sum_ = sum(memo) + P[i]
    ans = max(ans, sum_)
    memo.pop(0)
    memo.append(P[i])

tmp = ans - K + 1
print(K-1+(tmp - 0.5*(tmp-1)))

### FIXED CODE ###

N, K = map(int, input().split())
P = list(map(int, input().split()))
memo = sum(P[:K])
ans = memo

for i in range(K, N):
    memo = memo - P[i-K] + P[i]
    ans = max(ans, memo)

print(K-1+((ans-K+1) - 0.5*((ans-K+1)-1)))
N = int(input())
S = [s for s in input()]
lis = [str(i)+str(j)+str(k) for i in range(10) for j in range(10) for k in range(10)]
ans = 0
from collections import defaultdict
d = defaultdict(list)
for i,s in enumerate(S):
    d[s].append(i)

for s in lis:
    if d[s[0]]:
        i = min(d[s][0])
        if d[s[1]]:
            for j in d[s[1]]:
                if j > i:
                    if d[s[2]]:
                        if max(d[s[2]]) > j:
                            ans += 1
                            break
                    break
        else:continue
    else:continue
                            
print(ans)

### FIXED CODE ###

N = int(input())
S = [s for s in input()]
lis = [str(i)+str(j)+str(k) for i in range(10) for j in range(10) for k in range(10)]
ans = 0
from collections import defaultdict
d = defaultdict(list)
for i,s in enumerate(S):
    d[s].append(i)

for s in lis:
    if d[s[0]]:
        i = min(d[s[0]])
        if d[s[1]]:
            for j in d[s[1]]:
                if j > i:
                    if d[s[2]]:
                        if max(d[s[2]]) > j:
                            ans += 1
                            break
                    break
        else:continue
    else:continue
                            
print(ans)
N = int(input())
A = list(map(int, input().split()))

bar_length_count = dict()
for a in A:
    bar_length_count[a] = bar_length_count.get(a, 0) + 1

for val in bar_length_count.values():
    pass

count_at_least_2 = 0
for val in bar_length_count.values():
    if val >= 2:
        if val >= 4:
            count_at_least_2 += 2
        else:
            count_at_least_2 += 1

if count_at_least_2 < 2:
    import sys
    print(0)
    sys.exit(0)

else:
    bar_length_count = sorted([(k, v) for bar_length_count.items() if v >= 2], reverse=True)
    if bar_length_count[0][1] >= 4:
        print(bar_length_count[0][0]**2)
    else:
        print(bar_length_count[0][0]*bar_length_count[1][0])
        

### FIXED CODE ###

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

bar_length_count = dict()
for a in A:
    bar_length_count[a] = bar_length_count.get(a, 0) + 1

for val in bar_length_count.values():
    pass

count_at_least_2 = 0
for val in bar_length_count.values():
    if val >= 2:
        if val >= 4:
            count_at_least_2 += 2
        else:
            count_at_least_2 += 1

if count_at_least_2 < 2:
    import sys
    print(0)
    sys.exit(0)

else:
    bar_length_count = sorted({k:v for k, v in bar_length_count.items() if v >= 2}.items(), key=lambda x: x[0], reverse=True)
    if bar_length_count[0][1] >= 4:
        print(bar_length_count[0][0]**2)
    else:
        print(bar_length_count[0][0]*bar_length_count[1][0])
print(int(input(x???????????\?????????????????????))**3)

### FIXED CODE ###

print(int(input())**3)
S = int(input())
h = S/3600
m = S%3600/60
s = S%60

print(h +":" + m + ":" + s)

### FIXED CODE ###

S = int(input())
h = int(S/3600)
m = int((S%3600)/60)
s = int((S%3600)%60)
print (h,m,s,sep=":")
n, m = map(int, input().split())
p = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(m)]

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]

    def root(self, i):
        if(self.par[i] == i):
          return i
        else:
          self.par[x] = self.find(self.par[x])
          return self.par[i]

    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)
        self.par[x] = y

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

uf = UnionFind(n)
for x, y in xy:
    uf.union(x-1, y-1)
ans = 0
for i in range(n):
    if uf.same(i, p[i]-1):
        ans += 1

print(ans)



### FIXED CODE ###

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

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]

    def root(self, i):
        if(self.par[i] == i):
          return i
        else:
          self.par[i] = self.root(self.par[i])
          return self.par[i]

    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)
        self.par[x] = y

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

uf = UnionFind(n)
for x, y in xy:
    uf.union(x-1, y-1)
ans = 0
for i in range(n):
    if uf.same(i, p[i]-1):
        ans += 1

print(ans)
import queue
N, M = map(int, input().split())
adj = [[] for i in range(N+1)]
parent = [-1] * (N+1)
for m in range(N):
    a, b  = map(int, input().split())
    adj[a].append(b)
    adj[b].append(a)
q = queue.Queue()
q.put((1,0))
while(not q.empty()):
    x, p = q.get()
    if parent[x] != -1:
        continue
    parent[x] = p
    for next in adj[x]:
        if parent[next] == -1:
            q.put((next, x))
print("Yes")
for p in parent[2:]:
    print(p)


### FIXED CODE ###

import queue
N,M = map(int,input().split())
adj = [[]for i in range(N+1)]
parent = [-1] * (N+1) # -1なら未訪問
for m in range(M):
    a,b = map(int,input().split())
    adj[a].append(b)
    adj[b].append(a)
q = queue.Queue() # 自分の部屋番号、親の部屋番号
q.put((1,0)) # 部屋1の親は部屋0と考える
while(not q.empty()):
    x, p = q.get()
    if parent[x] != -1: # 訪問済み
        continue
    parent[x] = p
    for next in adj[x]:
        if parent[next] == -1: # 未訪問なら
            q.put((next,x)) # 探索候補に追加
print ('Yes') # 必ず目標は達成できる
for p in parent[2:]: # 部屋2以降の親（前の部屋）
    print(p)
n =int(input())
b = list(map(int,input().split()))
a = []
a.append(b[0])
sum = 0


for i in range(n-1):
    if(i>0):
        if(b[i]>b[i-1]):
            a.append(b[i-1])
        else:
            a.append(b[i])

if(b[-2]>=b[-1]):
    a.append(b[-2])
else:
    a.append(b[-1])

for j in range(n):
    sum += a[j]

print(sum)


### FIXED CODE ###


n =int(input())
b = list(map(int,input().split()))
a = []
a.append(b[0])
sum = 0


for i in range(n-1):
    if(i>0):
        if(b[i]>=b[i-1]):
            a.append(b[i-1])
        else:
            a.append(b[i])

if(a[-1]>=b[-1]):
    a.append(a[-1])
else:
    a.append(b[-1])

for j in range(n):
    sum += a[j]

print(sum)
n,k=map(int,input().split())
s=input()
t=s[::-1]
u="".join([s,t])
ls=[]
for i in range(n):
  ls.append(u[i:i+n])
ls.sort()
k-=1
x=list(ls[0])
if 2**k<n:
  y=n-2**k
  print(x[0]*(2**k)+x[1:y+1])
else:
  print(x[0]*n)

### FIXED CODE ###

n,k=map(int,input().split())
s=input()
t=s[::-1]
u="".join([s,t])
ls=[]
for i in range(n):
  ls.append(u[i:i+n])
ls.sort()
k-=1
x=ls[0]
cnt=1
for i in range(1,n):
  if x[0]==x[i]:
    cnt+=1
  else:
    break
if cnt*2**k<n:
  y=n-cnt*2**k
  print(x[0]*(cnt*2**k)+x[cnt:y+cnt])
else:
  print(x[0]*n)
a,b,c = map(int,input())
ave = (a+b+c)/2
if a == ave or b == ave or c == ave:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a,b,c = map(int,input().split())
if a+b == c or b+c == a or c+a == b:
  print("Yes")
else:
  print("No")
if input().upper()==input():
  print("A")
else:
  print("a")

### FIXED CODE ###

S=input()
if S.upper()==S:
  print("A")
else:
  print("a")
N,M = map(int,input().split())
Alist = list(map(int, input().strip().split()))
r = [0]*N
r[0] = Alist[0]
for i in range(1,len(Alist)):
    r[i] = r[i-1] + Alist[i]
for i in range(len(r)):
    r[i] = r[i]%M
r.sort()
p = []
m = 0
for i in range(1,len(r)):
    m = m+1
    if r[i-1] != r[i]:
        p.append(m)
        m = 0
m = m+1
p.append(m)
def combi(n):
    if n == 0:
        return 0
    if n == 1:
        return 0
    else:
        return (n*(n-1))/2
s = 0
for i in range(len(p)):
    s = s + combi(p[i])
s = s + p[0]
print(int(s))

### FIXED CODE ###

N, K = map(int,input().split())
if N % K == 0:
    print(0)
else:
    print(1)
from collections import deque


h, w = map(int, input().split())
hs, ws = set(range(h)), set(range(w))
a = []
b = []
d = deque([])
memo = [[None] * w for j in hs]
move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
a = tuple(input() for _ in hs)
b = [[i, j] for i in hs for j in ws if a[i][j] == '#']
for i, j in b:
    d.append([i, j])
    memo[i][j] = 0


def d_list_update():
    dh, dw = d.popleft()
    for i, j in move:
        if not(memo[dh + i][dw + j]):
            if (0 <= dh + i < h) and (0 <= dw + j < w):
                memo[dh + i][dw + j] = memo[dh][dw] + 1
                d.append([dh + i, dw + j])
    return d


while d:
    d_list_update()
ans = max([max(e) for e in memo])
print(ans)

### FIXED CODE ###

from collections import deque
 
 
h, w = map(int, input().split())
hs, ws = set(range(h)), set(range(w))
d = deque()
memo = [[-1] * w for j in hs]
move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
a = tuple(input() for _ in hs)
b = [[i, j] for i in hs for j in ws if a[i][j] == '#']
for i, j in b:
    d.append((i, j))
    memo[i][j] = 0
while d:
    dh, dw = d.popleft()
    for i, j in move:
        dhn, dwn = dh + i, dw + j
        if (0 <= dhn < h) and (0 <= dwn < w) and (memo[dhn][dwn] < 0):
            d.append((dhn, dwn))
            memo[dhn][dwn] = memo[dh][dw] + 1
ans = max([max(e) for e in memo])
print(ans)
s = input()

c = int(s.index('C'))
f = max(int(s.index('F')), int(s.rindex('F')))

if c <= f:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s = input()

if 'C' in s and 'F' in s:
    c = int(s.index('C'))
    f = max(int(s.index('F')), int(s.rindex('F')))
    if c <= f:
        print('Yes')
    else:
        print('No')
else:
    print('No')