peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import math

def resolve():
    a,b,c = map(int,input().split())
    print("Yes" if math.sqrt(c) > math.sqrt(a)+math.sqrt(b) else "No")


if __name__ == "__main__":
    resolve()
# Judge status: Accepted
N,M = map(int,input().split())
A = list(map(int,input().split()))

S = sum(A)
t = 0
for i in A:
    if i >= S/(4*M):
        t += 1
        
if t >= M:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from collections import defaultdict


N = int(input())
counter = defaultdict(int)
for a in map(int, input().split()):
    if a % 4 == 0:
        counter[2] += 1
    elif a % 2 == 0:
        counter[1] += 1
    else:
        counter[0] += 1
print('Yes') if counter[0] <= counter[2] else print('No')
# Judge status: Accepted
from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))
dic = defaultdict(int)

for t in A:
  dic[t] += 1
#print(dic)
ans = 0
for n,i in dic.items(): #key value
  if n > i:
    ans += i
  elif n < i:
    ans += (i-n)
print(ans)
# Judge status: Accepted
N = int(input())
X = []
X_L = []
X_L_dict = {}
for i in range(N):
    x, l = map(int, input().split())
    X_L.append([x-l, x+l])
    X.append(x-l)
X_L.sort(key=lambda x:x[1])
X.sort()

last = None

count = 0
# print(X_L)
for x_l in X_L:
    # print(x_l, last)
    if last is None or last <= x_l[0]:
        count += 1
        last = x_l[1]
print(count)
# Judge status: Accepted
a, b, k = map(int, input().split())

if b - a < 2 * k:
    for v in range(a, b+1):
        print(v)
else:
    for v in range(a, a+k):
        print(v)
    for v in range(b-k+1, b+1):
        print(v)
# Judge status: Accepted
a, b, c = map(int, input().split())
ans = c-(a-b)
if ans >= 0:
  print(ans)
else:
  print(0)
# Judge status: Accepted
S = input()

abc = "abcdefghijklmnopqrstuvwxyz"

dic = {s: True for s in abc}

for s in S:
    if dic[s]:
        dic[s] = False

for d in dic:
    if dic[d]:
        print(d)
        exit()

print("None")
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    W = [input() for _ in range(N)]
    reslut = 'Yes'
    if len(W) != len(set(W)):
        reslut = 'No'
    for i in range(1, N):
        if W[i - 1][-1] != W[i][0]:
            reslut = 'No'
    print(reslut)


if __name__ == "__main__":
    main()
# Judge status: Accepted
from collections import deque

n,m = map(int,input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
path = [[] for _ in range(n+1)]

for a,b in ab:
    path[a].append(b)
    path[b].append(a)

q = deque([1])
ans = [0] * (n+1)
while q:
    v = q.popleft()
    for w in path[v]:
        if ans[w] == 0:
            ans[w] = v
            q.append(w)

print('Yes')
print(*ans[2:], sep="\n")
# Judge status: Wrong Answer
n = int(input())
s = "bcdefghijk"
if n == 1:
    print("a")
elif n == 2:
    print("aa")
    print("ab")
elif n == 5:
    print("aaaab")
    print("aaaac")
    print("aaaad")
    print("aaaae")
    print("aaaaf")
# Judge status: Wrong Answer
w,a,b=map(int,input().split())
if len(sorted(set(range(a,a+w+1)) | set(range(b,b+w+1)))) !=0:
  print("0")
elif b>=a+w:
  print(b-a-w)
elif a>=b+w:
  print(a-b-w)
# Judge status: Wrong Answer
from collections import defaultdict
from collections import deque
from collections import OrderedDict
import itertools
from sys import stdin
input = stdin.readline


def main():
  N = int(input())

  nz = 0
  i = 1
  while True:
    if N//5**i//2 > 0:
      nz += N//5**i//2
      i += 1
    else:
      break

  print(nz)


if(__name__ == '__main__'):
  main()
# Judge status: Accepted
from operator import mul
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    N = int(input())
    X = list(map(int, input().split()))

    ans = INF
    x_min = min(X)
    x_max = max(X)
    for p in range(x_min, x_max + 1):
        tmp = 0
        for x in X:
            tmp += (x - p) ** 2
        ans = min(ans, tmp)
    
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
from math import pi, sin, cos, sqrt

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

x1 = A * cos(2 * pi * (H + M / 60) / 12)
y1 = A * sin(2 * pi * (H + M / 60) / 12)
x2 = B * cos(2 * pi * M / 60)
y2 = B * sin(2 * pi * M / 60)

print(sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)))
# Judge status: Accepted
ans = 0
n = int(input())

