peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n = int(input())
print("a"*n)
c = "a"
if n > 1:
    for i in range(1,n):
        c += chr(ord("a") + (i))
    print(c)
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
解説PDFを読んだ。
"""

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

    hash_counter = 0
    dot_counter = S.count(".")
    answer = dot_counter
    for i in range(N):
        if S[i] == "#":
            hash_counter += 1
        else:
            dot_counter -= 1
        answer = min(answer, hash_counter+dot_counter)
    print(answer)

if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N <= K:
    print(N * X)
else:
    rest = N - K
    print(K * X + rest * Y)
# Judge status: Wrong Answer
import itertools
N=int(input())
point=[]
for _ in range(N):
    x,y=map(int,input().split())
    point.append([x,y])
nums=[i for i in range(1,N+1)]
perm=list(itertools.permutations(nums,N))
dist=0

for pattern in perm:
    tmp_dist=0
    for i in range(N-1):
        tmp_dist+=((point[pattern[i]-1][0]-point[pattern[i+1]-1][0])**2+(point[pattern[i]-1][1]-point[pattern[i+1]-1][1])**2)**0.5
    dist+=tmp_dist
# Judge status: Wrong Answer
import numpy as np

n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

cum1 = np.cumsum(a1[::-1])[::-1]
cum2 = np.cumsum(a2[::-1])[::-1]

get = 0
for i in range(n-1):
  get += a1[i]
  if cum1[i+1] + a2[-1] <= cum2[i]:
    get += cum2[i]
    break
else:
  get += a1[-1] + a2[-1]
    
print(get)
# Judge status: Accepted
import heapq
N,M=map(int,input().split())
A=list(map(lambda x:-int(x),input().split()))
heapq.heapify(A)

for _ in range(M):
    a=-heapq.heappop(A)
    a//=2
    heapq.heappush(A,-a)

print(-sum(A))
# Judge status: Wrong Answer
A, B = map(int, input().split())

def fact(n):
    k = 2
    l = [] 
    temp=n
    while pow(k, 2)<n:
        if temp%k==0:
            l.append(k)
            while temp%k==0:
                temp//=k
        k+=1
    return l

print(len(set(fact(A))&set(fact(B)))+1)
# Judge status: Accepted
import math
n = int(input())
P = list(map(int, input().split()))

same = 0
cnt = 0
for i in range(n):
    if P[i] == i+1:
        same += 1
    else:
        cnt += math.ceil(same/2)
        same = 0

if same > 0:
    cnt += math.ceil(same/2)

print(cnt)
# Judge status: Wrong Answer
s=int(input())
a=[]
def f(n):
    flag=0
    a.append(n)
    if a[-3:]==[4,2,1]:
        flag=1
    if flag==0:
        if n%2==0:
            n=n//2
            f(n)
        else:
            n=3*n+1
            f(n)
f(s)

for i in range(1,len(a)-1):
    if a[i-1:i+2]==[4,2,1]:
        print(i+3)
# Judge status: Accepted
a,b,c = sorted(map(int,input().split()))
print(10*c+b+a)
# Judge status: Wrong Answer
N = int(input())
M = list(map(int,input().split()))
X = sorted(M)
print(X)
c = 0
for i, v in enumerate(X):
    if i >= N-1:
        break
    else:
        a = X[i]+X[i+1]
        b = a/2
        X[i+1]= a/2

print(b)
# Judge status: Wrong Answer
def main():
    N = int(input())
    p = list(map(int,input().split()))
    count = 0
    for i in range(N-1):
        if p[i]>p[i+1]:
            count += 1
    
    if count >= 2:
        print("NO")
    else:
        print("YES")


if __name__=="__main__":
    main()
# Judge status: Wrong Answer
def main():
    T = input()
    # ?D -> PD
    # ?P -> DP
    # ?? -> PD 
    # ??? -> PDD

    T = T.replace("?D", "PD")
    T = T.replace("?P", "DP")
    T = T.replace("?", "D")

                    
    print(T)

if __name__=="__main__":
    main()
# Judge status: Accepted
MOD = 10**9 + 7

def fac(n):
    ans = 1
    for i in range(1, n + 1):
        ans = ans * i % MOD
    return ans

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

a, b = (2 * Y - X) // 3, (2 * X - Y) // 3
if (2 * X - Y) % 3 != 0 or a*b < 0:
    print(0)
else:
    print((fac(a + b) * pow(fac(a), MOD-2, MOD) * pow(fac(b), MOD-2, MOD)) % (10**9 + 7))
# Judge status: Accepted
s=list(input())
t=list(input())
ans='U'
for i in range(len(s)-len(t),-1,-1):
  if s[i]==t[0] or s[i]=='?':
    cnt=1
    for j in range(1,len(t)):
      if s[i+j]==t[j] or s[i+j]=='?':
        cnt+=1
    if cnt==len(t):
      s[i:i+len(t)]=t
      u=''
      for k in s:
        u+=k
      u=u.replace('?','a')
      print(u)
      exit()
      
print('UNRESTORABLE')
# Judge status: Accepted
x,a,b=map(int,input().split())
print("A" if abs(x-a)<abs(x-b) else "B")
# Judge status: Accepted
N = int(input())
v = list(map(int, input().split()))

v = sorted(v)

for i in range(N-1):
    v[1] = (v[0]+v[1])/2
    del v[0]

print(v[0])
# Judge status: Wrong Answer
n = raw_input()

if 'hii' in n:
  print("No")
elif 'hhi' in n:
  print("No")
elif 'hihi' in n:
  print("Yes")
elif 'hi' in n:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s = input()
oi = "01"*(len(s)//2)
io = "10"*(len(s)//2)
if len(s)%2 == 1:
    oi += "0"
    io += "1"

oans = 0
ians = 0
for i in range(len(s)):
    if s[i] != oi[i]:
        oans += 1
    if s[i] != io[i]:
        ians += 1
print(min(oans, ians))
# Judge status: Wrong Answer
import math

def main():
    X = input()
    X = int(X)
    output = 100
    year = 0
    while output <= X:
        output = int(output * 1.01)
        math.floor(output)
        year += 1

    print(year)

if __name__ == "__main__":
    main()
# Judge status: Accepted
w,a,b, = map(int,input().split())
ans = 0
if a <= b:
    ans = b - (w+a)
    if ans < 0:
        ans = 0
else:
    ans = a - (w+b)
    if ans < 0:
        ans = 0
print(ans)
# Judge status: Accepted
N = int(input())
S = str(input())

ans = S[1:].count('E')
tmp = S[1:].count('E')
for i in range(N-1):
  if S[i] == 'W':
    tmp += 1
  if S[i+1] == 'E':
    tmp -= 1
  ans = min(ans, tmp)
    
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())

if (a+b)>=24:
    print(a+b-24)
else:
    print(a+b)
# Judge status: Wrong Answer
n, k = map(int, input().split())
hh = []
minn = 10**9
for i in range(n):
    h = int(input())
    hh.append(h)
h = sorted(hh)
for i in range(n - k - 1):
    if h[i + k - 1] - h[i] < minn:
        minn = h[i + k - 1] - h[i]
print(minn)
# Judge status: Accepted
import itertools
n = int(input())
l = [i for i in range(1, n+1)]
l = list(itertools.permutations(l))

p = input()
q = input()
p = p.split(" ")
q = q.split(" ")
p, q = tuple(map(int, p)), tuple(map(int, q))
print(abs(l.index(p) - l.index(q)))
# Judge status: Accepted
n, a, b = map(int ,input().split())

if (b-a) % 2 == 0:
	ans = (b-a) // 2
else:
	ans_2_1 = b-1
	ans_2_2 = n-a

	if b-a == 1:
		ans = min(ans_2_1, ans_2_2)
	else:


		ans_3_1 = (a-1) + 1 + (b-a+1-1-1)//2
		ans_3_2 = (n-b) + 1 + (n-(a+n-b+1))//2

		ans = min(ans_2_1,ans_2_2,ans_3_1,ans_3_2)

print(ans)
# Judge status: Wrong Answer
def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N = Z()
    s = input()
    b = w = 0
    f = 0
    for i in range(N):
        if f == 0 and s[i] == '#': f = 1
        if f == 1 and s[i] == '.': w += 1
    f = 0
    for i in range(N):
        if f == 0 and s[-1-i] == '.': f = 1
        if f == 1 and s[-1-i] == '#': b += 1
    print(min(b, w))

    return

if __name__ == '__main__':
    main()
# Judge status: Accepted
#n = int(input())
a, b, c, d = map(int, input().split())
#l = list(map(int,input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

print(max(0, min(b, d)-max(a, c)))
# Judge status: Accepted
A,B,C = map(int,input().split())
if (A*B*C)%2==0:
    print(0)
else:
    print(min(A*B,B*C,C*A))
# Judge status: Accepted
X, Y = input().split()
x = int(X)
y = int(Y)
a = (4*x - y) / 2
b = (-2*x + y) / 2
if(a >= 0 and a.is_integer() and b >= 0 and b.is_integer()):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b, k = input().split()
a, b, k = int(a), int(b), int(k)

if k < a:
  a = a-k

else:
  k = k-a
  a = 0
  if k < b:
    b = b-k
  else:
    b = 0
  
print(a,b)
# Judge status: Wrong Answer
import fractions
N, X = map(int, input().split())
*x, = sorted(list(map(int, input().split())))
kyori = sorted([abs(X - xx) for xx in x])
ruisekiwa = [0] * (N+1)
for i in range(N):
    ruisekiwa[i+1] = fractions.gcd(ruisekiwa[i], kyori[i])
print(max(ruisekiwa))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ret = [0] * n
for i in range(n):
    ret[i] = b[i] - a[i]
ret = sorted(ret)

cnt = 0
for i, val in enumerate(ret):
    if val < 0:
        cnt += abs(val)
        ret[i] = 0
    elif val % 2 == 1:
        cnt += 1
        ret[i] += 1

for i, val in enumerate(ret):
    cnt -= val // 2
if cnt <= 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a = int(input())
ans = False

if a >= 30:
    ans = True

if ans:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())

ht = [[0 for i in range(10)] for j in range(10)]

for i in range(1,n+1):
    temp = str(i)
    head = int(temp[0])
    tail = int(temp[-1])
    ht[head][tail] += 1

ans = 0
for i in range(1,n+1):
    temp = str(i)
    head = int(temp[0])
    tail = int(temp[-1])
    ans += ht[tail][head]

# print(ht)


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

c = Counter(input() for _ in range(int(input())))
m = max(c.values())
for s in sorted(s for s, k in c.items() if k == m): 
  print(s)
# Judge status: Wrong Answer
import math
n = int(input())
c = n - 1
for i in (2, int(math.sqrt(n)) + 1):
    if n % i == 0:
        c = min(c, i + n // i - 2)
print(c)
# Judge status: Accepted
N=int(input())
A=list(input().split())
s = " ".join(A[::-2]) + " " + " ".join(A[N%2::2])
print(s)
# Judge status: Accepted
A, B, x = map(int,input().split())
b_d = B//x+1
a_d = A//x
if A!=0 and A%x!=0:
   a_d+=1
print(b_d - a_d)
# Judge status: Wrong Answer
def nyu():
    L,R = map(int,input().split())
    return L,R


def convert(LL,LR):
    LL = LL % 2019
    LR = LR % 2019

    return LL,LR

def kansu(LL,LR):

    ans = 2020

    for ll in range(LL,LR):
        for lr in range(ll+1,LR+1):
            print(ll,"  ",lr)
            tmp  = (ll * lr) % 2019
            if ans > tmp:
                ans = tmp

    print(ans)

ML,MR = nyu()
ML,MR = convert(ML,MR)
kansu(ML,MR)
# Judge status: Wrong Answer
num = int(input())

arr = {}
for i in input().split(" "):
	i = int(i)
	if arr.get(i, False):
		arr[i] += 1
	else:
		arr[i] = 1

arr = dict(sorted(arr.items(), key=lambda d: d[0], reverse=True))


side = []

for key in arr:
	if arr[key] >= 2:
		side.append(key)

if len(side) >= 2:
	print(side[0] * side[1])
elif len(side) == 1:
	print(side[0] * side[0])
else:
	print(0)
# Judge status: Accepted
a, b, c, k = map(int, input().split())

if k <= a:
    print(k)
elif k <= (a + b):
    print(a)
else:
    print(a - (k - a - b))
# Judge status: Wrong Answer
n,m=map(int,input().split())
data=[1]*n
res=[1]+[0]*(n-1)
for i in range(m):
  x,y=map(int,input().split())
  data[x-1]-=1
  data[y-1]+=1
  if data[x-1]==0 and res[x-1]==1:
    res[y-1]=res[x-1]
    res[x-1]=0
  else:
    res[y-1]=res[x-1]
ans=0
for i in range(n):
  if data[i]!=0 and res[i]!=0:
    ans+=1
print(ans)
# Judge status: Wrong Answer
n = int(input())
lst = list(map(int,input().split()))
reallst = []
for k in range(1,n+1):
  for i in range(n):
    if lst[i] == k:
      reallst.append(i+1)
print(reallst[:])
# Judge status: Wrong Answer
N, M = map(int, input().split())
X = list(map(int, input().split()))
X = sorted(X)
Y = [0]*(M-1)
for i in range(M-1):
  Y[i] = X[i+1] - X[i]
Y = sorted(Y)
print(sum(Y[:-N+1]))
# Judge status: Accepted
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
tmp = a.index(1)
ans += math.ceil(tmp/(k-1))
tmp = ans * (k-1) +1
ans += math.ceil((n-tmp)/(k-1))
print(ans)
# Judge status: Accepted
import bisect
n, q = map(int, input().split())
s = str(input())
A, C = [], []
for i in range(n - 1):
    if s[i] == 'A' and s[i + 1] == 'C':
        A.append(i)
        C.append(i + 1)
for i in range(q):
    l, r = map(int, input().split())
    print(bisect.bisect_right(C, r - 1) - bisect.bisect_left(A, l - 1))
# Judge status: Wrong Answer
N = int(input())

ans = int(0.5 * N * (N - 1))

print(ans)
# Judge status: Wrong Answer
n = int(input())
card = list(map(int,input().split()))

card.sort()

ans = 0
for i in range(n//2):
            ans += card[2*i]-card[2*i+1]
if n%2==1:
            ans += card[-1]

print(ans)
# Judge status: Accepted
N,Q=map(int,input().split())
S=input()
res=0
dp=[0]*N
a=0
for i in range(1,N):
  if S[i]=='C':
    if S[i-1]=='A':
      res+=1
  dp[i]=res
for _ in range(Q):
  l,r=map(int,input().split())
  if l==1:
    print(dp[r-1])
  else:
    print(dp[r-1]-dp[l-1])
# Judge status: Wrong Answer

import numpy as np

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

result = []

for i in range(n):
    num = i+1
    count = 0
    while True:
        num *= 2
        count += 1
        if num >= k:
            result.append(count)
            break

prob = 0

for j in result:
    prob += (1/n) * (0.5)**j

print(prob)
# Judge status: Accepted
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

l = [int(input()) for _ in range(5)]
k = int(input())

for i in range(5):
    for j in range(i+1,5):
        #print(l[i],l[j])
        if l[j] - l[i] > k:
            print(":(")
            exit()
print("Yay!")
# Judge status: Accepted
s=int(input())
F=[0]
F.append(s)

def calc(x):
  if x%2==0:
    return x/2
  else:
    return 3*x+1

for i in range(2, 1000000):
  a=calc(F[i-1])
  if a in F:
    print(i)
    break
  else:
    F.append(a)
# Judge status: Accepted
n = int(input())
Mlist = sorted(list(map(int,input().split())))[::-1]
if Mlist[0] >= sum(Mlist[1:]):
  print("No")
else:
  print("Yes")
# Judge status: Accepted
S = input()
L, R =  map(int, [S[:2], S[2:]])
 
if 1 <= L <= 12 and 1 <= R <= 12:
  print("AMBIGUOUS")
elif 1 <= L <= 12 and (R == 0 or R > 12):
  print("MMYY")
elif (L == 0 or L > 12) and 1 <= R <= 12:
  print("YYMM")
else:
  print("NA")
# Judge status: Accepted
import math
x, y = map(int, input().split())
ans = 0

#ans = int(math.log2(y/x))

while y >= x:
    x = x * 2
    ans += 1

print(ans)
# Judge status: Accepted
week = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
s = input()
i = 1
while s != week[-i]:
    i = i + 1
print(int(i))
# Judge status: Accepted
a,b=map(int, input().split())
print(a*b)
# Judge status: Accepted
from collections import deque
n = int(input())
a_ls = list(map(int, input().split()))
a_ls.sort(reverse = True)
queue = deque()
queue.append(a_ls[0])
for i in range(1,n):
    queue.append(a_ls[i])
    queue.append(a_ls[i])
ans = 0
for _ in range(n-1):
    ans += queue.popleft()
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())

maxl = 0
minr = 10**5
for i in range(m):
  l, r = map(int, input().split())
  maxl = max(maxl, l)
  minr = min(minr, r)

print(max(minr-maxl+1, 0))
# Judge status: Accepted
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
answer = [abs(A - (T - (height * 0.006))) for height in H]
print(answer.index(min(answer)) + 1)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

B = [0] * N
for i in reversed(range(N)):
    ball = 0
    j = i + 1
    while j < N:
        ball += B[j - 1]
        j *= 2

    if ball % 2 != A[i]:
        B[i] = 1


print(sum(B))
print(*[i for i, b in enumerate(B, start=1) if b == 1], sep=' ')
# Judge status: Accepted
n = int(input())
print(''.join(map(lambda x: chr((ord(x) + n + 13) % 26 + 65), input())))
# Judge status: Accepted
# AtCoder Beginner Contest 046
# A - AtCoDeerくんとペンキ / AtCoDeer and Paint Cans
l = input().split()
print(len(sorted(set(l))))
# Judge status: Accepted
import sys
x = int(input())

for i in range(1, 1001):
    for j in range(15001):
        if 100 * i + j == x and j <= 5 * i:
            print("1")
            sys.exit()

print("0")
# Judge status: Wrong Answer
import sys

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

ch = [0] * (n+1)
pa = [0] * (n+1)
pa[0] = 0 if a[0] == 1 else 1
t = 2
for i in range(1,n+1):
    ch[i] = 2*ch[i-1] + a[i]
    pa[i] = t - ch[i]
    t *= 2

ans = 0
chi = a[n]
for i in reversed(range(n)):
    if pa[i]*2 < chi:
        print(-1)
        sys.exit(0)
    ans += chi
    chi = min(chi + a[i], pa[i] + a[i])
print(ans + 1)
# Judge status: Wrong Answer
from collections import Counter

N=int(input())
*d,=map(int,input().split())
mod = 998244353

if d[0]:
  print(0)
  exit(0)
  
dmax = max(d)
if sorted(set(d)) != list(range(dmax+1)):
  print(0)
  exit(0)

c = Counter(d)

ans =1
for i in range(2,dmax+1):
  ans *= pow(c[i-1],c[i],mod)
  ans %= mod
  
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
H = [int(h) for h in input().split()]
flag = [1 for i in range(N)]
for i in range(M):
  a, b = map(int, input().split())
  if H[a-1] <= H[b-1]:
    flag[a-1] = 0
  if H[a-1] >= H[b-1]:
    flag[b-1] = 0
print(sum(flag))
# Judge status: Wrong Answer
N = int(input())
S = []
for i in range(1, N+1):
        S_i = input()
        S.append(S_i)
cnt = 0
for i in range(0, N):
        flg = 0
        for j in range(i+1, N):
                if( S[i] == S[j]):
                        break
        if(flg ==0):
                cnt += 1
print(cnt)
# Judge status: Wrong Answer
n,k = map(int,input().split())
divflg = True
flg = True

while divflg:
    if n % 10 == 0:
        n = int(n/10)
    else:
        divflg = False

while flg:
    div = n // k
    mod = n % k
    if div == 0:
        flg = False
        diff = abs(mod-k)
    else:
        n = mod

print(min(n,diff))
# Judge status: Accepted
import numpy as np
n,m=map(int,input().split())
x=list(map(int,input().split()))
if n>=m:
    print(0)
else:
    x.sort()
    x=np.array(x)
    L=np.diff(x,1)
    L=np.sort(L)[::-1]
    ans=x[-1]-x[0]-sum(L[:n-1])
    print(ans)
# Judge status: Accepted
N = int(input())

if len(str(N)) == 1:
    ans = N
else:
    s = list(str(N))
    S = s[1:]
    #print(S)
    #print(['9']*((len(str(N)))-1))
    if S == ['9']*((len(str(N)))-1):
        ans = int(str(N)[0]) + 9 * (len(str(N))-1)
        #print('YYY')
    else:
        ans = int(str(N)[0]) + 9 * (len(str(N))-1) - 1

print(ans)
# Judge status: Accepted
n = int(input())
a = set()
for i in range(n):
  tmp = int(input())
  if tmp in a: a.discard(tmp)
  else: a.add(tmp)
print(len(a))
# Judge status: Wrong Answer
i = 1
a,b = map(int, input().split())
m = 0
while m <= a and (m + i) <= b:
    m += i
    i += 1

diff1 = abs(m - a)
diff2 = abs((m + i) - b)

if diff1 == diff2:
    print(diff1)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(1, n - 1):
    if p[i-1] < p[i] < p[i+1] or p[i-1] > p[i] > p[i+1]:
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
n,k = map(int,input().split())
h = list(input().split())
h.sort()
ans = int(0)
for i in range(n - k):
    ans += int(h[i])
print(ans)
# Judge status: Accepted
sa=str(input())
sb=str(input())
sc=str(input())
sa=list(sa)
sb=list(sb)
sc=list(sc)
temp=sa[0]
del sa[0]
while True:
  if temp=="a":
    if len(sa)==0:
      print("A")
      break
    temp=sa[0]
    del sa[0]
  if temp=="b":
    if len(sb)==0:
      print("B")
      break
    temp=sb[0]
    del sb[0]
  if temp=="c":
    if len(sc)==0:
      print("C")
      break
    temp=sc[0]
    del sc[0]
# Judge status: Wrong Answer
N = int(input())

num = 0

for i in range(N+1):
  g = N -i
  a=sum(map(int,list(str(g))))
  b=sum(map(int,list(str(i))))
  ans =  a + b
  if num == 0:
    num += ans
  elif num >= ans:
    num += ans
  else:
    continue

    
print(num)
# Judge status: Accepted
N = int(input())
S = str(input())
count = 0
ans = 0

for i in range(N):
    if S[i:i+1] == "I":
        count += 1
        ans = max(ans,count)
    else:
        count -= 1

print(ans)
# Judge status: Wrong Answer
from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]

#全ての組み合わせのうち、奇数になるもの（奇数 + 偶数）を除く

total = ((N+M)*(N+M-1))/2
odd = N*M

print(total - odd)
# Judge status: Accepted
N,K=map(int,input().split())
A=list(map(int,input().split()))

M=[N]*N

for i in range(K):
    L=[0]*(N+1)
    for j in range(N):
        L[max(0,j-A[j])]+=1
        L[min(N,j+A[j]+1)]-=1
        
    S=0
    for j in range(N):
        S+=L[j]
        A[j]=S

    if A==M:
        break

for i in range(N):
    print(A[i],end=" ")
print()
# Judge status: Wrong Answer
l,r,d = map(int,input().split())
m = r - l + 1
print(m//d)
# Judge status: Accepted
def resolve():
    s = list(input())
    c = 0
    for i in range(len(s)-1):
        if s[i] == s[i+1]:
            if s[i] == "0":
                s[i+1] = "1"
            else:
                s[i+1] = "0"
            c += 1
    print(c)
resolve()
# Judge status: Accepted
n = int(input())

def div_5(n):
    cnt = 0
    mod = 5 * 2
    while mod <= n:
        cnt += n // (mod)
        mod = mod * 5
    return cnt

if n % 2 == 1:
    print(0)
else:
    print(div_5(n))
# Judge status: Wrong Answer
*l,k=map(int,open(0))
print('Yay!' if all([l[i]-l[-~i]<=k for i in range(4)]) else ':(')
# Judge status: Accepted
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
nl = lambda: list(map(int, stdin.readline().split()))

n, m = na()
ans = 10 ** 9 + 7
sc = [na() for _ in range(m)]
for i in range(10 ** n):
    st = str(i)
    if len(st) != n:
        continue
    ok = True
    for s, c in sc:
        if int(st[s-1]) != c:
            ok = False
    if ok:
        print(st)
        exit(0)
print(-1)
# Judge status: Wrong Answer
n=int(input())
count=0
for i in range(1,n+1):
    if i%2==0:
        count+=1
print(count/n)
# Judge status: Wrong Answer
H,A=map(int,input().split())
if H%A==0:
  print(H/A)
else:
  print(H//A+1)
# Judge status: Accepted
s={}
s['a']=list(input())
s['b']=list(input())
s['c']=list(input())
x='a'
while(s[x]):
    x=s[x].pop(0)
print(x.upper())
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
power=2
loop=0
ans=0
for i in range(1,(n*3)+1):
    if loop==n:
        print(ans)
        exit()
    elif power==i:
            ans+=a[i-1]
            power+=2
            loop+=1
# Judge status: Accepted
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    N=int(readline())
    A=list(map(int,readline().split()))

    B=[0]*N
    for i in range(N):
        B[i]=A[i]-i
    B.sort()
    if N%2==1:
        b=B[N//2]
    else:
        b=(B[N//2-1]+B[N//2])//2
    
    res=0
    for i in range(N):
        res+=abs(B[i]-b)

    print(res)
if __name__=="__main__":
    main()
# Judge status: Accepted
l = list(map(int,input().split()))
l.sort()
print(l[0]+l[1])
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
x = [0] * (10 ** 5 + 2)
for i in range(N):
    x[a[i]-1] += 1
    x[a[i]] += 1
    x[a[i]+1] += 1
print(max(x))
# Judge status: Wrong Answer
a = input()
b = input()
r = 0
for i in range(0,len(a)):
  if a[i] == b[i]:
    r += 1
print(r)
# Judge status: Accepted
x = int(input())
a = 100
count = 0
while a < x:
    a = int(a*1.01)
    count += 1
print(count)
# Judge status: Accepted
input()
s=input()
c,m=0,0
for i in range(len(s)):
    if s[i]=="I":
        c+=1
        m=max(c,m)
    if s[i]=="D":
        c=c-1
        m=max(c,m)
print(m)
# Judge status: Accepted
a,b,k=map(int,input().split())
if b-a+1>k*2:
  for i in range(a,a+k):
    print(i)
  for j in range(b-k+1,b+1):
    print(j)
else:
  for h in range(a,b+1):
    print(h)
# Judge status: Wrong Answer
ans=99999999999999
n=int(input())
if n==1:
  print (0)
if n==2:
  print (1)
if n==3:
  print (2)
else:
  for i in range(int(pow(n,0.5)),0,-1):
    if n%i==0:
      break
  print (i+n//i-2)
# Judge status: Accepted
N,M = map(int,input().split())
A = [-int(_) for _ in input().split()]

# 優先度つきキューに変換
import heapq
heapq.heapify(A)

for m in range(0,M):
  a = heapq.heappop(A)
  heapq.heappush(A, a/2)

ans = -sum(int(a) for a in A)
print(ans)