peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
string = input()
array = string.split(' ')
a = int(array[0])
b = int(array[1])
c = int(array[2])
k = int(array[3])

answer = 0
if a >= k:
  answer = k
else:
  answer = a
  if b >= k - a:
    answer += 0
  else:
    answer -= k - a - b
print(answer)
# Judge status: Wrong Answer
import sys

X,Y = list(map(int, input().split()))

YES = "Yes"  
NO = "No" 

for i in range(X+1):
    two = i
    four = X-i
    
    if 2 * two + 4 * four == Y:
        print(YES)
        sys.exit()

print(NO)
# Judge status: Wrong Answer
N = int(input())
H = list( map(int,input().split()) )


for i in range(N-1):
    if H[i] - H[i+1] >= 2:
        print('No')
        exit(0)
    elif H[i] - H[i+1] == 1:
        H[i] -= 1

for j in range(N-1):
    if H[j] > H[j+1]:
        print('No')
        exit(0)

print('Yes')
# Judge status: Accepted
n = int(input())
ws = [int(i) for i in input().split() ] 
ans = sum(ws)-ws[0]
for t in range(1,n):
    s1 = sum(ws[:t])
    s2 = sum(ws) - s1
    ans = min(ans,abs(s1 - s2))

print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split(' ')))
ans = []
for i in range(1,101):
    cost = 0
    for j in range(N):
        cost += (A[j] - i)**2
    ans.append(cost)
import heapq
heapq.heapify(ans)
print(heapq.heappop(ans))
# Judge status: Accepted
from collections import Counter, defaultdict
n = int(input())
s = [input() for i in range(n)]

cnt = defaultdict(lambda :[0, 0])
for S in s:
    temp = Counter(S)
    for key, val in temp.items():
        if cnt[key] == [0, 0]:
            cnt[key] = [val, 1]
            continue
        if cnt[key][0] > val:cnt[key][0] = val
        cnt[key][1] = cnt[key][1] + 1

ans = []
for key, val in cnt.items():
    if val[1] == n:
        ans += key * val[0]
print(*sorted(ans), sep='')
#print(cnt)
# Judge status: Accepted
import queue
K = int(input())
q = queue.Queue()
for i in range(1, 10):
    q.put(i)
for _ in range(K):
    x = q.get()
    d = x%10
    t = x*10
    if d != 0:
        q.put(t-1+d)
    q.put(t+d)
    if d != 9:
        q.put(t+1+d)
print(x)
# Judge status: Wrong Answer
a = int(input())
b = int(input())

if a == 1 and b == 2:
    print(3)
elif a == 1 and b == 3:
    print(2)
elif a == 2 and b == 1:
    print(3)
elif a == 2 and b == 3:
    print(1)
elif a == 3 and b == 1:
    print(2)
else:
    print(3)
# Judge status: Wrong Answer
S = list(set(list(input())))
S.sort(reverse=False)
n = 97

for i in range(len(S)):
  if S[i] != chr(n):
    print(chr(n))
    exit()
  n += 1

print('None')
# Judge status: Accepted
S = input()

NS = (("S" in S) & ("N" in S)) | (("S" not in S) & ("N" not in S))
EW = (("E" in S) & ("W" in S)) | (("E" not in S) & ("W" not in S))

print("Yes") if NS & EW else print("No")
# Judge status: Wrong Answer
n = int(input())
ans = 0

d = 2
while d * d < n:
    if n % d != 0:
        d += 1
        continue

    e = d
    while n % e ==0:
        n //= e
        e *= d
        ans += 1

if n != 1:
    ans += 1

print(ans)
# Judge status: Wrong Answer
N = list(input())
M = list(input())
count =0
for i in range(len(N)+1):
  
  a = M.pop(0)
  M.append(a)
  if M == N:
    count +=1
if count == 1:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
l.sort()
sum=0
for i in range(len(l)-1):
    sum+=l[i]

if(sum>l[len(l)-1]):print("Yes")
else:print("No")
# Judge status: Accepted
n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

