Harryxun/stf_run huggingface dataset:
# import
import numpy as np

# input
H, W = map(int, input().split())

Mtmp = []
for _ in range(H):
    tmp = list(input())
    Mtmp.append(tmp)

M = np.array(Mtmp)
S = np.array([[0]*W]*H)

print(M)

digtmp = np.array([[0, 1], [1, 0], [0, -1], [-1, 0]])

def dfs(i, j):
    global ngflag
    global searchflag
    if S[i, j] == 1:
        return
    S[i, j] = 1
    if M[i, j] == '.':
        return
    print("i:{}, j:{}".format(i, j))
    searchflag = 1
    dig = digtmp + np.array([i, j])
    for d in dig:
        if 0 <= d[0] < H and 0 <= d[1] < W:
            if M[d[0], d[1]] == '#':
                ngflag = 0
                dfs(d[0], d[1])

searchflag = 0

while True:
    ngflag = 1
    if 0 not in S:
        if M[target[0], target[1]] == '.':
            ngflag = 0
        break
    target = list(zip(*np.where(S == 0)))[0]
    print("sf:{}, ng:{}".format(searchflag, ngflag))
    dfs(target[0], target[1])
    if M[target[0], target[1]] == '#' and searchflag == 1 and ngflag == 1:
        break
        

print("sf:{}, ng:{}".format(searchflag, ngflag))

if searchflag == 1 and ngflag == 0:
    ans = 'Yes'
elif searchflag == 1 and ngflag == 1:
    ans = 'No'
else:
    ans = 'Yes'

print(ans)


### FIXED CODE ###


# import
import numpy as np
import sys
sys.setrecursionlimit(10**6)

# input
H, W = map(int, input().split())

Mtmp = []
for _ in range(H):
    tmp = list(input())
    Mtmp.append(tmp)

M = np.array(Mtmp)
S = np.array([[0]*W]*H)

#print(M)

digtmp = np.array([[0, 1], [1, 0], [0, -1], [-1, 0]])

def dfs(i, j):
    global ngflag
    global searchflag
    if S[i, j] == 1:
        return
    S[i, j] = 1
    if M[i, j] == '.':
        return
    #print("i:{}, j:{}".format(i, j))
    searchflag = 1
    dig = digtmp + np.array([i, j])
    for d in dig:
        if 0 <= d[0] < H and 0 <= d[1] < W:
            if M[d[0], d[1]] == '#':
                ngflag = 0
                dfs(d[0], d[1])

searchflag = 0
ngflag = 1

while True:
    if 0 not in S:
        if M[target[0], target[1]] == '.':
            ngflag = 0
        break
    target = list(zip(*np.where(S == 0)))[0]
    #print("sf:{}, ng:{}".format(searchflag, ngflag))
    if M[target[0], target[1]] == '#':
        ngflag = 1
    dfs(target[0], target[1])
    if M[target[0], target[1]] == '#' and searchflag == 1 and ngflag == 1:
        break


#print("sf:{}, ng:{}".format(searchflag, ngflag))

if searchflag == 1 and ngflag == 0:
    ans = 'Yes'
elif searchflag == 1 and ngflag == 1:
    ans = 'No'
else:
    ans = 'Yes'

print(ans)
A, B = input().split()
return A*B

### FIXED CODE ###

A, B = map(int, input().split())
print(A * B)
include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  int N = 0;
  int K = 0;
  int A = 1;
  std::cin >> N;
  std::cin >> K;
  for(int i;i<N;i++){
  A*=i
  }
  for(int i;i<K;i++){
  A/=i
  }
  for(int i;i<N-K;i++){
  A/=i
  }
  
  std::cout << A << std::endl;
  return 0;
}

### FIXED CODE ###

n,k=map(int,input().split())
print(n-k+1)
array = list(map(int, input().strip().split()))
#array.sort(reverse = True)
N = array[0]
M = array[1]
X = array[2]
Y = array[3]

xarray = list(map(int, input().strip().split()))
xarray.sort(reverse = True)
##print(xarray)
xmax = xarray[0]

