peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import math
n,k=map(int,input().split())
n_lis=[int(i) for i in range(1,n+1)]
p=float(1/n)
p_lis=[]
for i in range(n):
    if n_lis[i]<k:
        atai=float(k/n_lis[i])
        kaisu=-(-math.log(atai,2)//1) # loop処理しなくてよいので記述が楽
        p_lis.append((1/2)**(kaisu))
    else:
        p_lis.append(1)

print(p*sum(p_lis))
# Judge status: Accepted
#!/usr/bin/env python3

x = int(input())

if x % 11 == 0:
    tmp = 0
elif x % 11 < 7:
    tmp = 1
else:
    tmp = 2
print(x//11 * 2 + tmp)
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))
tmp = 1
ans = 0
for i in range(N):
    if a[i] == tmp:
        tmp += 1
    else:
        ans += 1
if tmp == 1:
    print(-1)
    exit()
print(ans)
# Judge status: Wrong Answer
# C Skill Up

def list_add(li1, li2):
  return [a+b for a, b in zip(li1, li2)]

N, M, X = map(int, input().split())
data = []
for n in range(N):
  data.append(list(map(int, input().split())))

ans = 100000 * N
for c in range(1 << N):
  x = [0] * M
  yen = 0
  for i, n in enumerate(format(c, f"{N}b")):
    if n == "1":
      yen += data[i][0]
      x = list_add(x, data[i][1:])
  for xm in x:
    if xm < X:
      break
  else:
    ans = min(ans, yen)
    
if ans == 100000 * N:
  print(-1)
else:
  print(ans)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines



def main():
    N, M = map(int, readline().split())
    d = map(int, read().split())
    AB = list(zip(d, d))
    AB = sorted(AB)

    have = 0
    price = 0
    for x, y in AB:
        if M - have < y:
            price += x * (M - have)
            break

        else:
            price += x * y
            have += y


    print(price)

main()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

m = sum(a) // 2
s = sum(a)
temp = 0
for x in a:
    temp += x
    if temp > m:
        H = temp
        L = temp - x
        break

print(min(H * 2 - s, s - L * 2))
# Judge status: Accepted
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


d = {'Sunny':'Cloudy','Cloudy':'Rainy','Rainy':'Sunny'}
print(d[S()])
# Judge status: Accepted
N, M = map(int, input().split())
lis = []
for i in range(M):
    lis += map(int, input().split())
for j in range(N):
    print(lis.count(j+1))
# Judge status: Wrong Answer
N=int(input())
H=input()
word=[]
for i in range(N-1):
  S=input()
  if S in word:
    print('No')
    exit()
  else:
    if H[-1]==S[0]:
      H=S
      word.append(H)
    else:
      print('No')
      exit()