for i in range(m):
    ab[i].append(i)

ab_l = sorted(ab, key=lambda x: x[1])
ab_ll = sorted(ab_l, key=lambda x: x[0])

temp = 1
for j in range(m):
    if j==0 or ab_ll[j][0] != ab_ll[j-1][0]:
        temp = 1
    else:
        temp +=1
    ab_ll[j].append(temp)

ab_lll = sorted(ab_ll, key=lambda x: x[2])

for i in range(m):
    print(str(ab_lll[i][0]).zfill(6)+str(ab_lll[i][3]).zfill(6))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
N = sum(a)

s = 1
S = 1
if a[0] > 1 or (a[0] >= 1 and len(a) > 1):
    S = -1
else:
    for i in range(1,n+1):
        if a[i] > 2*s:
            S = -1
            break
        if s*2 <= N:
            S += s*2
            s += s - a[i]
        else:
            S += N
            s += N - s - a[i]
        N -= a[i]
print(S)
# Judge status: Accepted
a=list(map(int,input().split()))
print("win" if sum(a)<=21 else "bust")
# Judge status: Accepted
N = int(input())
D = list(map(int,input().split()))
D.sort()

M = N//2
ans = D[M] - D[M-1]

if D[M] == D[M-1]:
  ans = 0

print(ans)
# Judge status: Wrong Answer
import math
print(math.factorial(int(input()))%(10**7+7))
# Judge status: Accepted
S = input()
s = ''
for i in S:
  s+='x'
print(s)
# Judge status: Accepted
from bisect import bisect_right
n = int(input())
a = int(input())
x = [a * (-1)]
for _ in range(n-1):
  a = int(input()) * (-1)
  if a >= x[-1]:
    x.append(a)
  else:
    index = bisect_right(x, a)
    x[index] = a
print(len(x))
# Judge status: Wrong Answer
N = int(input())
print((N*(N+1))/2)
# Judge status: Accepted
n = int(input())
s = list(input())
m = 0
l = 0
for i in range(n):
    if s[i] == ")":
        m += 1
    else:
        m -= 1
    if l < m:
        l = m
s1 = ["("] * l
for i in s:
    if i == "(":
        l += 1
    else:
        l -= 1
s2 = [")"] * l
s = s1 + s + s2
print("".join(s))
# Judge status: Wrong Answer
s=input()
l=[0]*2019
d=1
x=0
for i in range(len(s)):
  x+= d* int(s[len(s)-i-1]) %2019
  l[x%2019]+=1
  d*=10
ans=0
for i in range(1,2019):
  ans+=l[i]*(l[i]-1)//2
print(ans+l[0])
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, k, *x = map(int, read().split())

ans = float('inf')
for i in range(n - k + 1):
    right = x[i + k - 1]
    left = x[i]
    if right <= 0:
        time = abs(left)
    elif left <= 0 < right:
        time = abs(right-left)
        time += min(abs(right), abs(left))
    elif 0 < left:
        time = abs(right)
    ans = min(ans, time)
print(ans)
# Judge status: Accepted
n = int(input())
H = list(map(int, input().split()))[::-1]
ok = True
for i in range(n-1):
    if H[i] >= H[i+1]: continue
    if H[i] >= H[i+1]-1:
        H[i+1] -= 1
    else:
        ok = False
        break
print("Yes" if ok else "No")
# Judge status: Accepted
n=int(input())

l=list(map(int, input().split()))
l=sorted(l)
s=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if l[j]+l[i]>l[k] and l[i]!=l[j] and l[j]!=l[k]:
        s+=1
print(s)
# Judge status: Wrong Answer
s = input()

od = s[0 : -1 : 2]
ev = s[1 : -1 : 2]

if all(x != 'L' for x in od) and all(y != 'R' for y in ev):
  print('Yes')

elif len(s) == 1:
  if s[0] == 'L':
    print('No')
  else:
    print('Yes')
  
else:
  print('No')