for i in range(1,n+1):
    if i%3 != 0 and i%5 != 0:
        ans += i
        
print(ans)
# Judge status: Accepted
from itertools import permutations

n = int(input())
p = list(map(str,input().split()))
p = ''.join(p)
q = list(map(str,input().split()))
q = ''.join(q)

arr = list(range(1,n+1))

l = []
for v in permutations(arr,n):
    v = list(v)
    v = list(map(str,v))
    l.append(''.join(v))

a = 0
b = 0
for i in range(len(l)):
    if l[i] == p:
        a = i
    if l[i] == q:
        b = i

print(abs(a-b))
# Judge status: Accepted
import math
import heapq
n,m = map(int, raw_input().split(' '))

heap = [-e for  e in map(int, raw_input().split(' '))]
heapq.heapify(heap)
while(m and heap):
	u = heapq.heappop(heap)
	u *= -1
	u /=2
	if u:
		heapq.heappush(heap, -u)
	m-=1
	"""

	q = int(math.ceil(math.log(u,2)))
	if 2 ** q <= u: q +=1
	if q <= m:
		m-= q
	else:
		u /= 2
		m -=1
		if u:
			heapq.heappush(heap, -u)

	"""
print -sum(heap or [0])
# Judge status: Wrong Answer
def fa(K,X):
    ch=""
    L=[X]
    for i in range(0,K):
        L.append(X-i)
        L.append(X+i)
    Q=set(L)
    C=str(Q)
    ch=C[1:len(C)-1]
    return ch
K,X=map(int,input().split())
print(fa(K,X).replace(",",""))
# Judge status: Accepted
n,m=map(int,input().split())
a=set([int(input()) for j in range(m)])
dp=[0]*(n+1)
dp[0]=1
if not 1 in a:
    dp[1]=1
else:
    dp[1]=0
for i in range(n-1):
    if i+2 in a:
        dp[i+2]=0
    else:
        dp[i+2]=(dp[i+1]+dp[i])%(10**9+7)
print(dp[n])
# Judge status: Accepted
s = input()
ans = 0
t = "01" * len(s)

for i in range(len(s)):
  if s[i] != t[i]:
    ans = ans + 1  
  
print(min(ans, abs(len(s)-ans)))
# Judge status: Accepted
n=int(input())
ac=0
wa=0
tle=0
re=0
for i in range(n):
  st=input()
  if st=='AC':
    ac+=1
  elif st=="WA":
    wa+=1
  elif st=="TLE":
    tle+=1
  elif st=="RE":
    re+=1
print('AC x '+ str(ac))
print("WA x "+ str(wa))
print("TLE x "+ str(tle))
print("RE x "+ str(re))
# Judge status: Accepted
def main():
    N = input()
    N = int(N[len(N) - 1])
    ans = ""
    if N in {2, 4, 5, 7, 9}:
        ans = "hon"
    elif N in {0, 1, 6, 8}:
        ans = "pon"
    else:
        ans = "bon"
    print(ans)
    return


main()
# Judge status: Accepted
from collections import deque
n = int(input())
a = list(map(str, input().split()))
b = []

b = a[1::2][::-1]+a[::2]
if len(a)%2==0:
    print(' '.join(b))
else:
    print(' '.join(b[::-1]))
# Judge status: Wrong Answer
H, N = map(int, input().split())
A = []
B = []
h = [10 ** 18] * (H + 1)

for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

for i in range(N):
    hi = H
    M = B[i]
    while hi - A[i] >= 0:
        hi = hi - A[i]
        h[hi] = min(h[hi], M)
        M += B[i]
        # print(a, b, h)
    h[0] = min(h[0], h[hi] + B[i])
    # print(i, hi, hi - a, h[hi] + b)
# print(h)
print(h[0])
# Judge status: Accepted
C=input()
print (chr(ord(C)+1))
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(int, input().split()))

p = A[0]
for i in range(1, K):
    p *= A[i]

result = []
for i in range(K, N):
    t = p // A[i - K] * A[i]
    if t > p:
        result.append('Yes')
    else:
        result.append('No')
print(*result, sep='\n')
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a>=b:
  ans = str(a) * b 
else:
  ans = str(b) * a

print(ans)
# Judge status: Wrong Answer
N=input()
ans=False
for n in N:
    if N.count(n)>=3:
        print("Yes")
        ans=True
        break