yarray = list(map(int, input().strip().split()))
yarray.sort()
##print(yarray)
ymin = yarray[0]
if (ymin > xmax):
    if((abs(ymin) - abs(xmax)) >= 1):
        print("No War")
    else:
        print("War")
else:
    print("War")

##print(array)


### FIXED CODE ###

array = list(map(int, input().strip().split()))
array.sort(reverse = True)
A = 10 * array[0] + array[1] + array[2]
print(A)
import numpy as np
import sys

printf = sys.stdout.write

for i in sys.stdin:
    try:
        a,b,c,d,e,f = map(float, i.split())
    except:
        printf(i)
        break

    A = np.array([[ a, b],
        [ d, e]])
    B = np.array([c,f])
    X = np.linalg.solve(A,B)
    print "{0:.3f}".format(X[0]),"{0:.3f}".format(X[1])

### FIXED CODE ###

import sys
 
out = []
for line in sys.stdin.readlines():
    List = map(float, line.strip().split())
 
    [a, b, c, d, e, f] = List
 
    x = (b*f-c*e)/(b*d-a*e)
    y = (a*f-c*d)/(a*e-b*d)
 
    out.append("%.3f %.3f" % (x+0, y+0))
 
for i in xrange(len(out)):
    print out[i]
S = input()

target = "keyence"
now = 0
start = None
end = None
for i in range(len(S)):
    if target[now] == S[i]:
        now += 1
        if start is not None and end is None:
            end = i
    elif start is not None:
        continue
    else:
        start = i

if start is None:
    pred = S
elif end is None:
    pred = S[:start]
else:
    pred = S[:start] + S[end:]

if pred == target:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

S = input()

target = "keyence"
N = len(target)

for i in range(8):
    s = S[:i] + S[len(S) - N + i :]
    if s == target:
        print("YES")
        break
else:
    print("NO")
n = int(input())
v = list(map(int, input().split()))

vv = [[], []]
for i in range(n):
    vv[i % 2].append(v[i])

import collections
items0 = sorted(collections.Counter(vv[0]).items(), key=lambda x: -x[1])
items1 = sorted(collections.Counter(vv[1]).items(), key=lambda x: -x[1])
key0 = [x[0] for x in items0]
key1 = [x[0] for x in items1]
val0 = [x[1] for x in items0]
val1 = [x[1] for x in items1]