print('Yes')
# Judge status: Accepted
x = int(input())
cnt = x // 11 * 2
mod = x % 11
print(cnt + -(-mod//6))
# Judge status: Wrong Answer
import collections

n = int(input())
d = list(map(int,input().split()))
mod = 998244353

ans = 1
c = collections.Counter(d)
if c[0] != 1:
    ans = 0
if c[1] == 0:
    ans = 0
x = 1
for i in range(1,max(d)+1):
    if c[i] == 0:
        ans = 0
        break
    ans *= pow(c[i-1],c[i],mod)
    x += c[i]
    ans %= mod
print(ans%mod)
# Judge status: Wrong Answer
Q, H, S, D = map(int, input().split())
N = int(input())

c_05 = min(2*Q, H)
c_1 = min(2*c_05, S)

if c_1 <= D:
    print(c_1 * N)
else:
    if N % 2 == 0:
        print(D * (N//2))
    else:
        print(D * (N//2) + c_1)
# Judge status: Wrong Answer
import numpy as np

#  入力
n, w = map(int, input().split())
wv = np.array([list(map(int, input().split())) for i in range(n)])


dp = np.zeros((w + 1, n + 1))
for i in range(1, n + 1):

    dp[:, i] = dp[:, i - 1]
    wNew, vNew = wv[i - 1, 0], wv[i - 1, 1]
    dp[wNew:, :] = np.fmax(dp[wNew:, :], vNew + dp[:-wNew, :])

print(dp[w, n])
# Judge status: Accepted
# 入力
N,L=map(int,input().split())

l=[]
for i in range(N):
  l.append(input())

# ソート
l.sort()

# 出力
print(''.join(l))
# Judge status: Wrong Answer
n, m = map(int, input().split())

ans = 0
ans += n
m-=2*n
ans+=m//4
print(ans)
# Judge status: Accepted
n = int(input())
a = [int(input()) for i in range(n)]
b = sorted(a)
for i in range(n):
    if a[i] == b[-1]:
        print(b[-2])
    else:
        print(b[-1])
# Judge status: Accepted
n,k=list(map(int,input().split()))
s=input()
temp=""
happy=0
zig=0
for i in s:
    if temp==i:
        happy+=1
    else:
        temp=i 
print(n-1 if happy+k*2>=n-1 else happy+k*2)
# Judge status: Accepted
s = [int(i) for i in input().split('/')]
if s[1] <= 4:
    print('Heisei')
else:
    print('TBD')
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
hight = A[0]
base = 0
for i in range(1,N):
  if A[i] < hight:
    base += hight - A[i]
  else:
    hight = A[i]
print(base)
# Judge status: Accepted
import math

d = input()
n1, n2 = d.split(" ")

num = n1 + n2
square = math.sqrt(int(num))
if square.is_integer():
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
a=int(input())
A=list(map(int,input().split()))
ans=1
for x in A:
  ans*=x
  if ans>10**18:
    break
    

if ans>10**18:
  print(-1)
else:
  print(ans)
# Judge status: Accepted
N = int(input())
print(N * (N + 1) //2)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

total = sum(a)
s = 0
ans = 10**9 * 2 * 10**5
for i in range(0, n-1):
    s += a[i]
    ans = min(ans, abs(s - (total-s)))
    
print(ans)
# Judge status: Accepted
n = int(input())
guide = []
for i in range(n):
   restaurant = []
   s, p = input().split()
   p_1 = int(p)
   restaurant.append(s)
   restaurant.append(p_1)    
   x = i+1
   restaurant.append(x)
   guide.append(restaurant) 
sort_guide = sorted(guide, key=lambda x:(x[0],-x[1]))
for i in range(len(sort_guide)):
    print(sort_guide[i][2])
# Judge status: Wrong Answer
x, y = map(int, input().split())
if x%y == 0:
  print(-1)
else:
  print(x+1)
# Judge status: Accepted
from collections import Counter

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

acnt = Counter(A)

b = []

for k, v in acnt.items():
    if v < 2:
        continue
    if v >= 4:
        b.append(k)
    b.append(k)

b.sort()
if len(b) < 2:
    print(0)
else:
    print(b[-1]*b[-2])
# Judge status: Accepted
M, N = map(int, input().split())
print(M*N)
# Judge status: Wrong Answer
import numpy as np

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

Cn, ans = N * (N-1) // 2, 0

for i in range(60):
    count = np.sum(A % 2)
    A //= 2
    if count == 0:
        continue
    ans += (Cn - (count*(count-1)//2 + (N-count)*(N-count-1)//2)) * (2**i)
print(ans % (10**9 + 7))
# Judge status: Wrong Answer
N,M = map(int,input().split())
print(N/2+M/2)
# Judge status: Accepted
a, b, c, d = map(int, input().split())
print("Yes" if abs(a-c) <= d or (abs(a-b) <= d and abs(c-b) <= d) else "No")
# Judge status: Wrong Answer
a,b=map(int,input().split())
cnt=0
while a>0:
  a//=b
  cnt+=1
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = []
limit = 0
present = 1
total = 0
for i in range(n+1):
    limit += a[i]
for i in range(n+1):
    limit -= a[i]
    b.append(limit)
for i in range(n+1):
    if present > a[i]:
        total += present
        present = min((present-a[i])*2, b[i])
    elif present == a[i] and i == n:
        total += present
    else:
        total = -1
        break;
print(total)
# Judge status: Accepted
from collections import Counter


def main():
    n, k = map(int, input().split())
    As = map(int, input().split())
    ans = 0
    for num, count in Counter(As).most_common()[::-1][:-k]:
        ans += count
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
r = [0] * n
for i, j in enumerate(a):
    r[j - 1] = i + 1
print(*r)
# Judge status: Accepted
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()

d = []
for i in range(1, m):
    d.append(x[i]-x[i-1])
d.sort()
d.reverse()
print(sum(d)-sum(d[:n-1]))
# Judge status: Accepted
s = list(input())
s = list(set(s))
for i in range(ord("a"),ord("z")+1):
    if s.count(chr(i)) != 1:
        print(chr(i))
        exit()
print("None")
# Judge status: Accepted
N = int(input())

data = input().split()

data = [int(s) for s in data]

num = 0
ans = 0
sum = sum(data)

for i in range(N) :
  num += data[i]
  ans += (sum - num) * data[i]

print(ans % 1000000007)
# Judge status: Accepted
n = int(input())
a = []
res = False
for i in range(n):
    x, y = map(int, input().split())
    a.append(x == y)
    if i >= 2 and a[-1] and a[-2] and a[-3]:
        res = True
print('Yes' if res else 'No')
# Judge status: Wrong Answer
s=input()
n=''
result='Good'
for i in s:
    if s==n:
        result='Bad'
        break
    n=i
print(result)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
n=1
if a!=b:
 n+=1
if a!=c or b!=c:
 n+=1
print(n)
# Judge status: Wrong Answer
s = str(input())

print(s)
count =0
for xi in range(len(s)):
    if xi%2 ==0:t="0"
    if xi%2 ==1:t="1"

    if s[xi]==t:
        count+=1

# print(count)
print(min(count,len(s)-count))
# Judge status: Accepted
import numpy as np #numpyの練習がてら
n = int(input())
tmp = list(map(int,input().split()))

mod = 10**9 + 7
a = np.array(tmp,np.int64)

ans = 0
for i in range(60 + 1):
    b = (a >> i) & 1 #すべてのaについて2**n乗目のビットが1か否か
    iti = np.count_nonzero(b) #すべてのaのうち2**n乗目が1であるものの個数
    zero = n - iti #同様に0であるものの個数
    ans += (iti * zero) * pow(2,i,mod) % mod#片方1で片方0なら1なので1の個数×0の個数
ans %= mod
print(ans)
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
a_ls = list(map(int, input().split()))

c = Counter(a_ls)
edges_ls = [0] * 2
for value, count in c.items():
    if count >= 2:
        edges_ls.append(value)
edges_ls.sort()
ans = edges_ls[-1] * edges_ls[-2]
print(ans)
# Judge status: Wrong Answer
a = input()
 
cnt = 0
sakki5 = False
sakki6 = False
for s in a:
    if int(s) < 6:
        cnt += int(s)
        sakki6 = False
        if int(s) == 5:
            sakki5 = True
    else:
        cnt += 11 - int(s)
        if sakki6:
            cnt -= 2
        if sakki5:
            cnt -= 1
        sakki6 = True
        sakki5 = False
print(cnt)
# Judge status: Accepted
n, m = map(int, input().split())
a_list = list(map(int, input().split()))
a_list = sorted(a_list)

cnt = 0

for i in range(n):
    if a_list[i] >= sum(a_list)/(4*m):
        cnt += 1

if cnt >= m:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N=int(input())
if N%2==0:
  print((N/2)**2)
else:
  print((N//2)*(N-(N//2)))
# Judge status: Wrong Answer
import sys
from math import sqrt

def log(s):
    # print("| " + str(s), file=sys.stderr)
    pass


def output(x):
    print(x, flush=True)


def input_ints():
    return list(map(int, input().split()))


def main():
    n = int(input())
    r = 0
    i = 2
    while i <= n:
        if n % i == 0:
            r += 1
            n //= i
        if r == 0 and i > sqrt(n):
            r = 1
            break
        i += 1
    
    print(r)

main()
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))
A = [a - 1 for a in A]
D = 60
MAX_N = 200005
to = [[0] * MAX_N for _ in range(D)]
for i, a in enumerate(A):
    to[0][i] = a

for i in range(D - 1):
    for j in range(N):
        to[i + 1][j] = to[i][to[i][j]]

v = 0
for i in range(D - 1, -1, -1):
    l = 1 << i
    if l <= K:
        v = to[i][v]
        K -= l
print(v + 1)
# Judge status: Accepted
import collections
N,C,K=map(int,input().split())
T=[int(input()) for i in range(N)]
T.sort()

count=1
cus=0
pre=T[0]
for t in T:
    if C>cus and pre+K>=t:
        cus+=1
    else:
        cus=1
        pre=t
        count+=1
print(count)
# Judge status: Wrong Answer
a, b = (int(i) for i in input().split())
print(a+b/2)
# Judge status: Accepted
n = int(input())
A = [int(input()) for _ in range(n)]
S = set()
for a in A:
    if a in S:
        S.remove(a)
    else:
        S.add(a)
print(len(S))
# Judge status: Wrong Answer
n=int(input())
L=[]
cnt=0
while(n!=0):
    cnt+=1
    a=n%(2**cnt)
    b=(1 if a>0 else 0)
    L.append(b)
    n=n-(((-2)**(cnt-1))*b)
L=list(map(str,L))[::-1]
print("".join(L))
# Judge status: Wrong Answer
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

n,m = iim()

if n == 1:
    print(m-2)
elif m == 1:
    print(n-2)
else:
    print((n-2)*(m-2))
# Judge status: Accepted
A,B = map (int,input().split())
if A%3 == 0 or B%3==0 or (A+B)%3 == 0:
    print('Possible')
else:
    print('Impossible')
# Judge status: Accepted
from math import gcd

N, X = map(int, input().split())
xs = sorted(map(int, input().split()))
ds = [xs[i] - X for i in range(N)]
ans = abs(ds[0])
for d in ds:
    ans = gcd(abs(d), ans)
print(ans)
# Judge status: Wrong Answer
n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(n-2):
  l=[p[i],p[i+1],p[i+2]]
  if p[i+1]==min(l):
    ans+=1
print(ans)
# Judge status: Accepted
X, K, D = [int(x) for x in input().split()]

X = abs(X)
fl = X // D
cl = fl + 1

if fl > K:
    ans = X - K * D
elif K % 2 == fl % 2:
    ans = X - fl * D
else:
    ans = cl * D - X

print(ans)
# Judge status: Accepted
a, b, k = map(int, input().split())
flag, divisor, common_divisors = 0, 1, list()
while flag != -1:
    if a % divisor == 0 and b % divisor == 0:
        common_divisors.append(divisor)
    if divisor >= min(a, b):
        flag = -1
    divisor += 1
print(sorted(common_divisors, reverse=True)[k-1])
# Judge status: Wrong Answer
import sys

input = sys.stdin.readline
N, K = map(int, input().split())
A = list(map(int, input().split()))

print(N // (K-1))
# Judge status: Accepted
import sys
import numpy as np

n = input()

a = input().split()

a_n = np.array(a)

if (len(a) == np.unique(a_n).size):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
k, toayen, fromayen = map(int, input().split())
if fromayen <= toayen + 2 or k <= toayen:
    print(k + 1)
    exit()
k -= (toayen - 1)
bs = toayen
bs += (fromayen - toayen) * (k//2)
k %= 2
print(bs + 1 if k else bs)
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for _ in range(n)]
lis = ["0"]*n
bot = a[0]
lis[0] == "1"
cnt = 1
while True:
    if bot == 2:
        print(cnt)
        break
    elif lis[bot-1] == "1":
        print(-1)
        break
    else:
        cnt += 1
        bot = a[bot-1]
        lis[bot-1] = "1"
# Judge status: Wrong Answer
import sys
N,K = map(int,input().split())
L = []
for i in range(N):
  L.append(int(input()))
L.sort()
for i in range(N-K+1):
  if L[i:i+K] == [L[i] for _ in range(K)]:
    print(0)
    sys.exit(0)
print(L[K-1]-L[0])
# Judge status: Accepted
a,b,c,x = map(int, input().split())

if abs(c-a) <= x or (abs(c-b) <= x and abs(b-a) <= x):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S = input()
if (S[0] != S[1]) and (S[1] != S[2]) and (S[0] != S[2]):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import itertools

n,m,q=map(int,input().split())

lis=[i for i  in range(1,m+1)]
lis=list(itertools.combinations_with_replacement(lis,n))
box=[0 for j in range(len(lis))]

print(lis)

for i in range(q):
    que=list(map(int,input().split()))
    for j in range(len(lis)):
        if lis[j][que[1]-1]-lis[j][que[0]-1]==que[2]:
            box[j]+=que[3] 
print(max(box))
# Judge status: Wrong Answer
n,k,*x=map(int,open(0).read().split())
if x[0]>=0:
  ans=x[k-1]
elif x[-1]<=0:
  ans=abs(x[~(k-1)])
else:
  ans=10**10
  for i in range(n-k):
    l=x[i]
    r=x[i+k-1]
    if l<=0<=r:
      ll=abs(l)
      rr=abs(r)
      tmp=min(ll+2*rr,2*ll+rr)
      ans=min(ans,tmp)
      
print(ans)
# Judge status: Wrong Answer
x,y = map(int,input().split())

X = abs(x)
Y = abs(y)

ans = 0

if X > Y:
  if y > x:
    ans = min((y - x),abs(y - x) + 1)
  else:
    ans = abs(y - x) + 1
    if y > 0: # 符号再変換
      ans += 1
  
elif Y > X:
  if y > x:
    ans = min((y - x),abs(y - x) + 1)
  else:
    ans = abs(y - x) + 1
    if x < 0: # 符号再変換
      ans += 1
  
elif X == Y:
  if x == y:
    ans = 0
  else:
    ans = 1
    
print(ans)
# Judge status: Accepted

s = input()
t = input()
if t[:-1] == s:
    print("Yes")
else:
	print("No")
# Judge status: Wrong Answer
a,b=map(int,input().split())
i,count=1,a
while count<b:
    count+=a
    i+=1
print(i)
# Judge status: Wrong Answer
K = int(input())
if K % 2 == 0:
  print(K * K % 4)
else:
  print(int(((K-1)**2)/4+(K-1)/2))
# Judge status: Accepted
from heapq import *
N,M = map(int,input().split())
A = list(map(lambda x:-int(x),input().split()))
heapify(A)

for m in range(M):
  heappush(A,int(heappop(A)/2))

print(-sum(A))
# Judge status: Accepted
h, n = map(int, input().split())
a = list(map(int, input().split()))

if (h <= sum(a)):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
#!/user/bin/env python3
# -*- conding: utf-8 -*-

def main():
    S = input()
    N = len(S)
    flag = 'No'

    s1 = S[:int((N-1)/2)]
    s2 = S[int((N+3)/2)-1:]

    if S == S[::-1]:
        if s1 == s1[::-1]:
            if s2 == s2[::-1]:
                flag = 'Yes'
    
    print(flag)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
mod=10**9+7

x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
  exit()
  
if x*2>y or y*2>x:
  print(0)
  exit()
  
z=(x+y)//3

x-=z
y-=z

n=x+y
r=x


lst=[0]+[1]
for i in range(2,n+10):
  lst.append((lst[-1]*i)%mod)


xxx=lst[n]
xxx*=pow(lst[n-r],10**9+5,mod)
xxx%=mod
xxx*=pow(lst[r],10**9+5,mod)
xxx%=mod

print(xxx)
# Judge status: Wrong Answer
A, B, M = map(int, input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
X = 0
Y = 0
C = 0
Min = min(a) + min(b)

for _ in range(M):
    x, y, c = map(int, input().split())
    if c >= C:
        X = x - 1 
        Y = y - 1
        C = c

res = (a[X] + b[Y]) - C
if Min < res:
    print(Min)
    exit()
print(res)
# Judge status: Accepted
s = input()
t = input()

# print(s)
# print(t)

s_list = list(s)
t_list = list(t)
# print(s_list)
# print(t_list)    

s_list_sorted = sorted(s_list)
t_list_sorted = sorted(t_list, reverse=True)
# print(s_list_sorted)
# print(t_list_sorted)

s_sorted = ''.join(s_list_sorted)
t_sorted = ''.join(t_list_sorted)
# print(s_sorted)
# print(t_sorted)

if s_sorted < t_sorted:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
d = {0:4}
for a in A:
    d[a] = d.get(a, 0)+1
longest = 0
for i in d:
    if d[i]>=2:
        longest = max(longest, i)
d[longest]-=2

longest_2nd = 0
for i in d:
    if d[i]>=2:
        longest_2nd = max(longest_2nd, i)
print(longest*longest_2nd)
# Judge status: Accepted
a, b, t = map(int, input().split())

x = int(t / a)
print(b * x)
# Judge status: Wrong Answer
s = input()

while len(s) >= 5:
    if len(s) >= 5 and s[-5:] == 'dream':
        s = s[:-5]

    elif len(s) >= 7 and s[-7:] == 'dreamer':
        s = s[:-7]

    elif len(s) >= 5 and s[-5:] == 'erase':
        s = s[:-5]

    elif len(s) >= 6 and s[-6:] == 'eraser':
        s = s[:-6]

    else:
        break

if len(s) == 0:
    print('YES')
else:
    print('No')
# Judge status: Accepted
# coding: utf-8
import numpy as np
N = int(input())
A = []
for _ in range(2):
    A.append(list(map(int, input().split())))
dp = [[0] * N] * 2
dp = np.array(dp)
dp[0][0] = A[0][0]
dp[1][0] = A[0][0] + A[1][0]
for i in range(1, N):
    dp[0][i] = dp[0][i-1] + A[0][i]
    dp[1][i] = max(dp[0][i], dp[1][i-1]) + A[1][i]
print(dp[1][N-1])
# Judge status: Accepted
H,N = map(int,input().split())
magics = [list(map(int,input().split())) for _ in range(N)]

max_A = max(a for a,b in magics)
INF = 10**10
DP = [INF]*(H+max_A)
DP[0] = 0

for i in range(1,H+max_A):
    DP[i] = min(DP[i-a] + b for a,b in magics)
    
ans = min(DP[H:])
print(ans)
# Judge status: Wrong Answer
a, b = map(int,input().split())
if a >= b:
  print('b'*a)
else:
  print('a'*b)
# Judge status: Wrong Answer
n = int(input())
l = input().split(" ")
for i in range(len(l)):
    l[i] = int(l[i])

l.sort()
sum = 0
for i in range(1, n):
    sum += l[i]

if sum > l[0]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
if __name__ == "__main__":
    xy = tuple(map(int, input().split()))

    g1 = (1, 3, 5, 7, 8, 10, 12)
    g2 = (4, 6, 9, 11)

    if(len(set(xy) & set(g1)) == 2):
        print("Yes")
    elif(len(set(xy) & set(g2)) == 2):
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
S = input()
d = {'N': 0, 'W': 0, 'S': 0, 'E': 0}
prev = 'null'
for s_i in S:
    d[s_i] = 1
    if sum(d.values()) == 4:
        break
y = False
x = False
if (d['N'] and d['S']) or not(d['N'] or d['S']):
    y = True
if (d['W'] and d['E']) or not(d['W'] or d['E']):
    x = True
print('Yes' if y and x else 'No')
# Judge status: Accepted
s = input()
hi = [s[i:i+2] for i in range(0, len(s), 2)]

a = 0
for i in range(len(hi)):
  if hi[i] != 'hi':
    a += 1
    break
    
if a == 1:
  print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
import sys
a,b,c = map(int, input().split())
if a == b and b == c:
    count=0
    print(count)
    sys.exit()
    
ls = [a,b,c]
ls.sort(reverse=True)
count = 0
print(ls)
print(ls[0])

if (ls[1]-ls[2])%2 != 0:
    ls[2] = ls[2]+1
    ls[0] = ls[0]+1
    count +=1

while ls[1] - ls[2] >= 2:
    ls[2] += 2
    count += 1

if ls[1] - ls[2] == 1:
    ls[2] += 1
    count +=1

dif = ls[0] - ls[1]
count = count + dif

print(count)
# Judge status: Wrong Answer
A, B = map(int, input().split())
sum = A+B
if sum <= 24:
    print(sum)
else:
    while sum > 24:
        sum -= 24 
    print(sum)
# Judge status: Accepted
s=input()

d=[0]*2019
dp=0
d[0]+=1
l=len(s)
r=1

for i in range(l):
	dp+=int(s[l-1-i])*r
	dp%=2019
	r*=10
	r%=2019
	d[dp]+=1

res=0

for a in d:
	res+=a*(a-1)//2
	
print(res)
# Judge status: Wrong Answer
N=int(input())
count=0
L=list(map(int,input().split()))
for i in range(N):
  for j in range(i,N):
    for k in range(j,N):
      if L[i]<L[j]+L[k] and L[k]<L[j]+L[i] and L[j]<L[i]+L[k]:
        count+=1
print(count)
# Judge status: Accepted
N = int(input())
arr = list(map(int, input().split()))

ans = 0
for i in range(len(arr)):
    for j in range(i,len(arr),1):
        for k in range(j,len(arr),1):
            if arr[i] == arr[j] or arr[i] == arr[k] or arr[j] == arr[k]:
                continue
            if arr[k] < arr[i]+arr[j] and arr[i] < arr[j]+arr[k] and arr[j] < arr[i]+arr[k]:
                ans += 1

print(ans)
# Judge status: Accepted
N,A,B = map(int,input().split())

def check_num(n):
  s  = str(n)
  array = list(map(int,s))
  return sum(array)


list_1 = [i for i in range(1,N+1)]

list_2 = []

for _ in list_1:
  if A<=check_num(_)<=B:
    list_2.append(_)
  else:
    pass
  
print(sum(list_2))
# Judge status: Wrong Answer
import sys

rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))

n, k = rm()
a = rl()
k = min(k, 40)
if n <= k:
    for _ in range(n):
        print(n, end=' ')
    exit()
for _ in range(k):
    li = [0] * n
    for i in range(n):
      s = max(i - a[i], 0)
      e = min(i + a[i], n-1)
      for m in range(s, e+1):
        li[m] += 1
for v in a:
    print(v, end=' ')
# Judge status: Accepted
l,r=map(int,input().split())
mod=2019
ans=2018
if r-l+1>=2019 or r%mod<l%mod:
    ans=0
else:
    for i in range(l%mod,r%mod):
        for j in range(i+1,r%mod+1):
            temp=(i*j)%mod
            ans=min(ans,temp)

print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
sc = [tuple(map(int, input().split())) for _ in range(M)]

matches = []
for i in range(0, 1000):
    if len(str(i)) == N:
        temp = True
        for s, c in sc:
            if str(i)[s - 1] != str(c):
                temp = False
        if temp: matches.append(i)
print(-1) if len(matches) == 0 else print(min(matches))
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,l=map(int, input().split())
    l=[input() for i in range(n)]
    l.sort()
    print(''.join(l))
resolve()