# Judge status: Wrong Answer
A, B, C, K = map(int, input().split())

m = A - B

if (K % 2 == 0):
    if m > 10**18:
        print('Unfair')
    print(m)
else:
    if (abs(m) > 10**18):
        print('Unfair')
    print(abs(m))
# Judge status: Wrong Answer
n = int(input())
if n % 7 == 0 or n % 7 == 4:
    print('Yes')
elif n % 4 == 0 or n % 4 == 7:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import bisect

n = int(input())
l = sorted(list(map(int, input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l, l[i]+l[j]) - (j+1)
print(ans)
# Judge status: Wrong Answer
n=int(input())
s=[(input()) for _ in range(n)]

lis=[list(s[i]) for i in range(n)]
lis_sort = [sorted(lis[i]) for i in range(n)]
lis_sort = [''.join(lis_sort[i]) for i in range(n)]

cnt=0#counter
ans=0
for i in range(n-1):
    if lis_sort[i]==lis_sort[i+1]:
        cnt+=1
    elif lis_sort[i]!=lis_sort[i+1]:
        ans+=cnt+1
        cnt=0

print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
A = []
for _ in range(n):
    a,b = map(int,input().split())
    A.append([a,b])
A.sort()
for a,b in A:
    if k >b:
        k -=b
    else:
        print(a);exit()
# Judge status: Accepted
a, b = map(int, input().split())
print(int(a * b))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
plus={}
minus={}
for i in range(n):
  if(a[i]+(i+1)<=10**9):
    if a[i]+(i+1) in plus.keys():
      plus[a[i]+(i+1)]+=1
    else:
      plus[a[i]+(i+1)]=1
  if(a[i]<(i+1)):
    if (i+1)-a[i] in minus.keys():
      minus[(i+1)-a[i]]+=1
    else:
      minus[(i+1)-a[i]]=1
ans=0
for i in plus.keys():
  if i in minus.keys():
    ans+=plus[i]*minus[i]
print(ans)
# Judge status: Wrong Answer
s = int(input()) * 2

x1, y1, x2, y2 = 0, 0, 1, 10**9
y3, x3 = divmod(s, y2)

print(x1, y1, x2, y2, x3, y3)
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
d=[max(a)//2]
a.pop(0)
for i in range(m-1):
  if len(a)<=0:
    break
  if a[0]>=d[0]:
    d.append(a[0]//2)
    a.pop(0)
  else:
    d.append(d[0]//2)
    d.pop(0)
print(sum(d)+sum(a))
# Judge status: Accepted
import sys

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

if all(x % 2 == 0 for x in A):
    print("Yes")
else:
    cnt4 = 0
    cnt2 = 0
    for a in A:
        if a % 4 == 0:
            cnt4 += 1
        elif a % 2 == 0:
            cnt2 += 1
    cntOdd = N - cnt4 - cnt2
    if cntOdd <= cnt4 or (abs(cntOdd - cnt4) <= 1 and cnt2 == 0):
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
import sys
from collections import Counter
readline = sys.stdin.readline

S = list(map(int, readline().strip()))
N = len(S)
C = Counter()
C[0] = 1
ans = 0
MOD = 2019
res = 0
for i in range(N):
    s = S[N-1-i]
    res = (res+s*pow(10, i, MOD))%MOD
    ans += C[res]
    C[res] += 1
print(ans)
# Judge status: Accepted
n=int(input())
s=set()
current=1
cusum=0
while cusum<n:
  cusum+=current
  s.add(current)
  current+=1
if cusum-n in s:
  s.remove(cusum-n)
for i in s:
  print(i)
# Judge status: Wrong Answer
N = int(input())
a = 0
for i in range(1,N):
    if i%2==1:
        a += 1
print(float(a/N))
# Judge status: Wrong Answer
A, B, C = (int (x) for x in input().split())
abclist = (A, B, C)

if abclist.count(5) == 2 and abclist.count(7) == 1:
    print("Yes")

else: 
    print("No")
# Judge status: Accepted
#082_B
s=sorted(list(input()))
t=sorted(list(input()))[::-1]
print('Yes' if "".join(s)<"".join(t) else 'No')
# Judge status: Accepted
N=input();
N=int(N);
S=[];
ans=[0,0,0,0];
for i in range(N):
  s=input();
  if s=="AC":
    ans[0]=ans[0]+1;
  if s=="WA":
    ans[1]=ans[1]+1;
  if s=="TLE":
    ans[2]=ans[2]+1;
  if s=="RE":
    ans[3]=ans[3]+1;
print("AC x "+str(ans[0]));
print("WA x "+str(ans[1]));
print("TLE x "+str(ans[2]));
print("RE x "+str(ans[3]));
# Judge status: Wrong Answer
import math
from decimal import *
x = list(map(int, input().split())) 
a = float(Decimal(math.sqrt(x[0])))
b = float(Decimal(math.sqrt(x[1])))
c = float(Decimal(math.sqrt(x[2])))

if a + b < c:
	print("Yes")
else:
	print("No")
# Judge status: Accepted
lst = list(map(int, input().split()))
cnt = 1
for l in lst:
    if l == 0:
        print(cnt)
        break
    cnt += 1
# Judge status: Wrong Answer
n,m=[int(x) for x in input().rstrip().split()]
l=[]
for i in range(n):
  ab=[int(x) for x in input().rstrip().split()]
  l.append(ab)

l=sorted(l,key=lambda x :x[0],reverse=True)
l=sorted(l,key=lambda x: x[1],reverse=True)

now_time=0
ans=0
for a,b in l:
  if (now_time+a)<=m:
    ans+=b
  now_time+=1

print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
X = list(map(int, input().split()))

lis = []
for i in range(N-K+1):
    left = X[i]
    right = X[i+K-1]
    res = right - left
    abs_l, abs_r = abs(left), abs(right)
    if abs_l > abs_r: 
       res += abs_r
    else:
       res += abs_l
    lis.append(res)
print(min(lis))
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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


if a * b < 0:
    print("Zero")
elif a == 0 or b == 0:
    print("Zero")
elif a > 0 and b > 0:
    print('Positive')
else:
    minus = abs(b - a) + 1
    if minus % 2 == 0:
        print('Positive')
    else:
        print('Negative')
# Judge status: Accepted
from bisect import bisect_right
from itertools import accumulate

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

arr.sort()
arr = list(accumulate(arr))


happy = bisect_right(arr, x)

if happy == n:
    if arr[-1] != x:
        happy -= 1

print(happy)
# Judge status: Accepted
n = int(input())
cnt = 0
for i in range(1, n + 1):
    if len(str(i)) % 2 == 1:
        cnt += 1
print(cnt)
# Judge status: Accepted
from sys import stdin
import re
import bisect

line = stdin.readline().rstrip()
if line == 'ABC':
    print('ARC')
else:
    print('ABC')
# Judge status: Accepted
x, y = map(int, input().split())

gr1=[1,3,5,7,8,10,12]
gr2=[4,6,9,11]
gr3=[2]

if x in gr1 and y in gr1:
    print('Yes')
elif x in gr2 and y in gr2:
    print('Yes')
elif x in gr3 and y in gr3:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n,*p=map(int,open(0).read().split())
cnt=0
for i in range(n-1):
  if p[i]<p[i+1]:
    cnt+=1
print(n-cnt)
# Judge status: Accepted
S=input()
T=input()
ans=len(T)

if len(T)!=len(S):
    for j in range(len(S)-len(T)+1):
        total=0
        for i in range(len(T)):
            if S[i+j]!=T[i]:
                total+=1
        if ans>=total:
            ans=total
else:
    ans=0
    for j in range(len(T)):
        if T[j]!=S[j]:
            ans+=1

print(ans)
# Judge status: Accepted
import sys
input =sys.stdin.readline

N=int(input().rstrip('\n'))
As=[int(x) for x in input().rstrip('\n').split()]
As_s=sorted(As,reverse=True)
res = As_s[0]
num = 2
if N>2:
  for i in As_s[1:]:
    res += i
    num += 1
    if num ==N:
      break
    res += i
    num += 1
    if num==N:
      break
print(res)
# Judge status: Accepted
n,k = map(int,input().split())
p = list(map(int,input().split()))
wa = sum(p[0:k])
next_wa = wa
for i in range(n-k):
    next_wa = next_wa - p[i] + p[i+k]
    if  next_wa > wa:
        wa = next_wa
print(0.5*(wa+k))
# Judge status: Wrong Answer
n=int(input())
if(n%2==0):
  print(-1)
elif(n==999983):
  print(999982)
elif(n==101):
  print(4)
# Judge status: Wrong Answer
s = input()
l = 0
r = 0
for i in range(len(s)):
    if s[i] == 'A' and l == 0:
        l = i
    elif s[i] == 'Z':
        r = i
print(r-l+1)
# Judge status: Accepted
N, K = map(int, input().split())
digits = 0
while(N > 0):
    N //= K
    digits += 1
print(digits)
# Judge status: Accepted
a,b = map(int, input().split())
h = b-a
tmp = [sum(range(1,i)) for i in range(1,h+2)]
print(tmp[-1] - b)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=1

for i in range(n):
    ans*=a[i]
    if ans==0 or ans>10**18:
        break

    

if ans<=10**18:
    print(ans)
else:
    print(-1)
# Judge status: Accepted
from collections import deque

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

b=deque()

if n%2==0:
    for i in range(n):
        if i%2==0:
            b.append(a[i])
        else:
            b.appendleft(a[i])

else:
    for i in range(n):
        if i%2==0:
            b.appendleft(a[i])
        else:
            b.append(a[i])

print(*b)
# Judge status: Accepted
a,b=map(int,input().split())
print(max(2*a-1,a+b,2*b-1))
# Judge status: Wrong Answer
N = int(input())
S = list(map(str,list(input())))
c = 0

for i in range(N-2) :
    for j in range(i+1,N-1) :
        for k in range(j+1,N) :
            print(i,j,k)
            if S[i] != S[j] and S[j] != S[k] and S[k] != S[i] and ( j-i != k-j) :
                c += 1

print(c)
# Judge status: Accepted
a,b=map(int,input().split())
c=list(map(int,input().split()))
c.sort()
i=0
total=0
while True:
    if b<c[i]:
        print(total)
        break
    elif i==a-1:
        if b==c[i]:
            print(total+1)
        else:
            print(total)
        break
    else:
        total+=1
        b=b-c[i]
        i+=1
# Judge status: Accepted
a = int(input())
s = input()

if a < 3200:
    print("red")
else:
    print(s)
# Judge status: Accepted
x = int(input())
xSum = 0
cnt = 1

while True:
  xSum += x
  if xSum%360 == 0:
    break
  cnt += 1
print(cnt)
# Judge status: Accepted
import heapq, math

n, m = map(int, input().split())
A = list(map(int, input().split()))
a = list(map(lambda x: x*(-1), A))
heapq.heapify(a)
for i in range(m):
    max_a = heapq.heappop(a)
    heapq.heappush(a, math.ceil(max_a/2))
print(-sum(a))
# Judge status: Accepted
k,n=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a)
maxi=0
for i in range(n-1):
    tmp=a[i+1]-a[i]
    maxi=max(tmp,maxi)

if maxi<=a[0]+(k-a[-1]):
    print(max(a)-min(a))
else:
    print(k-maxi)
# Judge status: Accepted
import numpy as np
n,k,q = map(int, input().split())
a = [int(input()) for i in range(q)]
#cnt = [0 for _ in range(n)]
win = [0 for _ in range(n)]
#p = np.array([k for _ in range(n)])
for ai in a:
  win[ai-1] += 1
#print(win)

for w in win:
  if k-q+w<=0: print('No')
  else: print('Yes')
# Judge status: Accepted
list = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']

s = input()

i = list.index(s)
answer = 7 - i

print(answer)
# Judge status: Wrong Answer
s = input()
if s[0]==s[1] and s[0]==s[2] and s[2]==s[3]:
    print("Yes")
elif s[0]==s[2] and s[0]==s[1] and s[1]==s[3]:
    print("Yes")
elif s[0]==s[3] and s[0]==s[1] and s[1]==s[2]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
m = len(str(n))
if m == 1:
  print(n)
elif m == 2:
  print(9)
elif m == 3:
  print(9 + n - 99)
elif m == 4:
  print(909)
elif m == 5:
  print(909 + n -9999)
else:
  print(90909)
# Judge status: Wrong Answer
K = int(input())

answer = [0]

for k in range(K):
  minvalue = min(answer)
  if minvalue == 9:
    for i in range(len(answer)):
      answer[i] = 0
    answer.append(1)
  else:
    target = answer.index(minvalue)
    answer[target] += 1
    if target != 0:
      for i in range(len(answer) - target):
        iindex = target - i - 1
        if 1 <= iindex + 1 <= len(answer) - 1:
          answer[iindex] = max(0, answer[iindex + 1] - 1)
print(answer)
answer.reverse()
print(''.join(map(str, answer)))
# Judge status: Accepted
n, a, b = map(int, input().split())
ans_array = []
for i in range(1, n + 1):
    s = str(i)
    array = list(map(int, s))
    sum_array = sum(array)
    if sum_array >= a and sum_array <= b:
        ans_array.append(i)
print(sum(ans_array))
# Judge status: Accepted
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

H.sort()
for i in range(n-k):
    count+=(H[i])
print(count)
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=sorted(map(int,input().split()))
c={}
for _ in range(m):
    bx, cx =map(int,input().split())
    c[cx]=bx
c_sort=sorted(c.keys(),reverse=1)

c_list=[]
for j in c_sort:
  for _ in range(c[j]):
    if len(c)>=n:
      break
    else:
      c_list.append(j)

c_len=len(c_list)
sum=0

for i in range(n):
    if i+1<=c_len:
        sum+=max(a[i],c_list[i])
    else:
        sum+=a[i]
print(sum)
# Judge status: Wrong Answer
x=int(input())
b=0;
lst=[]
acs=0
was=0
res=0
tles=0
while(b<x):
    new=input()
    lst.append(new)
    b+=1
for c in lst:
    if(c=='AC'):
        acs+=1
    if(c=='WA'):
        was+=1
    if(c=='RE'):
        res+=1
    if(c=='TLE'):
        tles+=1
print('AC X '+str(acs))
print('WA X '+ str(was))
print('RE X ' +str(res))  
print('TLE X ' +str(tles))
# Judge status: Accepted
import bisect

N = int(input())
numbers = [int(i) for i in input().split()]
numbers = sorted(numbers)
counter = 0

for a in range(N):
    for b in range(a+1, N):
        c = bisect.bisect_left(numbers, numbers[a] + numbers[b])
        if c > b:
            counter += c - b -1
        
print(counter)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
cnt = 0

for i in range(n - 1):
    if a[i] == i + 1:
        cnt += 1
        a[i],a[i+1]=a[i+1],a[i]
print(cnt)
# Judge status: Wrong Answer
n = int(input())
a = sorted(list(map(int,input().split())),reverse=True)
sum_a = 0
for i in range(1,2*n+1,2):
    print(a[i])
    sum_a += a[i]
print(sum_a)
# Judge status: Wrong Answer
import math

li = list(map(int,input().split()))
A=li[0]
B=li[1]
H=li[2]
M=li[3]

long = M/60 * 360
short = H/12 * 360 + M/60 * 30

def f(a,b,angle):
    c2 = a*a + b*b -2*a*b*math.cos(math.radians(angle))
    return math.sqrt(c2)

angle = 0
ans = 0
if(short==long):
    ans = abs(A-B)
elif(abs(short-long) == 180):
    ans = A+B
else:
    angle = abs(short-long)
    if(angle > 180):
        angle = 180 - angle
    ans = f(A,B,angle)

print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-
import sys


S=input()

if S[2]==S[3] and S[4]==S[5]:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n, a, b = map(int,input().split(' '))
total = 0
for num in range(1,n+1):
    split_nums = [int(s) for s in list(str(num))]
    sum = 0
    for s in split_nums:
        sum += s
    if a <= sum and sum <= b:
        print(split_nums, sum)
        total += num
print(total)
# Judge status: Wrong Answer
s = input()
ans=0
for i in range(len(s)):
  if s[i] == "S":
    ans+=1
  elif i>len(s):
    break
    
print(ans)
# Judge status: Accepted
N=int(input())
*A,=map(int, input().split())
col = [0]*8
free=0
for a in A:
    for i in range(8):
        if 400*i <= a < 400*(i+1): col[i] = 1
    if a >= 3200: free+=1

print(1 if sum(col) == 0 and free else sum(col), sum(col)+free)
# Judge status: Wrong Answer
a,b,c=map(int, input().split())
if a+b<c:
  print('NO')
elif a<c:
  print('NO')
else:
  print('YES')
# Judge status: Wrong Answer
n = int(input())
for i in range(1,9):
  for j in range(1,9):
    if i * j ==n:
      print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N=int(input())
A=sorted(map(int,input().split()))
ans=0
for i in range(N-1):
  ans+=A[i]
if ans<A[N-1]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
ans = ""
O = input()
E = input()
for o, e in zip(O, E):
    ans += o + e
if len(O) > len(E):
    ans += O[-1]

print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
X = [tuple(map(int, input().split())) for _ in range(n)]
Y = [tuple(map(int, input().split())) for _ in range(m)]


for x in X:
    d1 = sum(x)
    d2 = x[0] - x[1]
    z = 10 ** 9
    for i, y in enumerate(Y, 1):
        D1 = sum(y)
        D2 = y[0] - y[1]
        Z = max(abs(D1 - d1), abs(D2 - d2))
        if z > Z:
            z = Z
            ans = i
    print(ans)
# Judge status: Wrong Answer
s = input()
ans = 0
if int(s[0]) >= int(s[1]) and int(s[0]) >= int(s[2]):
    ans = int(s[0]) * 100 + int(s[0]) * 10 + int(s[0]) * 1
else:
    ans = int(s[0]) * 100 + int(s[0]) * 10 + int(s[0]) * 1 + 111
    print(ans)
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
ans = [-1] * n
edge = [[] for _ in range(n)]

for _ in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)
    
import collections
que = collections.deque()
que.append(0)
    
while que:
    x = que.popleft()
    
    for to in edge[x]:
        if ans[to] == -1:
            ans[to] = x + 1
            que.append(to)
            
print("Yes")
print(*ans[1:],sep="\n")
# Judge status: Accepted
antenna = [int(input()) for _ in range(5)]
k = int(input())
ans = 'Yay!'

for i in range(5):
    for j in range(5):
        if i < j:
            if antenna[j] - antenna[i] > k:
                ans = ':('
                break
    else:
        continue
    break

print(ans)
# Judge status: Accepted
L, R = map(int, input().split())
mod = 2019
ans = mod - 1
R = min(R, L+mod-1)
for i in range(L, R):
  for j in range(i+1, R+1):
    ans = min(ans, i * j % mod)
print(ans)
# Judge status: Accepted
n = int(input())
b = list(map(int, input().split()))
res = [0]*n
res[0] = b[0]
for i in range(1, n):
    if res[i-1] > b[i-1]:
        res[i-1] = b[i-1]
    res[i] = b[i-1]
print(sum(res))
# Judge status: Wrong Answer
import math
a,b=map(int,input().split())
print(math.ceil(a/(2*b-1)))