peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n, q = map(int, input().split())
s = input()

ls = [0] * n
for i in range(n-1):
   if s[i] == 'A' and s[i+1] == 'C':
      ls[i+1] = ls[i]+1
   else:
      ls[i+1] = ls[i]

ans = []
for i in range(q):
   l, r = map(int, input().split())
   ans.append(ls[r-1] - ls[l-1])

for x in ans:
   print(x)
# Judge status: Accepted
c1 = input()
c2 = input()
c3 = c1[::-1]
c4 = c2[::-1]
if c1 == c4 and c2 == c3:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
n=int(input())
ans=0
r=int(n**0.5)+1
for i in range(2,r):
    if n%i==0:
        ans+=1
        n/=i
if ans==0 and not n==0:
    ans=1
print(ans)
# Judge status: Accepted
s = str(input())
t = str(input())
isOK = False
for i in range(1,len(s)+1):
  if s==t[-i:]+t[:-i]:
    isOK = True
    break
if isOK:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import string

s=list(input())
k=int(input())

str=string.ascii_lowercase
abc=str+str

s_len=len(s)
for i in range(s_len):
  si_inx=abc.index(s[i])

  if i==s_len-1:
    k%=26
    s[i]=abc[si_inx+k]
    break

  if s[i]=='a':
    continue

  if k>=26-si_inx:
    k-=26-si_inx
    s[i]='a'
  else:
    continue

  if k<=0:
    break

print(''.join(s))
# Judge status: Accepted
a,b,c,k = map(int,input().split())

ans = 0

if k >= a:
    k -= a
    ans += a
    if k >= b:
        k -= b
        if k > 0:
            ans -= k
    print(ans)
else:
    ans = k
    print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
print(round((a+b)/2))
# Judge status: Accepted
H1,M1,H2,M2,K = map(int,input().split())
print((H2-H1)*60+(M2-M1)-K)
# Judge status: Accepted
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

a,b=map(int,input().split())
if a*b<0:
    print('Zero')
elif a<0 and ((b>0 and a%2) or (b<0 and (b-a+1)%2)):
    print('Negative')
else:
    print('Positive')