if not ans:
    print("No")
# Judge status: Accepted
from sys import stdin

n = int(stdin.readline().rstrip())
a = int(stdin.readline().rstrip())

if n%500 - a <= 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,m = map(int,input().split())
if n % 2 == 1:
  n = 2*m+1
  for i in range(m):
    print(m-i,m+1+i)
else:
  n = 2*m+2
  for i in range(m):
    l = m-i
    r = m+1+i
    if r-l >= m+1:
      r += 1
    print(l,r)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
S = input()
N = len(S)
s2 = S[:int((N-1)/2)]
s3 = S[int((N+3)/2 -1):]
if s2 == s2[::-1]:
    if s3 == s3[::-1]:
        print('Yes')
    else:
        print('No')
else:
    print('No')
# Judge status: Wrong Answer
def main():
    n = int(input())
    a = list(map(int,input().split()))
    s = 0
    for i, aa in enumerate(a):
        if i == 0:
            s = aa
        else:
            s ^= aa
    ans = []
    if s % 2 == 0:
        for i, aa in enumerate(a):

            ans.append(s^aa)
    else:
        for i, aa in enumerate(a):

            ans.append(~(s^aa))
    print(' '.join(map(str,ans)))

if __name__=='__main__':
    main()
# Judge status: Wrong Answer
n,x = map(int,input().split())
a = sorted(map(int,input().split()))
c=0
d=0
for i in a:
    if c+i<=x:
        c+=i
        d+=1
else:
    if c<x:
        d-=1
print(d)
# Judge status: Accepted
import random


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


def lcm(a, b):
    return (a * b) / gcd(a, b)



#a = list(map(int, input().split()))
n=int(input())
s=input()
l=0
r=n-1
c=0
while(l<r):
    if s[l]=='R':
        l+=1
    if s[r]=='W':
        r-=1
    if s[l]=='W' and s[r]=='R':
        c+=1
        l+=1
        r-=1

print(c)
# Judge status: Accepted
import math
a,b,c=map(int,input().split())
if c<=a+b:
    print("No")
elif 4*a*b < (c-a-b)*(c-a-b):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e - a > k:
    print(":(")
else:
    print("Yay!")
# Judge status: Accepted
a,b,c,d=map(int,input().split())

ab=abs(a-b)
bc=abs(b-c)
ca=abs(c-a)

if (ab<=d and bc<=d) or ca<=d:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
#Guide Book https://atcoder.jp/contests/abc128/tasks/abc128_b
N = int(input())
Shop_List=[]
for i in range(N):
    Temp_List=list(input().split())
    Temp_List[1]=int(Temp_List[1])
    Temp_List.append(i+1)
    Shop_List.append(Temp_List)


Shop_List_Sorted = sorted(Shop_List, key=lambda x:(x[0], x[1]))
for k in range(N):
    print(Shop_List_Sorted[k][2])
# Judge status: Wrong Answer
# coding: utf-8
import math

(n, m) = [int(i) for i in input().rstrip().split(" ")]

for i in range(n, int(math.sqrt(m)) + 1):
    if m % i == 0:
        print(int(m / i))
        break
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
ans=A[0]
for i in range(n-1):
  ans^=A[i+1]

for i in range(n):
  if n%2:
    use=A[i]
  else:
    use=A[i]^ans
  print(use)