if key0[0] == key1[0]:
    if len(items0) == 1:
        print(n//2)
    else:
        print(min(n - val0[0] - val1[1], min(n - val0[1] - val1[0])))
else:
    print(n - val0[0] - val1[0])


### FIXED CODE ###

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

vv = [[], []]
for i in range(n):
    vv[i % 2].append(v[i])

import collections
items0 = sorted(collections.Counter(vv[0]).items(), key=lambda x: -x[1])
items1 = sorted(collections.Counter(vv[1]).items(), key=lambda x: -x[1])
key0 = [x[0] for x in items0]
key1 = [x[0] for x in items1]
val0 = [x[1] for x in items0]
val1 = [x[1] for x in items1]

ans = n - val0[0] - val1[0]

if key0[0] == key1[0]:
    tmp0=tmp1=1000000000000000
    if len(items0) > 1:
        tmp0 = n - val0[1] - val1[0]
    if len(items1) > 1:
        tmp1 = n - val0[0] - val1[1]
    ans = min(tmp0, tmp1)
    if len(items0) == 1 and len(items1) == 1:
        ans=n//2
print(ans)
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
at,bt=0,0
p=0
while p<=k:
    if (n!=at and a[at]<b[bt]) or m==bt:
        p+=a[at]
        at+=1
    else:
        p+=b[bt]
        bt+=1
    if n==at and m==bt:
        print(at+bt)
        break
    #print(p)
else:
    print(at+bt-1)

### FIXED CODE ###

n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ea=[0]
for i in range(n):
    ea.append(ea[i]+a[i])
eb=[0]
for i in range(m):
    eb.append(eb[i]+b[i])
tb=m
p=0
for i in range(n+1):
    while ea[i]+eb[tb]>k:
        if tb==0:
            break
        tb-=1
    if ea[i]+eb[tb]<=k:
        p=max(i+tb,p)
print(p)
n,m=map(int,input().split())
a,b,c=[None]*n,[None]*n,[None]*n
inf=float("inf")
d=[inf]*n
neg=[False]*n
d[0]=0

for i in range(m):
  a[i],b[i],c[i]=map(int,input().split())
  c[i]=-c[i]

for loop in range(n-1):
  for i in range(m):
    if d[a[i]-1]==inf:continue
    if d[b[i]-1]>d[a[i]-1]+c[i]:
      d[b[i]-1]=d[a[i]-1]+c[i]
ans=d[n-1]

for loop in range(n):
  for i in range(m):
    if d[a[i]-1]==inf:continue
    if d[b[i]-1]>d[a[i]-1]+c[i]:
      d[b[i]-1]=d[a[i]-1]+c[i]
      neg[b[i]-1]=True
    if neg[a[i]-1]:
      neg[b[i]-1]=True

if neg[n-1]:
  print("inf")
else:
  print(-ans)

### FIXED CODE ###

n,m=map(int,input().split())
inf=float("inf")
l=[tuple(map(int,input().split())) for i in range(m)]
 
d=[inf]*n
d[0]=0

for i in range(n):
  for a,b,c in l:
    a,b,c=a-1,b-1,-c
    if d[a]!=inf and d[b]>d[a]+c:
      d[b]=d[a]+c
      if i==n-1 and b==n-1:
        print("inf")
        exit()
print(-d[-1])
N, K = map(int, input().split())
A = list(map(int, input().split()))

A_dict = {str(i):0 for i in set(A)}
for a in A:
  A_dict[str(a)] += 1

def get_A_key_from_value(dic, value):
  keys = [i for i, j in dic.items() if j == value]
  if len(keys) != 1:
    keys = keys[0]
  return keys[0]
  
ans = 0
while True:
  if len(A_dict) <= K:
    break
  ans += min(A_dict.values())
  del A_dict[get_A_key_from_value(A_dict,min(A_dict.values()))]
print(ans)  

### FIXED CODE ###

#読み込み
N, K = map(int, input().split())
A = list(map(int, input().split()))
#処理回数
reduce_type = len(set(A)) - K
#削除する数の選定
A_dict = {str(i):0 for i in set(A)}
for a in A:
  A_dict[str(a)] += 1
del A
list_del_num = sorted(list(A_dict.values()))[:reduce_type]
#計算
ans = sum(list_del_num)
print(ans)
n = input()
h = input().split()
hl = [0]*n

for i in range(n):
  hi = h[i]
  hl[i] = int(hi)

ans = 1
m = n - 1
high = hl[0]
 
for i in range(m):
  if hl[i+1] >= high:
    ans += 1
    high = hl[i+1]
   else:
    continue
 
print(ans)

### FIXED CODE ###

n = int(input())
h = input().split()
 
ans = 1
m = n-1
high = int(h[0])
 
for i in range(m):
    if int(h[i+1]) >= high:
        ans += 1
        high = int(h[i+1])
    else:
        continue
        
 
print(ans)
from collections import Counter
import sys

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

# 全て0ならYes
if all([x == 0 for x in arr]):
    print("Yes")
    sys.exit()

# 3つずつ循環していなければNo
if n % 3 != 0:
    print("No")
    sys.exit()

c = Counter(arr)

# 2種類の場合
if len(c) == 2:
    if c[0] == n // 3:
        print("Yes")
        sys.exit()

# 3種類の場合
elif len(c) == 3:
    result = list(c.values())
    if result[0] == result[1] == result[2]:
        ans1 = True
    else:
        ans1 = False
else:
    ans1 = False

result = list(c.keys())
ans2 = result[0] == result[1] ^ result[2] and result[1] == result[0] ^ result[2] and result[2] == result[0] ^ result[1]

print("Yes" if ans1 and ans2 else "No")

### FIXED CODE ###

import sys
from collections import Counter
n = int(input())
a = list(map(int, input().split()))


# 全て0ならYes
if all([x == 0 for x in a]):
    print("Yes")
    sys.exit()

    
# 全て0でない場合、nは必ず3の倍数になる
if n % 3 != 0:
    print("No")
    sys.exit()

c = Counter(a)

cli = list(c.keys())
cval = list(c.values())


# 排他的論理和は3つずつ循環するため、keyは3種類、または0を含む場合2種類になる
if len(cli) > 3 or len(cli) <2:
    print("No")
    sys.exit()

# keyが2種類の場合、0が全体の1/3ならOK
if len(cli) == 2 and 0 in cli:
    if c[0] == n // 3:
        print("Yes")
        sys.exit()
    else:
        print("No")
        sys.exit()

# keyが3種類の場合、全ての値が同数、かつ排他的論理和の関係であればOK
if not all([x == cval[0] for x in cval]):
    print("No")
    sys.exit()

ans_0 = cli[1] ^ cli[2] == cli[0]
ans_1 = cli[2] ^ cli[0] == cli[1]
ans_2 = cli[0] ^ cli[1] == cli[2]

print("Yes" if all([ans_0, ans_1, ans_2]) else "No")
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for i in range(N-1):
  ans += B[A[i]-1] + C[A[i]-1]
ans += B[A[i]-1]
print(ans)

### FIXED CODE ###

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

ans = sum(B)
for i in range(N-1):
  if A[i]+1 == A[i+1]:
    ans += C[A[i]-1]
print(ans)
x,n = map(int,input()split())
p = list(map(int,input().split()))
for i in range(101):
    if x-i not in p:
        print(x-i)
        exit()
    elif x+i not in p:
        print(x+i)
    exit()


### FIXED CODE ###

x,n = map(int,input().split())
p = list(map(int,input().split()))
for i in range(101):
    if x-i not in p:
        print(x-i)
        exit()
    elif x+i not in p:
        print(x+i)
        exit()
N = int(input())

n1 = int(N / 100 % 100)
n2 = N % 100

if n1 == 0 or n2 == 0:
    print("NA")
elif n1 > 12:
    print("YYMM")
elif n2 > 12:
    print("MMYY")
elif n1 < 12:
    print("AMBIGUOUS")


### FIXED CODE ###

n , k = map(int, input().split())
S = list(input())

for i in range(len(S)):
    if i == k - 1:
        print(S[i].swapcase(), end="")
    else:
        print(S[i], end="")
print()
def intersect_list(lst1, lst2):
    arr = []
    lst = lst1.copy()
    for element in lst2:
        try:
            lst.remove(element)
        except ValueError:
            pass
        else:
            arr.append(element)
    return len(arr)

n=int(input())
a=[input() for i in range(n)]
a=list(map(lambda x:list(x),a))
count=0
for i in range(len(a)):
    for j in range(i+1,len(a)):
        if intersect_list(a[i],a[j])==len(len(a[i])):
            count+=1
print(count)

### FIXED CODE ###

import math
import collections

n=int(input())
a=[list(input()) for i in range(n)]
b=[str(sorted(list(i))) for i in a]
count=list(collections.Counter(b).values())
count=[i for i in count if i>1]
print(int(sum([math.factorial(x)/(math.factorial(x-2)*2) for x in count])))
a, b, k = map(int, input().split())
r = range(a,b+1)
l = list(r)


### FIXED CODE ###

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

l = [i for i in range(a, b+1) if (i < a+k) or (i > b-k)]

print(*l, sep="\n", end="")
n, p = map(int, raw_input().split())
fac = {}
primes = [1]*(10**6 + 200)
i = 2
prim = []
while i <= 10**6 + 100:
    if primes[i]:
        prim.append(i)
        j = i*2
        while j <= 10**6 + 100:
            primes[j] = 0
            j += i 
    i += 1 
for i in prim:
    while p%i == 0:
        p /= i 
        fac[i] = fac[i] + 1 if i in fac else 1
ans = 1
for i in fac:
    if fac[i] >= n:
        ans *= i**(fac[i]/n)
print ans

### FIXED CODE ###

print raw_input().count('2')
N = list(input())

for i in N：
    if i == "7"
      print("Yes")
      break
    
else：
    print("No")

### FIXED CODE ###

N = list(input())

for i in N:
    if i == "7":
        print("Yes")
        break
    
else:
    print("No")
def dfs(tree,node,x,ans):
    ans[node-1]+=x
    if node in tree:
        for i in tree[node]:
            dfs(tree,i,x,ans)


n,q = map(int, input().split())
tree = {}
for i in range(n-1):
    a,b = map(int,input().split())
    if not(a in tree):
        tree[a] = [b]
    else:
        tree[a].append(b)

ans = [0]*n
for i in range(q):
    p,x = map(int,input().split())
    dfs(tree,p,x,ans)

print(*ans)

### FIXED CODE ###

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

def dfs(v,p):
    for i in tree[v]:
        if i==p:
            continue
        res[i]+=res[v]
        dfs(i,v)

n,q = map(int, input().split())
tree = [[] for _ in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

res = [0]*n
for i in range(q):
    p,x = map(int,input().split())
    res[p-1] += x

dfs(0,-1)
print(*res)
s=input()
t=input()
a=0
while(s!=t):
	s =s[-1]+s[:-1]
	a+=1
    if a==len(s):
    	print("NO")
        break
if s==t:
	print("YES")
        

### FIXED CODE ###

s = input(); t = input()
c = 0 #無限ループを防ぐためのカウンターを設置
     
while (s != t):
	s = s[-1] + s[:-1]
	c += 1
	if c == len(s):
		print('No')
		break
        
if s == t:
	print('Yes')
N, M, R = map(int, input().split())
R_LIST = list(map(int, input().split()))
ABC = []
for _ in range(M):
    a,b,c = map(int, input().split())
    ABC.append((a,b,c))

edges = ABC[:]


def warshall_floyd(d, n):
    # d: グラフ二次元リスト
    # n: 頂点数 (0始まり)
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

# グラフ無効グラフ化
graph = [[float("inf") for i in range(N+1)] for i in range(N+1)] 
for x,y,z in edges:
    graph[x][y] = z
    graph[y][x] = z
for i in range(N+1):
    graph[i][i] = 0 #自身のところに行くコストは０

#最短経路
shortest =  warshall_floyd(graph, N+1)
    
# 順列全探索
import sys
INT_MAX = sys.maxsize # 9223372036854775807
ans = INT_MAX

import queue

q = queue.Queue()
for t in travels:
    q.put((
        0,
        (t,)
    ))

travels = R_LIST[:]

while not q.empty():
    past = q.get()
    if len(past[1]) == len(travels):
        ans = min(ans, past[0])
    
    for t in travels:
        if not t in past[1]:
            cost = past[0]
            cost += shortest[past[1][-1]][t]
            next_past = past[1] + (t,)
            q.put((
                cost,
                next_past
            ))
print(ans)
      
        
        



### FIXED CODE ###

N, M, R = map(int, input().split())
R_LIST = list(map(int, input().split()))
ABC = []
for _ in range(M):
    a,b,c = map(int, input().split())
    ABC.append((a,b,c))
    
    
edges = ABC[:]


def warshall_floyd(d, n):
    # d: グラフ二次元リスト
    # n: 頂点数 (0始まり)
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

# グラフ無効グラフ化
graph = [[float("inf") for i in range(N+1)] for i in range(N+1)] 
for x,y,z in edges:
    graph[x][y] = z
    graph[y][x] = z
for i in range(N+1):
    graph[i][i] = 0 #自身のところに行くコストは０

#最短経路
shortest =  warshall_floyd(graph, N+1)
    
# 順列全探索
import sys
INT_MAX = sys.maxsize # 9223372036854775807
ans = INT_MAX

import queue

rest = set(R_LIST[:])

import copy  
def dfs(cost,pre,rest):
    if len(rest) == 0:
        return cost
    
    ret = INT_MAX
    for r in rest:
        if pre == None:
            next_cost = 0
        else:
            next_cost = cost + shortest[pre][r]
        next_rest = copy.copy(rest)
        next_rest.remove(r)
        
        tmp_ret = dfs(next_cost, r, next_rest)
        ret = min(ret, tmp_ret)
        
    return ret
        
    

print(dfs(0, None, rest))
import math

n = int(input())
s = int(input())
ans = -1

def f(b, n):
    if n < b:
        return n
    else:
        return f(b, n//b) + n%b

if n == s: ans = n+1
for i in range(2, int(math.sqrt(n))+1):
    if f(i, n) == s:
        ans = i
        break
if ans == -1:
    for i in range(int(math.sqrt(n)), 0, -1):
        b = (n-s) // i + 1
        if f(b,n) == s:
            ans = b
            break

print(ans)


### FIXED CODE ###

import math

n = int(input())
s = int(input())
ans = -1

def f(b, n):
    if n < b:
        return n
    else:
        return f(b, n//b) + n%b

#
if n == s: ans = n+1
for i in range(2, int(math.sqrt(n))+1):
    if f(i, n) == s:
        ans = i
        break
if ans == -1:
    for i in range(int(math.sqrt(n)), 0, -1):
        b = int((n-s) / i + 1)
        if b >= 2 and f(b,n) == s:
            ans = b
            break

print(ans)
import sys
N,K=map(int,input().split())
D=[int(i) for i in input().split()]
L=[0]*10
for i in range(K):
    L[D[i]]=1
for i in range(N,10000):
    x=str(i)
    flag=True
    for k in range(4):
        y=int(x[k])
        if L[y]==1:
            flag=False
    if flag:
        print(i)
        sys.exit()

### FIXED CODE ###

import sys
N,K=map(int,input().split())
D=[int(i) for i in input().split()]
L=[0]*10
for i in range(K):
    L[D[i]]=1
for i in range(N,100001):
    x=str(i)
    flag=True
    for k in range(len(x)):
        y=int(x[k])
        if L[y]==1:
            flag=False
    if flag:
        print(i)
        sys.exit()
n=int(input())
 
ans=[0]*(n+1)
 
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            f= x**2 + y**2 + z**2 + x*y + y*z + z*x
            if f<=n:
                ans[f]+=1
 
for i in range(1,n+1):
    print(ans[i])

### FIXED CODE ###

L, R, d = map(int, input().split())

a = 1
cnt = 0
while 1:
    s = d*a
    if (L<=s)and(R>=s):
        cnt += 1
    elif R<s:
        break
    a += 1
print(cnt)
A=int(input())
B=int(input())

if A>8 or B>8:
  print(":(")
else:
  print("Yay!")

### FIXED CODE ###

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

if a>8 or b>8 or a<0 or b<0:
  print(":(")
else:
  print("Yay!")
(a, b, c) = [int(i) for i in input().split()]
count = 0
for i in range(a, b):
    if (c % i) == 0:
        count = count + 1
print(count)
~                

### FIXED CODE ###

(a, b, c) = [int(i) for i in input().split()]
cnt = 0
for i in range(a, b + 1):
    if (c % i) == 0:
        cnt = cnt + 1
print(cnt)
N = input()
A = [x for x in input().split()]
five = False
three = False
for x in range(A):
  if(x%5==0):
    five = True
  elif(x%3==0):
    three = True
    
if(five.equals(True) and three.equals(True)):
   print("APPROVED)
else:
   print("DENIED")
  


### FIXED CODE ###

N = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) == len(answer):
    print("APPROVED")
else:
    print("DENIED")
n,l = map(int,input().split())
a=[]
for i in range(n):
  a.append(input())
  
a=sorted(a)

print("".joined(a))

### FIXED CODE ###

n,l = map(int,input().split())
a=[]
for i in range(n):
  a.append(input())
  
a=sorted(a)
print("".join(a))
from heapq import heappush, heappop
from collections import deque

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

ans = 0

for i in range(K+1):
    for l in range(min(i+1,N+1)):
        for r in range(i+1-l):
            j = min(i-r-l,r+l)
            hq = []
            dq = deque(V)
            for _ in range(l):
                item = dq.popleft()
                heappush(hq, item)
            for _ in range(r):
                item = dq.pop()
                heappush(hq, item)
            for _ in range(j):
                heappop(hq)
            res = sum(hq)
            ans = max(ans,res)

print(ans)

### FIXED CODE ###

from heapq import heappush, heappop
from collections import deque

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

ans = 0

for i in range(K+1):
    sup = min(i,N)
    for l in range(sup+1):
        for r in range(sup+1-l):
            j = min(i-r-l,r+l)
            hq = []
            dq = deque(V)
            for _ in range(l):
                item = dq.popleft()
                heappush(hq, item)
            for _ in range(r):
                item = dq.pop()
                heappush(hq, item)
            for _ in range(j):
                heappop(hq)
            res = sum(hq)
            ans = max(ans,res)

print(ans)
n, q = map(int, input().split())
s = input()
l = [0] * q
r = [0] * q
for i in range(0, q):
    l[i], r[i] = map(int, input().split())
ac_index = []
k = 0
while(k < n - 1):
    while(s[k] != 'A'):
        k += 1
    k += 1
    if s[k] == 'C':
        ac_index.append(k - 1)
    k += 1

for i in range(0, q):
    count = 0;
    for j in ac_index:
        if l[i] - 1 <= j <  r[i] - 1:
            count += 1
    print(count)

### FIXED CODE ###

n, q = map(int, input().split())
s = ' ' + input()
heap = [0] * (n + 1)
cnt = 0
for i in range(2, n + 1):
    if s[i - 1] == 'A' and s[i] == 'C':
        cnt += 1;
    heap[i] = cnt
ans = []
for i in range(q):
    l, r = map(int, input().split())
    ans.append(heap[r] - heap[l])
for i in ans:
    print(i)
a,b=map(int,input().split());print('Zero'*(a*b<=0)or'NPeogsaittiivvee'[b>=0or(b-a)%2::2])

### FIXED CODE ###

a,b=map(int,input().split());print('Zero'*(a+b==0or abs(a+b)<abs(a)+abs(b))or'NPeogsaittiivvee'[a>0or(b-a)%2::2])
from collections import defaultdict
import sys
input = sys.stdin.readline

s = input()
t = input()
ds = defaultdict(int)
ss = ""
dt = defaultdict(int)
st = ""
a = "abcdefghijklmnopqrstuvwxyz"
s_res = ""
t_res = ""

for i in range(len(s)):
    ds[s[i]] += 1
    dt[t[i]] += 1
    if ds[s[i]] == 1:
        ss += s[i]
    if dt[t[i]] == 1:
        st += t[i]
    s_res += a[ss.find(s[i])]
    t_res += a[st.find(t[i])]
    

if s_res == t_res:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

from collections import defaultdict
import sys
input = sys.stdin.readline

s = input()
t = input()
ds = defaultdict(str)
dt = defaultdict(str)

ans = "Yes"
for c1, c2 in zip(s, t):
    if c1 not in ds:
        ds[c1] = c2
    else:
        if ds[c1] != c2:
            ans = "No"
    
    if c2 not in dt:
        dt[c2] = c1
    else:
        if dt[c2] != c1:
            ans = "No"
print(ans)
import decimal
n = int(input())
v = list(map(int, input().split()))
v = sorted(v)

temp = 0

for i in range(1,n):
    if i == 1:
        temp += decimal.Decimal((v[0] + v[1])/2)
    else:
        sum_ = decimal.Decimal((temp + v[i])/2)

print(sum_)


### FIXED CODE ###

import decimal
n = int(input())
v = list(map(int, input().split()))
v = sorted(v)

temp = 0
sum_ = 0

for i in range(1,n):
    if i == 1:
        temp += decimal.Decimal((v[0] + v[1])/2)
    else:
        temp = decimal.Decimal((temp + v[i])/2)

print(temp)