# Judge status: Accepted
n, m = map(int, input().split())
if n >= m // 2:
    print(m // 2)
else:
    print((n + m // 2) // 2)
# Judge status: Accepted
import sys
K,X = map(int,input().split())

if not ( 1 <= K <= 100 and 0 <= X <= 100 ): sys.exit()

for I in range(X-K+1,X+K):
    print(I)
# Judge status: Wrong Answer
A, B, C, D = map(int, input().split())
if A == C:
    if B>D:
        print("Yes")
    else:
        print("No")
elif(A>C):
    print("Yes")
elif(C>A):
    print("No")
# Judge status: Accepted
N=int(input())
li=list(map(int,input().split()))
if 2*max(li)<sum(li):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from collections import Counter
w=input()
c=Counter(w)
a=0
c=list(c.values())
for i in range(len(c)):
    if c[i]%2!=0:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
answer = 0
for i in range(N):
  answer += A[1+2*i]
print(answer)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = []
for a in A:
    B.append(a)
    B.append(a)
B.sort()
B.pop()
ans = 0
for i in range(N - 1):
    ans += B.pop()
print(ans)
# Judge status: Accepted

N, M = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(M)]

res = [""] * M
ctr = [0] * (N + 1)
for i, (p, y) in sorted(enumerate(X), key=lambda x: (x[1][0], x[1][1])):
    ctr[p] += 1
    res[i] = "{:0>6}{:0>6}".format(p, ctr[p])

print(*res, sep="\n")
# Judge status: Accepted


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


N, H = LI()
amax = 0
blist = []
for _ in range(N):
    a, b = LI()
    amax = max(amax, a)
    blist.append(b)
blist.sort()
ans = 0
for i in range(N-1, -1, -1):
    if blist[i] <= amax:
        break
    ans += 1
    H -= blist[i]
    if H <= 0:
        break
if H > 0:
    if H % amax == 0:
        ans += H//amax
    else:
        ans += H//amax+1

print(ans)
# Judge status: Accepted
N, S = input().split()
str_list = [input() for _ in range(int(N))]
print("".join(sorted(str_list)))
# Judge status: Accepted
A,B=map(int,input().split())
cnt=0
for i in range(1010):
    if int(i*0.08)==A and int(i*0.1)==B:
        print(i)
        break
    else:
        cnt+=1
if cnt==1010:
    print(-1)
# Judge status: Wrong Answer
a = str(input())
n = 0
e = 0
s = 0
w = 0
for i in a:
    if i=="N":
        n+=1
    if i=="E":
        e+=1
    if i=="S":
        s+=1
    if i=="W":
        w+=1
if n==s and e==w:
    print("Yes")
elif n>s:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, d = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = 0
for i in range(n):
    for j in range(i + 1, n):
        s = 0
        for c, e in zip(a[i], a[j]):
            s += (c - e) ** 2
        if s ** 0.5 == int(s ** 0.5):
            b += 1
print(b)
# Judge status: Accepted
a,b=map(int,input().split())
c=0
if a>=13:
    print(b)
elif 6<=a<=12:
    print(b//2)
else:
    print(c)
# Judge status: Accepted
n = int(input())
ans = 0
rem = 0
for _ in range(n):
    a = int(input())
    ans += (a+rem)//2
    if (a+rem)%2 == 1 and a > 0: rem = 1
    else: rem = 0

print(ans)
# Judge status: Wrong Answer
S = int(input())

L = S//3


res = 0
from scipy.special import comb

for l in range(1,L+1):
    
    s = S - l*3
    #a = cmb_(s, l)
    a = comb(s+l-1, l-1, exact=True)
    res += a

print(res)
# Judge status: Accepted
n=int(input())
a=[0]*n
b=[0]*n
for i in range(n):
  a[i],b[i]=map(int,input().split())
ans=0
for i in range(n)[::-1]:
  a[i]+=ans
  if not a[i]%b[i]==0:
    ans+=b[i]-a[i]%b[i]
print(ans)
# Judge status: Wrong Answer
def still_tdb(s):

    return "Heisei" if s < "2019/04/30" else "TBD"
def main():
    s = str(input())
    print(still_tdb(s))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
X = list(map(int,input().split()))
X.sort()
min = 100*100
for t in range(1, 101):
    sum = 0
    for x in X:
        sum += (x - t)**2
    if sum < min: min = sum
print(min)
# Judge status: Wrong Answer
n , m = map(int , input().split())
l = -10
r = 100000
for i in range(m):
  j = list(map(int , input().split()))
  l = max(l , j[0])
  r = min(r , j[1])
print(min(r - l + 1 , n))
# Judge status: Accepted
a,b,c=map(int,input().split())
amari = []
flag = True
i = 0
FLAG = False
while flag:
  check = b*i+c
  if check % a ==0:
    FLAG = True
    flag = False
  else:
    if 0 == amari.count(check % a):
      amari.append(check%a)
    else:
      flag = False
  i = i + 1
if FLAG:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
from collections import deque
n, m = map(int, input().split())
to = [[] for _ in range(n)]
for i in range(m):
    a, b = [int(i) - 1 for i in input().split()]
    to[a].append(b)
    to[b].append(a)

dist = [0] + [-1] * (n - 1)
pre = [-1] * n
search = deque([0])
while search:
    v = search.popleft()
    for u in to[v]:
        if dist[u] != -1:
            continue
        dist[u] = dist[v] + 1
        pre[u] = v
        search.append(u)

print('Yes')
for i in range(1, n):
    print(pre[i] + 1)
# Judge status: Accepted
s=input()
import re
#re.match は複数を対象にすればマッチする該当のものが返される。一つの時ifの後に持ってくると条件式として利用可能。
if re.match("^(dream|dreamer|erase|eraser)+$",s) :
       print("YES")
else:
       print("NO")
# Judge status: Accepted
l = list(map(int, input().split()))
count_5 = 0
count_7 = 0
for r in l:
  if r == 5:
    count_5 += 1
  if r == 7:
    count_7 += 1
if count_5 == 2 and count_7 == 1:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
n,m=map(int,input().split())
X=[]
for i in range(n):
    a,b=map(int,input().split())
    X.append([a,b])
Y=sorted(X,key=lambda x:(x[1],x[0]), reverse=True)

ans=0
d=0
for i in range(n):
    if d+Y[i][0]<=m:
        ans+=Y[i][1]
        d+=1
print(ans)
# Judge status: Accepted
N=int(input())

Lucas=[2,1]

for i in range(2,N+1):
    lucas_num = Lucas[i-1] + Lucas[i-2]
    
    Lucas.append(lucas_num)

print(Lucas[N])
# Judge status: Accepted
s=list(input())
cnt_a=s.count('a')
cnt_b=s.count('b')
cnt_c=s.count('c')
if cnt_a==cnt_b==cnt_c:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def main():
    Q, H, S, D = map(int, input().split())
    N = int(input())
    Q4 = 4*Q
    H2 = 2*H
    D12 = D/2
    M = min(Q4, H2, S)
    if D12 < M:
        ans = (N//2)*D + (N%2)*M
    else:
        ans = N*M
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
S = input()
def is_hitachi(S):
    hitachi = [
        'hi',
        'hihi',
        'hihihi',
        'hihihihi',
        'hihihihihi',
    ]
    if S in hitachi:
        return 'Yes'
    else:
        return 'No'

print(is_hitachi(S))
# Judge status: Accepted
H, W  = map(int, input().split())
if (H==1) or (W == 1):
	print(1)
elif (H%2==0) or (W%2==0):
	print(int(H*W/2))
else:
	print(int((H*W+1)/2))
# Judge status: Accepted
a,b,h=[int(input()) for i in range(3)]
print(int((a+b)*h/2))
# Judge status: Accepted
x = int(input())
k = 1
while(True):
  if k * x % 360 == 0:
    print(k)
    break
  else:
    k += 1
# Judge status: Accepted
S = input()
list = ['a','b','c']
if S[0] in list:
    list.remove(S[0])
    if S[1] in list:
        list.remove(S[1])
        if S[2] in list:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()


def main():
    S = input()
    ans = 1000
    for i in range(len(S) - 2):
        val = int(S[i:i+3])
        ans = min(ans, abs(val - 753))
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
color = [0] * 8
select = 0
for i in range(N):
    for j in range(8):
        if 400 * j <= A[i] < 400 * (j + 1):
            color[j] += 1
            break
        elif 400 * (j + 1) == 3200:
            select += 1
            break
ans = 0

for k in range(8):
    if color[k] != 0:
        ans += 1
print(max(ans, 1), ans + select)
# Judge status: Accepted
n = int(input())
a = set()
while n != 0:
    rem = n % 10
    a.add(rem)
    n //= 10
if 7 in a:
    print("Yes")

else:
    print("No")
# Judge status: Wrong Answer
A, B, C, K = list(map(int,input().split()))
if K <= A:
  print(K)
elif K <= (A + B):
  print(A)
elif K <= (A + B + C):
  print(K - B)
else:
  print(A + B - C)
# Judge status: Accepted
import math

h,w = map(int, input().split())
if (h == 1 or w == 1):
    print(1)
else:
    print(math.ceil(h/2)*math.ceil(w/2)+math.floor(h/2)*math.floor(w/2))
# Judge status: Wrong Answer
n=list(map(int, input().split()))
 
for i in range(len(n)-1):
  if n[i]==n[i+1]:
    print('Bad')
    break
else:
  print('Good')
# Judge status: Accepted
N,A,B=map(int,input().split())
S=input()
S=list(S)
count=0
world=1
for i in S:
    if i=="a":
        if count<A+B:
            print("Yes")
            count+=1
        else:
            print("No")
    elif i=="b":
        if (count<A+B) & (world<=B):
            print("Yes")
            count+=1
            world+=1
        else:
            print("No")
    else:
        print("No")
# Judge status: Accepted
s,t = input().split()
a,b = map(int,input().split())
u=input()

if u==s:
    print(a-1,b)
else:
    print(a,b-1)
# Judge status: Wrong Answer

s, w = map(int, input().split())
if s<w:
    print('safe')
else:
    print('unsafe')
# Judge status: Accepted
n,m = map(int,input().split())
ANS = [[0] * 2 for i in range(m)]

a = 0
b = 1
c = 0
f = 1
for i in range(m):
    if n%2 == 0 and (c+2) > n//2 and f == 1:
        b = (b+1) % n
        f = 0
    ANS[i] = [a, b]
    c += 2
    a = (a-1) % n
    b = (b+1) % n
    

for i in range(m):
    print(ANS[i][0]+1, ANS[i][1]+1)
# Judge status: Accepted
n,m=map(int,input().split())
d=[0 for i in range(m)]
for i in range(n):
    k=list(map(int,input().split()))
    for i in range(len(k)-1):
        d[k[i+1]-1]+=1
ans=0
for i in d:
    if i==n:
        ans+=1
print(ans)
# Judge status: Accepted
k = int(input())
s = input()
print(s if len(s) <= k else s[:k] + "...")
# Judge status: Wrong Answer
import re
S = input()
ans = 0

while True:
    num0 = S.count('11')
    S = re.sub('11', '', S)
    num1 = S.count('00')
    S = re.sub('00', '', S)
    ans += 2*(num0+num1)
    if num0+num1 == 0:
        print(ans)
        break
# Judge status: Accepted
import heapq
x = [[] for _ in range(10**5+1)]
n,m = map(int,input().split())

for i in range(n):
    a,b = map(int,input().split())
    x[a].append(b)
    
cur = []
heapq.heapify(cur)

ans = 0
for l in range(1,m+1):
    for k in x[l]:
        heapq.heappush(cur, k*(-1))
    
    if cur != []:
        mi = heapq.heappop(cur)
        ans += mi * (-1)
        
print(ans)
# Judge status: Wrong Answer
import sys

N = int(sys.stdin.readline())
binN = ""
pN = abs(N)
while N != 0:
    if abs(N % -2) == 1:
        binN += "1"
    else:
        binN += "0"
    N += N%(-2)
    N //= -2
print(binN[::-1])
# Judge status: Accepted
n=int(input())
lst=list(map(int,input().split()))
four=0
two=0
odd=0

for i in lst:
    if i%4==0:
        four+=1
    elif i%2==0:
        two+=1
    else:
        odd+=1

if four>=odd:
    print("Yes")
elif four+1==odd:
    if two==0:
        print("Yes")
    else:
        print("No")
else:
    print("No")
# Judge status: Accepted
A,B,C,D = input('')
for i in range(2**3):
  op = [0] * 3
  for j in range(3):
    if (i >> j) & 1:
      op[j]='+'
    else:
      op[j]='-'
  if eval(A+op[0]+B+op[1]+C+op[2]+D)==7:
    print(A+op[0]+B+op[1]+C+op[2]+D+'=7')
    exit()
# Judge status: Accepted
h, w = map(int, input().split())
ans =  h*w // 2
if h == 1 or w == 1:
    print(1)
elif (h*w) % 2 == 0:
    print(ans)
else:
    print(ans + 1)
# Judge status: Wrong Answer
a,b = map(int,input().split())
b += a
if b>24:
    print(b-24)
else:
    print(b)
# Judge status: Wrong Answer
S=input()
if len(S)==6:
  for i in range(6):
    if (S[2]==S[3] and S[4]==S[5]):
      print("Yes")
    else:
      print("No")
# Judge status: Accepted
n = int(input())
ab = []
now = 0
for i in range(n):
    _a, _b = map(int, input().split())
    ab.append([_a, _b])

ab.sort(key=lambda x: x[1])
for a, b in ab:
    now += a
    if now>b:
        print('No')
        exit()
print('Yes')
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
x=a[0]
y=a[-1]
suma=sum(a)
for i in range(1,n-1):
    if x<suma//2:
        x+=a[i]
    else:
        break
y=suma-x
print(max(x,y)-min(x,y))
# Judge status: Accepted
a,b,c=map(int,input().split())
if a!=b and a!=c and b!=c:
  print("No")
elif a==b and b==c and c==a:
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
S = input()

def getHi(S):
    for i in range(0, len(S)-2, 2):
        if S[i] + S[i+1] != "hi":
            return"No"
    return "Yes"

print(getHi(S))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
i,ans=0,0
while i<n-1:
    while i<n-1 and a[i]==a[i+1]: i+=1
    if a[i]<=a[i+1]:
        while i<n-1 and a[i]<=a[i+1]: i+=1
        ans+=1
    elif a[i]>=a[i+1]:
        while i<n-1 and a[i]>=a[i+1]: i+=1
        ans+=1
    i+=1
    if i==n-1: ans+=1
if ans==0: ans=1
print(ans)
# Judge status: Accepted
input_from = input()
info = input_from.split(' ')
a = int(info[0])
b = int(info[1])
k = int(info[2])
a -= k
if a < 0:
    b += a
    a = 0
    if b < 0:
        b = 0
print("{0} {1}".format(a, b))
# Judge status: Accepted
h, n = map(int, input().split())
a, b = [], []
for _ in range(n):
    A, B = map(int, input().split())
    a.append(A)
    b.append(B)

a_max = max(a)
dp = [0]*(h+a_max)

for i in range(h+a_max):
    dp[i] = min(dp[i-a] + b for a, b in zip(a, b))

print(min(dp[h-1:]))
# Judge status: Wrong Answer
a, b, c = map(int,input().split())

if b/a < c:
  print(round(b/a))
else:
  print(c)
# Judge status: Wrong Answer
from sys import stdin


def get_result(data):
    return 'x' * len(data[0])

if __name__ == '__main__':
    data = list(map(str, stdin.readline().split(' ')))
    result = get_result(data)
    print(result)
# Judge status: Accepted
def i():
  return int(input())
a = i()
b = i()
c = i()
d = i()
e = i()
k = i()
if (e-a <= k):
  print('Yay!')
else:
  print(":(")
# Judge status: Accepted
a,b,c = map(int,input().split())
ans = 'No'

if(a <= c <= b):
    ans = 'Yes'

print(ans)
# Judge status: Accepted
s = list(map(int,input()))
m = 10**9
for i in range(len(s)-2):
  a = 100*s[i]+10*s[i+1]+s[i+2]
  if m > abs(753-a):
    m = abs(753-a)
print(m)
# Judge status: Accepted
n = int(input())
counted = 0

for i in range(1,n):
  counted +=  (n-1)//i

print(counted)
# Judge status: Wrong Answer
n, m = map(int, input().split())
if n >= m:
    print(0)
    exit()
x = sorted(map(int, input().split()))
l = sorted(i - j for i, j in zip(x[1:], x[:-1]))
print(sum(l[: 1 - n]))
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(1000000)

n, a, b = map(int, input().split())
mod = 10**9 + 7
nca = 1

for i in range(a):
    nca *= (n-i)
    nca *= pow(i+1, mod-2, mod)
    nca %= mod
ncb = 1
for i in range(b):
    ncb *= (n-i)
    ncb *= pow(i+1, mod-2, mod)
    ncb %= mod

nca %= mod
ncb %= mod


ans = pow(2, n, mod) - nca - ncb - 1
if ans >= 0:
    print(ans)
else:
    print(ans + mod)
# Judge status: Wrong Answer
N = int(input())
p = list(map(int,input().split()))

cnt = 0
for i in range(N-1):
    if p[i] == i+1:
        p[i],p[i+1] = p[i+1],p[i]
        cnt += 1

print(cnt)
# Judge status: Wrong Answer
N = []

for i in range(6):
    N.append(int(input()))

ans = "Yay!"
for i in range(5):
    for j in range(i+1,5):
        dist = abs(N[j] - N[i])
        print(dist)
        if dist > N[5]:
            ans = ":("

print(ans)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
print("delicious" if b>c else "safe" if c-b-1<=a else "dangerous")
# Judge status: Wrong Answer
n = int(input())

res = 0
for i in range(n):
  t, x, y = map(int, input().split())

  if x+y<=t-res and t%2==(x+y)%2:
    if t-(x+y)!=res:
      res += t-(x+y)
  else:
    print('No')
    exit()
    
print('Yes')
# Judge status: Accepted
A, B = map(int, input().split())
if A == 1:
    A += 13
if B == 1:
    B += 13
if A > B :
    print("Alice")
elif A < B:
    print("Bob")
else:
    print("Draw")
# Judge status: Wrong Answer
n=int(input())
m=0
p=-1
for i in range(1,n+1):
    if(i%2==0):
        x=i
        c=0
        while(x%2==0):
            c+=1
            x//=2
        if(c>m):
            m=c
            p=i
print(p)
# Judge status: Accepted
N,P = map(int,input().split())
A = list(map(int,input().split()))

su = 2 ** N
guusu = True
for a in A:
    if a % 2 == 1:
        guusu = False
        break
if P == 0:
    print(su if guusu else su//2)
else:
    print(0 if guusu else su//2)
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())

ans = 0
for i in range(n):
  if i <= k-1:
    ans += x
  else:
    ans += y
    
print(ans)
# Judge status: Wrong Answer
(N, K, S) = list(map(int, input().split()))
a = [S] * K
b = [1] * (N-K)
print(a + b)
# Judge status: Accepted
N,Y=map(int,input().split())
# x+y+z=N
# 10000x+5000y+1000z=Y
# となるような正整数(x,y,z)はあるか？
ans=[-1,-1,-1]
for x in range(N+1):
  for y in range(N-x+1):
    z=N-x-y
    if 10000*x+5000*y+1000*z==Y:
      ans=[x,y,z]
print(ans[0],ans[1],ans[2])
# Judge status: Accepted
n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(m)]

l = []
r = []

for i in range(m):
  l.append(a[i][0])
  r.append(a[i][1])

ans = min(r)-max(l)+1  
 
if ans <= 0:
  print(0)
else:
  print(ans)
# Judge status: Wrong Answer
N = int(input())
a = list(map(int, input().split()))
count = 0;
for i in range(0,N):
  if i % 2 == 1:
    if a[i] % 2 == 1:
      count = count+1
print(count)
# Judge status: Accepted
from collections import Counter
def solve():
  N = int(input())
  S = list(input())
  c = Counter(S)
  ans = c['R']*c['G']*c['B']
  for i in range(N):
    for j in range(i+1,N):
      k = j*2-i
      if k>N-1:
        break
      if S[i]!=S[j] and S[j]!=S[k] and S[i]!=S[k]:
        ans -= 1
  return ans
print(solve())
# Judge status: Wrong Answer
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0
for i in range(a + 1):
    for j in range(b + 1):
        C = x - 500 * i - 100 * j
        if C >= 0 and C <= 50:
            cnt += 1
print(cnt)
# Judge status: Accepted
n = int(input())
d = list(map(int,input().split()))
ans=0
d.sort()
print(d[n//2]-d[(n//2)-1])
# Judge status: Wrong Answer
[n,m] = [int(i) for i in input().split()]
if n * 2 >= m:
    print(n)
else:
    if m >= 2:
        ans = n
        m = max(m - n * 2,0)
        ans += m//4
        print(ans)
    else:
        print(0)
# Judge status: Accepted
import itertools


def main():

    N, K = map(int, input().split())
    mod = 1000000007
    s = list(itertools.accumulate(range(0, N+1)))

    ans = 1
    for k in range(K, N+1):
        ans = (ans + s[N] - s[N-k] - s[k-1] + 1) % mod

    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
MM = input().split()
count = 0
list1 =[]
for i in MM:
  a = int(i)
  list1.append(a)
list2 = sorted(list1)
for i,j in zip(list1,list2):
  
  if i != j:
    
    count +=1
if count >2:
  print('No')
else:
  print('Yes')
# Judge status: Accepted
sx, sy, tx, ty = map(int, input().split())
lr, ud = abs(tx - sx), abs(sy - ty)
print('R' * lr + 'U' * ud + 'L' * lr + 'D' * ud, end='')
print('L' + 'U' * (ud+1) + 'R' * (lr+1) + 'D' + 'R' + 'D' * (ud+1) + 'L' * (lr+1) + 'U')
# Judge status: Accepted
import sys

input = sys.stdin.readline

def main():
    ans = 0
    N, M = map(int, input().split())
    m = [0]*N
    for _ in range(M):
        a, b = map(int, input().split())
        m[a-1] += 1
        m[b-1] += 1
    for i in range(N):
        print(m[i])

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
d=min(a*b/2,a*c/2,b*c/2)
print(d)
# Judge status: Accepted
expected_value_dic = {}

def get_expected_value(x):
    return (1 + x) / 2

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

P = list(map(int, input().split()))
expected_values = [get_expected_value(p) for p in P]
cumulative_values = [expected_values[0]]
for expected_value in expected_values[1:]:
    cumulative_values.append(cumulative_values[-1] + expected_value)

result = cumulative_values[k-1]
for i in range(k, n):
    temp = cumulative_values[i] - cumulative_values[i - k]
    if temp > result:
        result = temp

print(result)
# Judge status: Accepted
X, Y = map(int, input().split())

a = X
ans = 0
while a <= Y:
    ans += 1
    a *= 2

print(ans)
# Judge status: Accepted
ls = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
S = input()
print(7-ls.index(S))
# Judge status: Accepted
S = input()
while len(S) > 0:
  if S[-5:] == 'dream':
    S = S[:-5]
  elif S[-5:] == 'erase':
    S = S[:-5]
  elif S[-7:] == 'dreamer':
    S = S[:-7]
  elif S[-6:] == 'eraser':
    S = S[:-6]
  else:
    print('NO')
    exit()
print("YES")
# Judge status: Accepted
N = int(input())
numbers = [int(i)-1 for i in input().split()]

need_fix_index = []

for i, v in enumerate(numbers):
    if i == v:
        need_fix_index.append(i)
        
cnt = 0

while need_fix_index:
    cnt += 1
    v = need_fix_index.pop(0)
    if len(need_fix_index) == 0:
        break
    if abs(need_fix_index[0]-v) == 1:
        del need_fix_index[0]
    
print(cnt)
# Judge status: Accepted
H, A = map(int, input().split())
c = int(H / A)
if H % A != 0:
    c += 1
print(c)
# Judge status: Accepted
a = list(map(int,input().split()))
a.sort()
k = int(input())
print(a[0]+a[1]+a[2]*(2**k))
# Judge status: Wrong Answer
k,x=map(int, input().split())

if 500*k >= x:
    print('YES')
else:
    print('NO')

exit()
# Judge status: Accepted
s = input()
a = s.find('A')
z = s.rfind('Z')
print(z-a+1)
# Judge status: Wrong Answer
def dfs(n, i, s):
    global ans
    s += chr(i)
    if n == N:
        ans += [s]
        return
    for ii in range(97, i+2):
        dfs(n+1, ii, s)

N = int(input())
i = 97
ans = []
dfs(1, 97, '')
ans = sorted(ans)
for a in ans:
    print(a)
# Judge status: Accepted
import math
x = int(input())
ans = []
for j in range(1, math.ceil(math.sqrt(x)) + 1):
    for k in range(2,x + 2):
        if j ** k <= x:
            ans.append(j ** k)
print(max(ans))
# Judge status: Accepted
N = int(input())
print(N*800-200*(N//15))