# Judge status: Accepted
#A - 500 Yen Coins
K,X = list(map(int, input().split()))
sum = 500*K
if sum >= X:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
from math import floor, ceil


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort()
    lower = 1
    upper = a[-1]
    while lower + 1 < upper:
        target = (lower + upper) // 2
        now = 0
        for i in range(n):
            now += ceil(a[i] // target)
        if now > k:
            lower = target
        else:
            upper = target
    print(upper if k > 0 else a[-1])


if __name__ == '__main__':
    main()
# Judge status: Accepted
S = input()
n = len(S)
pattern1 = [i % 2 for i in range(n)]
pattern2 = [i % 2 for i in range(1, n+1)]
ans1 = 0
ans2 = 0
for i in range(n):
    s = S[i]
    if s == str(pattern1[i]):
        ans1 += 1
    if s == str(pattern2[i]):
        ans2 += 1
else:
    ans = min(ans1, ans2)
print(ans)
# Judge status: Accepted
a,b,c,d = map(int,input().split())
tk = 0
ao = 0
if c % b != 0:
  tk = c//b + 1
else:
  tk = c//b
if a % d != 0:
  ao = a//d + 1
else:
  ao = a//d
if tk <= ao:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
print("Yes" if "abc" == sorted(input()) else "No")
# Judge status: Accepted
def main():
    limit = int(input())
    result = False
    for i in range(26):
        for j in range(15):
            if 4 * i + 7 * j == limit:
                result = True
                break
    if result:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
n, k = map(int, input().split())                            
array = list(map(int, input().split()))
 
def jadgesuruo():
    for i in range(k):
        if str(n).find(str(array[i])) >= 0:
            return False
            break
    return True
 
for i in range(10**5):
    if jadgesuruo():
        print(n)
        break
    else:
        n = n + 1
# Judge status: Accepted
N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
A.sort()
B.sort()

if N % 2:
    l = A[N // 2]
    r = B[N // 2]
    print(r - l + 1)
else:
    l2 = A[N // 2 - 1] + A[N // 2]
    r2 = B[N // 2 - 1] + B[N // 2]
    print(r2 - l2 + 1)
# Judge status: Accepted
s = str(input())
n = int(input())
k = ord("z")
a = [0]*len(s)
for i in range(len(s)):
    a[i] = ord(s[i])
for i in range(len(s)):
    if a[i] == ord("a"):
        continue
    if n>=k+1-a[i]:
        n = n-k-1+a[i]
        a[i] = ord("a")
    
    if n<=0:
        break
if n>0:
    a[-1] += n%26
ans = ""
for i in range(len(s)):
    ans += chr(a[i])
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
def main():
    N, K = map(int, input().split())
    P = 0
    for i in range(1,N+1):
        value = i
        cnt = 0
        while K > value:
            cnt += 1
            value *= 2
        P += 1/N * (1/2)**cnt
    print(P)
            
if __name__ == '__main__':
    main()
# Judge status: Accepted
S = input()
l = len(S)
print('x' * l)
# Judge status: Wrong Answer
import sys
import collections

s = list(map(str,input()))
t = list(map(str,input()))
cnts = collections.Counter(s)
cntt = collections.Counter(t)
cs = sorted(cnts.values())
ct = sorted(cntt.values())

print(cs)
print(ct)

if len(s) != len(t):
    print("No")
    sys.exit()

for i,j in zip(cs,ct):
    if i != j:
        print("No")
        sys.exit()

print("Yes")
# Judge status: Accepted
n,a,b=map(int,input().split())
s=input()
cnt_a=0
cnt_b=0
for i in range(n):
  if s[i]=="a":
    if cnt_a+cnt_b<a+b:
      cnt_a+=1
      print("Yes")
    else:
      print("No")
  elif s[i]=="b":
    if cnt_a+cnt_b<a+b and cnt_b<b:
      cnt_b+=1
      print("Yes")
    else:
      print("No")
  else:
    print("No")
# Judge status: Accepted
N, K = map(int,input().split())
A = [int(x) for x in input().split()]

l = 0
r = max(A) + 1

while(l+1<r):
    m = (l+r)//2
    count = 0
    for a in A:
        count += (a-1) // m
    
    if count > K:
        l = m
    else:
        r = m
print(r)
# Judge status: Wrong Answer
l = list(map(int,input().split()))
N = l[0]
Y = l[1]

S = 0
man = 0
gosen = 0
sen = 0

for i in range(1):
    while S <= Y-10000:
        S = S + 10000
        man += 1
    
    while S <= Y-5000:
        S = S + 5000
        gosen += 1
    
    while S <= Y-1000:
        S = S + 1000
        sen += 1       

    if man + gosen +sen > N:
        print("-1,-1,-1")
        break
    
    else:
        print(man,gosen,sen)
# Judge status: Wrong Answer
n = int(input())

candy = n*(n+1)/2

print(candy)
# Judge status: Accepted
from collections import Counter

n = int(input())
a_array = [int(x) for x in input().split()]
d = Counter(a_array)
res = 0
for key, value in d.items():
    res += key * value
q = int(input())
bc_array = [[int(x) for x in input().split()] for y in range(q)]
for b, c in bc_array:
    d.setdefault(b, 0)
    res -= b * d[b]
    res += c * d[b]
    print(res)
    d[c] += d[b]
    d[b] = 0
# Judge status: Accepted
x,y=map(int,input().split())
ans=10**10
if x<y:print(min(ans,y-x,abs(x+y)+1))
else:print(min(ans,abs(x+y)+1,abs(x-y)+2))
# Judge status: Accepted
import math

N, K = map(int,input().split())
ans = 0
for i in range(1, N+1):
    if i < K:
        n = math.ceil(math.log(K/i, 2))
        ans += (1/N) * (1/2)**n
    else:
        ans += 1/N

print(ans)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
s=0
 
for i in range(a,b):
  if i%c==0:
    s+=1
  
print(s)
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split()))

arr = sorted(x)

for i in range(n):
    if x[i] <= arr[(n+1) // 2 - 1]:
        print(arr[(n+1) // 2])
    else:
        print(arr[(n+1) // 2 - 1])
# Judge status: Wrong Answer
S = input()
K = "keyence"
for i in range(len(K)):
  print(S[:i], S[(i-(len(K))):])
  if (K[:i] == S[:i]) and (K[(i-(len(K))):] == S[(i-(len(K))):]):
    print("Yes")
    exit()
if K == S[:len(K)] or K == S[(-len(K)):]:
  print("Yes")
  exit()
print("No")
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
import copy




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

INF = 1000000
kamban = [[-1, INF] for _ in range(n+1)]
kamban[1] = [1, 0]

for i in range(m):
    a, b = map(int, input().split())
    if kamban[a][1] <= kamban[b][1]:
        kamban[b] = [a, kamban[a][1]+1]
    else:
        kamban[a] = [b, kamban[b][1]+1]

if [-1, INF] in kamban[1:]:
    print("No")
else:
    print("Yes")
    for k in kamban[2:]:
        print(k[0])
# Judge status: Wrong Answer
n = int(input())
final = []
while 1:
    q = n//26
    r = n%26
    final.append(chr(ord('a')+(r-1)))
    n = q
    if q == 0:
        break
ans=''
for i in final:
    ans+=i
print(ans[::-1])
# Judge status: Accepted
a,b=map(int,input().split())
ans=(a+b+1)//2
print(ans)
# Judge status: Accepted
S = list(input())
k = (len(S) -1) // 2 
T = S[0:k]
#print(T[::-1])
print("Yes" if S == S[::-1] and T == T[::-1] else "No")
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
cnt_2 = []
cnt_4 = []
for i in a:
  if i%4 == 0:
    cnt_4.append(i)
  elif (i%4 != 0) and (i%2 == 0):
    cnt_2.append(i)
if len(cnt_2) == 0:
  if len(cnt_4)*2+1 >= n:
    print('Yes')
  else:
    print('No')
else:
  if len(cnt_2)+len(cnt_4)*2 >= n:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
import sys
input = sys.stdin.readline
def f():
  n=int(input())
  l=tuple(tuple(map(int,input().split())) for i in range(n-1))
  for i in range(n):
    now=0
    for a,s,d in l[i:]:
      now=a+s-(-max(0,now-s)//d)*d
    print(now)
if __name__=="__main__":
  f()
# Judge status: Accepted
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
for i in range(N-K):
  if A[i] < A[i + K]:
    print("Yes")
  else:
    print("No")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

res = [0]*N
for i in range(N):
    res[A[i]-1] = i+1
print(' '.join(map(str, res)))
# Judge status: Wrong Answer
l, r, d = map(int, input().split())
cnt = 0
for i in range(1, r - l + 2):
  if i % d == 0:
    cnt += 1
print(cnt)
# Judge status: Accepted
n, k = input().split()
a = int(n)
b = int(k)
s = input()
result = ''
for i in range(a):
    if i == b-1:
        result += chr(ord(s[i]) + 32)
    else:
        result += s[i]
print(result)
# Judge status: Accepted
n = int(input())
s = input()
x = 0
ans = [0]

for c in s:
    if c == 'I':
        x += 1
    else:
        x -= 1
    ans.append(x)
print(max(ans))
# Judge status: Accepted
n = int(input())
f = []
for _ in range(10000):
    f.append(0)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            id = x*x + y*y + z*z + x*y + y*z + z*x
            if id <= 10000:
                f[id-1] += 1
for i in range(n):
    print(f[i])
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N = int(readline().rstrip())
X = list(map(int, readline().split()))

lower = min(X)
upper = max(X)

ans = float("inf")
for P in range(lower, upper+1):
    dis = 0
    for x in X:
        dis += abs(P - x) ** 2
    ans = min(ans, dis)
print(ans)
# Judge status: Accepted
n,k=map(int, input().split())
a=list(map(int,input().split()))
ans=0

if n==k:
  print(1)
  exit()

if (n-1)%(k-1) == 0:
  print((n-1)//(k-1))
else:
  print((n-1)//(k-1)+1)
# Judge status: Accepted
N, A, B = map(int, input().split())

S = input()

total = 0
abroad = 0

for s in S:
  if s == 'a' and total < (A+B):
    print('Yes')
    total += 1
  elif s == 'b' and total < (A+B) and abroad < B:
    print('Yes')
    total += 1
    abroad += 1
  else:
    print('No')
# Judge status: Accepted
d = int(input())
if(d == 22):
  print('Christmas Eve Eve Eve')
elif(d == 23):
  print('Christmas Eve Eve')
elif(d == 24):
  print('Christmas Eve')
else:
  print('Christmas')
# Judge status: Wrong Answer
from fractions import gcd

N, M = map(int, input().split())
alist = list(map(int, input().split()))
alist = list(map(lambda x: x//2, alist))
alist = list(set(alist))

ans = alist[0]

for i in range(1, len(alist)):
    ans = ans * alist[i] // gcd(ans, alist[i])

print((M-ans)//(2*ans) + 1)
# Judge status: Wrong Answer
def main():
    from collections import deque
    n = int(input())
    s = input()
    t = s.count("()")
    c_l = 0
    c_r = 0

    for i in s:
        if i == ")":
            c_l += 1
        else:
            c_r += 1

    c_l -= t
    c_r -= t
    print(c_l * "(" + s + ")" * c_r)


if __name__ == '__main__':
    main()
# Judge status: Accepted
A,B,N = map(int, raw_input().split())

x = min(B,N)
if x == B:
	x = B - 1
print A*x/B
# Judge status: Accepted
n, m = map(int, input().split())
xy = [tuple(map(int, input().split())) for _ in range(m)]

gray = [False] * n
gray[0] = True
ball = [1] * n

for x, y in xy:
    x -= 1; y -= 1
    ball[x] -= 1
    ball[y] += 1
    if gray[x]:
        gray[y] = True
    if not ball[x]:
        gray[x] = False

print(sum(gray))
# Judge status: Accepted
n=input()
if(n>='A' and n<='Z'):
    print('A')
else:
    print('a')
# Judge status: Wrong Answer
S=input()

ans=0

for i in range(len(S)-5):
    for j in range(i+5,len(S)):
        if int(S[i:j+1])%12114==0:
            ans += 1

print(ans)
# Judge status: Wrong Answer
import itertools
import math

N = int(input())
x = [0]*N
y = [0]*N
for i in range(N):
    x[i], y[i] = map(int, input().split())
    
a = list(itertools.permutations([i for i in range(1, N+1)]))

n = math.factorial(N)

road = 0
for i in range(n-1):
    for j in range(N):
        road += math.sqrt((x[a[i][j]-1]-x[a[i+1][j]-1])**2+(y[a[i][j]-1]-y[a[i+1][j]-1])**2)
        
print(road/n)
# Judge status: Wrong Answer
n = int(input())
s = input()

print(s[:int(n/2)])
print(s[int(n/2):])


if s[:int(n/2)] == s[int(n/2):]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import sys
from collections import deque

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

res = deque()
t = (N + 1) % 2

for i in range(N):
    if i % 2 == t:
        res.appendleft(A[i])
    else:
        res.append(A[i])

print(*res)
# Judge status: Wrong Answer
N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]

if K - Q > 0:
    for _ in range(N):
        print('Yes')
else:
    l = [K] * N
    for i,v in enumerate(A):
        l[v-1] = l[v-1] + 1
    for i in l:
        if i > (K+1):
            print('Yes')
        else:
            print('No')
# Judge status: Accepted
from collections import Counter


def main():
    N = int(input())
    A = [input() for _ in range(N)]

    c = Counter(A)
    d = c.most_common()
    ans = []
    for i in c.items():
        if i[1] == d[0][1]:
            ans.append(i[0])
    for i in sorted(ans):
        print(i)


if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys

N,M = (int(x) for x in input().split())
if N >= M:
  print("0")
  sys.exit()
  
cnt = 0
  
x = list(map(int,input().split()))
x.sort()

cost = {}
for i in range(len(x)-1):
  cost[i] = x[i+1] - x[i]
num = -1
cost = sorted(cost.items(), key=lambda x:x[1],reverse=True)
for i in range(N-1):
  a = cost[i][0]
  cnt += x[a] - x[num+1]
  num = a
cnt += x[len(x)-1] - x[num+1]
print(cnt)