peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n=int(input())
from collections import defaultdict
d=defaultdict(int)
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            d[i**2+j**2+k**2+i*j+j*k+k*i]+=1
for i in range(1,n+1):
    print(d[i])
# Judge status: Accepted
n, m = map(int, input().split())
if n%2 == 1:
    ans = []
    a = 1
    b = n-1
    for i in range(m):
        ans.append((a, b))
        a += 1
        b -= 1
else:
    ans = []
    a = 1
    b = n-1
    flag = True
    for i in range(m):
        if flag and b-a <= n//2:
            b -= 1
            flag = False
        ans.append((a, b))
        a += 1
        b -= 1
for i in range(m):
    print(*ans[i])
# Judge status: Wrong Answer
x, y, z = map(int, input().split())
print(z, y, x)
# 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
#

import sys
input=sys.stdin.readline

def main():
    N=input().strip("\n")
    ans=0
    for i in range(len(N)):
        d=int(N[i])
        if d<=5:
            ans+=d
        else:
            ans+=10-d
            if i==0:
                ans+=1
    print(ans)
    
if __name__=="__main__":
    main()
# Judge status: Accepted
a=int(input())
b=int(input())
if a==1 and b==2 or a==2 and b==1:
    print(3)
elif a==2 and b==3 or a==3 and b==2:
    print(1)
else:
    print(2)
# Judge status: Accepted
x=list(map(int,input().split()))
for i in enumerate(x):
  if i[1]==0:
    print(i[0]+1)
# Judge status: Accepted
M = 10**9 + 7
n = int(input())
print((pow(10, n, M) - 2 * pow(9, n, M) + 8**n) % M)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
s=sum(a)/n
if s-int(s)<=0.5:
    s=int(s)
else:
    s=int(s)+1
ans=0
for i in range(n):
    ans+=(a[i]-s)**2
print(ans)
# Judge status: Accepted
x=int(input())
ans=0
chk=0
ans=ans+(x//11)*2
chk=x%11
if chk>6:
	ans=ans+2
elif chk>0:
	ans=ans+1
print(ans)
# Judge status: Wrong Answer

n = int(input())
sp = [0] * n
for i in range(n):
    sp[i] = list(map(str,input().split()))
    sp[i].append(i+1)

sp.sort(key = lambda x: x[1],reverse = True)
sp.sort(key = lambda x: x[0])
for i in range(n):
    print(sp[i][2])
# Judge status: Accepted
from collections import Counter

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

q1=[]
q2=[]

for i in range(n):
  q1.append(i+a[i])
  q2.append(i-a[i])

c2=Counter(q2)

ans=0
for i in q1:
  ans+=c2[i]

print(ans)
# Judge status: Accepted
s = input()
num = len(s)
i, ans = 0, 0
while i < num-1:
    if s[i] != s[i+1]:
        ans += 1
        i += 1
    else:
        if i == num-2: ans += 1
        else: ans += 2
        i += 3
if num == 1: print(1)
elif i == num-1: print(ans+1)
else: print(ans)
# Judge status: Wrong Answer
n, a, b = map(int, input().split()) 

result = 0

for i in range(n):
    x = 0
    #print(i)
    for j in range(len(str(i+1))):
        x += ((i+1)/(10**j)) % 10
    if a <= int(x) and int(x) <= b:
        #print(i+1)
        result += i+1
print(result)
# Judge status: Wrong Answer
#https://atcoder.jp/contests/abc085/tasks/abc085_d
import math
N, H = map(int, input().split(' '))
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split(' '))
    A.append(a)
    B.append(b)
max_A = max(A)
B = sorted(B, reverse=True)
ans = H
for k in range(N):
    H -= B[k]
    if H > 0:
        cnt = math.ceil(H / max_A) + (k + 1)
    else:
        cnt = 0
    ans = min(ans, cnt)
print(ans)
# Judge status: Wrong Answer
import math
n = int(input())
if n == 1:
    print(0)
else:
    print(10**(n-2)*(math.factorial(n))%(10**9+7))
# Judge status: Wrong Answer
N, W = map(int, input().split())
values = [0 for i in range(W)]
for i in range(N):
  print(values)
  w, v = map(int, input().split())
#  values = values[:w-1] + [max(values[j], v + values[max(0, j-w)]) for j in range(w-1, W)]

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

if a >= c and b<=c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a,b,c,d,e,k = [int(input()) for _ in range(6)]

if e - a > k:
    print(':(')
else:
    print('Yay!')
# Judge status: Accepted
N = int(input())
h = list(map(int,input().split()))
dp = [0] * N
dp[1] = abs(h[0]-h[1])
for i in range(2,N):
    dp[i] = min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]))
print(dp[-1])
# Judge status: Accepted
'''
Introduction to Heuristics Contest
A - AtCoder Contest Scheduling
'''

# 本番テストケースは365
D = int(input())

# コンテストタイプごとの満足度の下がりやすさ
C = list(map(int, input().split()))

# 満足度row日目にコンテストcolタイプを開催したときの満足度の増加
S = []
for _ in range(D):
    sday = list(map(int, input().split()))
    S.append(sday)

# とりあえず
for i in range(D):
    tmp = i % 26 + 1
    print(tmp)
# Judge status: Accepted
N = int(input())
H = list(map(int,input().split()))
dp = [float('inf') for i in range(N)]
dp[0]=0
for i in range(N):
    for j in range(1,3):
        if i+j<N:
            dp[i+j] = min(dp[i]+abs(H[i]-H[i+j]),dp[i+j])
print(dp[N-1])
# Judge status: Accepted
import heapq
ans = 0
n,m = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n):
    a[i] = -a[i]
heapq.heapify(a)
for i in range(m):
    b = heapq.heappop(a)
    b = -(-b//2)
    heapq.heappush(a, b)
for i in range(n):
    ans += a[i]
print(-ans)
# Judge status: Accepted
a,b,c = map(int, input().split())
check = a * 100 + b * 10 + c
if check % 4 == 0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
s = input()

ans = 1
tmp = ''
bs = s[0]
for i in range(1, len(s)):
    tmp += s[i]
    if bs != tmp:
        ans += 1
        bs = tmp
        tmp = ''
print(ans)
# Judge status: Wrong Answer
N=int(input())
X=list(map(int,input().split()))
ans = 100000000
res = 0
for j in range(1,100):
  for i in range(N):
    res += (X[i]-j)**2
  ans=min(ans,res)
print(ans)
# Judge status: Wrong Answer
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,K=nm()
S=list(ns())
LRc=0
hapiness=0
for i in range(N-1):
    if(S[i]=='L' and S[i+1]=='R'):
        LRc+=1
    if((S[i]=='L' and S[i+1]=='L') or (S[i]=='R' and S[i+1]=='R')):
        hapiness+=1

ans=hapiness+min(K,LRc)*2
print(ans)
# Judge status: Wrong Answer
N, M = map(int, input().split())

res = []

for i in range(N):
    a, b = map(int, input().split())
    res+=[a]*b

sorted(res)
print(res[M-1])
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())
s =  max(a,b,c) * (2**k)
print(a+b+c+s-max(a,b,c))
# Judge status: Accepted
n = int(input())
s = list(input())
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
alpha *= 2
for i in range(len(s)):
    s[i] = alpha[alpha.index(s[i]) + n]
print("".join(s))
# Judge status: Accepted
N, K, S = map(int, input().split())

l = [S]*K + [(S+1)%10**9]*(N-K) #長さKで要素が全てSの列（条件満たすK通り）と長さNーKの適当な列で長さN列を生成

print(*l) #*lは標準出力時にはいれつの[]を出力しないため
# Judge status: Wrong Answer
a, b = map(int, input().split())
print(a if a != b else '=1')
# Judge status: Accepted
n = int(input())
a = int(input())
print('Yes' if n % 500 <= a else 'No')
# Judge status: Wrong Answer
# ARC069c
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)

    n, m = map(int, input().split())
    if n > m*2:
        print(m//2+(n-m//2)//2)
    else:
        print(n)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = list(map(int, input()))
 
l = [0] * (len(n)+1)
carry = 0
for i, k in enumerate(n):
  if k > 5 - carry:
    l[i+1] = k - 10
    l[i] += 1
    carry = 1
    while l[i] >= 6 - (1 if l[i-1] < 0 else 0):
      l[i] -= 10
      i -= 1
      l[i] += 1
      if i == 0:
        break
  else:
    carry = 0
# Judge status: Wrong Answer
a, b, x = map(int, input().split())
if a%x ==0:
  print((b - a)//x + 1)
else:
  print((b - a + 1)//x)
# Judge status: Wrong Answer
N = int(input())

def SumDigits(num):
    sum = 0
    while True:
        sum += num % 10
        num //= 10
        if num == 0:
            break
    return sum

infinity = float('inf')
min = infinity

for x in range(1, N//2):
    if SumDigits(x) + SumDigits(N - x) < min:
        min = SumDigits(x) + SumDigits(N - x)
print(min)
# Judge status: Accepted
from collections import Counter

w = list(input())
C = Counter(w)

for c in C.values():
    if c % 2 == 1:
        print("No")
        exit()
print("Yes")
# Judge status: Wrong Answer
N = int(input()) 
A = list(map(int,input().split())) 
if N==1:
    print(1)
    exit()

cnt = 1 
for i in range(N-2):
    if A[i+1]==A[i+2]:
        A[i+1]= A[i]
    elif (A[i]-A[i+1])*(A[i+1]-A[i+2])>0:
        continue 
    else:
        cnt+=1
print(cnt)
# Judge status: Accepted
n,k = map(int,input().split(" "))

a = n
if n<=k:
    a = min([n,k-n])
else:
    a = min([n%k,k-n%k])
print(a)
# Judge status: Accepted
N, K = map(int, input().split())

import math
n = math.log(N, K)
print(int(n) + 1)
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))

cnt = 0
tmp = [-1,-1]
for i in range(n):
  if p[i] == i+1:
    if i+1 == tmp[0]+1 and p[i]==tmp[1]+1:
      cnt+=0
      tmp = [-1, -1]      
    else:
      cnt+=1
      tmp = [i+1,p[i]]
#    print(p[i],tmp,cnt)
print(cnt)
# Judge status: Accepted
def resolve():
    a, b, c = list(map(int, input().split()))
    if ((-a + b + c == 0)
        or (a - b + c == 0)
        or (a + b - c == 0)):
        print("Yes")
    else:
        print("No")

resolve()
# Judge status: Accepted
W, A, B = map(int, input().split())
print(max(abs(B-A)-W, 0))
# Judge status: Wrong Answer
N, K = map(int, input().split())
S = input()

x = sum(S[i] == "R" and S[i + 1] == "L" for i in range(N - 1))
y = int(S[0] == "L") + int(S[-1] == "R")
res = N - 2 * x - y

ans = res + 2 * min(K, x) + max(0, min(1, K - x))
print(ans)
# Judge status: Wrong Answer
X=int(input())
a=int(X//500)
X=X%500
b=int(X//5)
print(a+b)
# Judge status: Accepted
N = int(input())
d = list(map(int, input().split()))
d.sort()
print(d[N//2] - d[N//2 - 1])
# Judge status: Accepted
n, m = map(int, input().split())

a = [[1, False] for _ in range(n+1)]
a[1] = [1, True]

for _ in range(m):
    x, y = map(int, input().split())
    if a[x][1]:
        a[y][1] = True
    
    a[x][0] -= 1
    if a[x][0] == 0:
        a[x][1] = False
    a[y][0] += 1

print(sum(x[1] for x in a))
# Judge status: Accepted
D,N = map(int,input().split())
A = [int(i) for i in range(1,100)] + [101]
B = [int(i*100) for i in range(1,100)] + [10100]
C = [int(i*10000) for i in range(1,100)] + [1010000]

if D == 0:
	print(A[N-1])
elif D == 1:
	print(B[N-1])
else:
	print(C[N-1])
# Judge status: Wrong Answer
s = input()

r = 'Yes'
for w in s:
  if s.count(w) % 2 == 1:
    r = 'No'
    break
print(r)
# Judge status: Accepted
def comb(n,k,mod):
    x = y = 1
    for i in range(min(k,n-k)):
        x = x*(n-i)%mod
        y = y*(i+1)%mod
    return x * pow(y, mod-2, mod) % mod

x,y = map(int,input().split())
ans = 0
mod = 10**9+7
if (x+y)%3 == 0:
    a = (-x+2*y)//3
    b = (2*x-y)//3
    if a >= 0 and b >= 0: ans = comb(a+b,a,mod)
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))
l = [0] * n
count = 0
for i in a:
        l[i-1] += 1
l.sort(reverse = True)
for i in range(k):
    count += l[i]
print(n-count)
# Judge status: Accepted
X=int(input())
have=100
count =0
while True:
  have = int(have*1.01)
  count += 1
  if have >= X:
    print(count)
    break
# Judge status: Wrong Answer
n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort(reverse = True)
ans = 0
for i in range(k):
    ans += (p[i] + 1) / 2
print('{:.12f}'.format(ans))
# Judge status: Wrong Answer
def Main(N):
    ans = 0
    for i in range(N):
        if i%15 == 0 or i%5 == 0 or i%3 == 0:
            continue
        else:
            ans += i
    return ans
    

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

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
if len(a)%2 == 1:
    print(*a[0::2][::-1] + a[1::2])
else:
    print(*a[1::2][::-1] + a[0::2])
# Judge status: Accepted
from itertools import product
A,B,C,D = list(input().strip())
for x in product(("+","-"),repeat=3):
    a1,a2,a3 = x
    if eval(A+a1+B+a2+C+a3+D)==7:
        print(A+a1+B+a2+C+a3+D+"=7")
        break
# Judge status: Accepted
if int(input()) >= 30:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
#!/usr/bin/env python3

import functools


M = 10 ** 9 + 7


def sum_mod(xs):
    return functools.reduce(lambda x, y: (x + y) % M, xs) % M


def compute(bs):
    term1 = sum_mod(bs) * sum_mod(bs) % M
    term2 = sum_mod(b * b for b in bs)
    double_res = (term1 - term2) % M
    inv2 = pow(2, M - 2, M)
    res = double_res * inv2 % M
    return res


def main():
    n = int(input())
    bs = [int(b) for b in input().split()]
    res = compute(bs)
    print(res)


if __name__ == '__main__':
    main()
# Judge status: Accepted
# ABC123 A

def main():

    antennas = []
    for _ in range(5):
        char = int(input())
        antennas.append(char)
    
    k = int(input())
    result = 'Yay!'
    
    for antenna in antennas[::-1]:
        if antenna - antennas[0] > k:
            result = ':('
            break
    
    print(result)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=0
for i in range(k):
  b+=a[i]

ma=b
for i in range(n-k):
  b+=a[k]
  b-=a[i]
  ma=max(b,ma)

ans=(ma+k)/2
# Judge status: Wrong Answer
def resolve():
    s = input()
    for bit in range(2 ** 3):
        _str = "".join(
            s[i] if i == 3 else s[i] + "+" if 1 << i & bit else s[i] + "-"
            for i in range(4)
        )
        if eval(_str) == 7:
            print(_str + "=7")


if __name__ == "__main__":
    resolve()
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
print(max(A * 10 + B + C,A + B * 10 + C))
# Judge status: Wrong Answer
import math

n,k =  map(int,input().split())
lis = []
for i in range(n):
    lis.append(math.ceil(math.log2((k/(i+1)))))
#print(lis)


ans = []
for i in range(n):
    ans.append(1/n * (1/2)**lis[i])

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

for i in range(n):
    print(load.count(i+1))
# Judge status: Accepted
a,b,c=list(map(int,input().split()))
if b-a==c-b:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors

def main():
    N, M = map(int, input().split())
    d = make_divisors(M)
    for i in d:
        if M // i >= N:
            return i
print(main())
# Judge status: Wrong Answer
s= str(input())
ans = 0
for i in range(len(s)):
    if i // 2 == 0:
        if s[i] == '0':
            ans += 1
        else:
            ans -= 1
    else:
        if s[i] == '1':
            ans += 1
        else:
            ans -= 1
print((len(s)-abs(ans))//2)
# Judge status: Wrong Answer
n = int(input())

total = 0

for i in range(n):
    total = total + i*i

print(total)
# Judge status: Accepted
import numpy as np
L=list(map(int,input().split()))
N=L[0]
D=L[1]
count=0
M = [list(map(int, input().split(" "))) for j in range(N)]

for j in range(N):
    r=np.sqrt((M[j][0])**2+(M[j][1])**2)
    if r<=D:
        count += 1

print(count)
# Judge status: Accepted
N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
 
D = 0
a = 1
for i in range(N):
    D = D + L[i]
    if D <= X:
        a += 1
    else:
        break
print(a)
# Judge status: Wrong Answer
ss=input().split()
r=''
for s in ss:
  if s!='B':
    r+=s
  elif len(r)>0:
    r=r[:-1]
print(r)
# Judge status: Wrong Answer
S=list(input())
T=list(input())
s=sorted(S)
t=sorted(T)
if s==t:
	print("Yes")
else:
	print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
mod2 = mod4 = 0
for i in a:
    if i%4==0:
        mod4 += 1
    elif i%2==0:
        mod2 += 1
n -= max(0, mod2-1)
if n<=mod4*2+1:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split(' ')))
ans = 0
tmp = 0
for i in range(n):
    if i+1 == a[i]:
        tmp += 0.5
    elif tmp:
        ans += tmp//2 + 1
        tmp = 0
if tmp:
    ans += int(tmp//2) + 1
print(ans)
# Judge status: Wrong Answer
sentence = input()
new_sent = sentence.split(" ")
acro = ""
for i in range(len(new_sent)):
  acro += new_sent[i]
print(acro)
# Judge status: Wrong Answer
h = int(input())
w = int(input())
n = int(input())
if h < w:
    h = w
print(int(n / h) + 1)
# Judge status: Wrong Answer
import itertools
n,m=map(int,input().split())
ab= [list(input()) for _ in range(m)]
ab=list(itertools.chain.from_iterable(ab))
k=len(set(ab))
for i in range(1,k+1):
    print(ab.count(i))
# Judge status: Accepted
a,b,c,d = map(int, input().split())
if abs(c-a)<=d:
  print('Yes')
elif abs(c-b)<=d and abs(b-a)<=d:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n,m = list(map(int,input().strip().split()))
p = 10**9+7

result = 1
for i in range(1,n+1):
  result = (result *i) % p
for j in range(1,m+1):
  result = (result *j)  % p
  
if n == m:
  result = (result *2) % p

print(result)
# Judge status: Accepted

S = input()
T = input()
from collections import defaultdict

dictS = defaultdict(str)
dictT = defaultdict(str)

for i in range(len(S)):
  
  if dictT[T[i]] and dictT[T[i]] != S[i]:
    print("No")
    exit()
  
  if dictS[S[i]] and dictS[S[i]] != T[i]:
    print("No")
    exit()


  dictS[S[i]] = T[i]
  dictT[T[i]] = S[i]

print("Yes")
# Judge status: Accepted
n = int(input())
s = str(input())

if n % 2 == 1:
  print('No')
else:
  s_before = s[:int(n/2)]
  s_latter = s[int(n/2):]
  if s_before == s_latter:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
# A - 居合を終え、青い絵を覆う
v=['a','e','i','o','u']
c=input()

if c in v:
    print("vowel")
else:
    print("consonant")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split())) 

ans = 0

for i in range(n):
    if i % 2 == 0:
        if a[i] % 2 != 0:
            ans += 1

print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    if b[i]>=a[i]:
        ans += a[i]
        b[i] -= a[i]
        a[i] = 0
        ans += min(b[i],a[i+1])
        b[i] -= min(b[i],a[i+1])
        a[i+1] -= min(b[i],a[i+1])
    else:
        ans += b[i]
        a[i] -= b[i]
        b[i] -= b[i]

print(ans)
# Judge status: Accepted
N=int(input())
result=64
while N>=1:
  if N >= result:
    print(result)
    break
  result=int(result/2)
else:
  print(result)
# Judge status: Wrong Answer
N,K,S=map(int,input().split())
ans=[S]*N
for i in range(N-K):
  ans[i]=S+1
print(*ans)
# Judge status: Wrong Answer
# coding: utf-8
sx, sy, tx, ty = map(int, input().split())

ans = ""
dx = tx - sx
dy = ty - sy

for i in range(dx):
    ans += "R"
for i in range(dy):
    ans += "U"
for i in range(dx):
    ans += "L"
for i in range(dy + 1):
    ans += "D"
for i in range(dx + 1):
    ans += "R"
for i in range(dy + 1):
    ans += "U"
ans += "LU"
for i in range(dx + 1):
    ans += "L"
for i in range(dy + 1):
    ans += "U"
ans += "R"

print(ans)
# Judge status: Accepted
a = [int(i*1.08) for i in range(1, 46298)]
n = int(input())
if(n in a):
  print(a.index(n)+1)
else:
  print(":(")
# Judge status: Wrong Answer
h,a=map(int,input().split())
l=0
while h>=0:
    h = h-a
    l += 1
print(l)
# Judge status: Accepted
n = input()
print("x"*len(n))
# Judge status: Accepted
from sys import stdin
from sys import setrecursionlimit
import bisect
setrecursionlimit(10 ** 7)

s = input()
point = 0

for i in range(len(s)):
    for j in range(i,len(s)):
        now = s[:i]+s[j:]
        if now == "keyence":
            print("YES")
            exit()
print("NO")
# Judge status: Accepted
s=list(input());print(['No','Yes'][all([1 if s.count(i)%2==0 else 0 for i in set(s)])])
# Judge status: Accepted
A,B = map(int, input().split())
if A == 1:
    if B == 1:
        print("Draw")
    else:
        print("Alice")
elif B == 1:
    print("Bob")
else:
    if A > B:
        print("Alice")
    elif A < B:
        print("Bob")
    else:
        print("Draw")
# Judge status: Accepted
a,b = map(int, input().split())
s = input()
print('Yes' if s[a] == '-' and (s[:a] + s[a + 1:]).isdigit() else 'No')
# Judge status: Wrong Answer
n, k = [int(i) for i in input().split()]
s = input()
n_group = 0
now = s[0]
cnt = 0
happy = 0
s += 'z'
for i in s:
	if now != i:
		n_group += 1
		if cnt > 1:
			happy += cnt - 1
		cnt = 1
	else:
		cnt += 1
	now = i

for i in range(k):
	if n_group > 2:
		n_group -= 2
		happy += 2
	else:
		happy += 1
print (happy)
# Judge status: Wrong Answer
N = int(input())
li = list(map(int, input().split()))

li.sort()

sum = 0
for i in li[:-2]:
    sum = i + sum

Nmax = li[-1]
if Nmax >= sum:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
def solve():
    n = int(input())
    l = list(map(int,input().split()))
    res = 0
    for i in range(n-1):
        if l[i]==i+1:
            l[i],l[i+1]=l[i+1],l[i]
            res+=1
    if l[n-1]==n:
        res+=1
    print(res)
if __name__=='__main__':
    solve()
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-


def main():
    import sys
    input = sys.stdin.readline

    d = int(input())
    c = list(map(int, input().split()))
    s = [list(map(int, input().split())) for _ in range(d)]

    for i in range(1, d + 1):
        print(i)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
h1, m1, h2, m2, k = map(int, input().split())
pos = 60 * (h2 - h1) + abs(m2 - m1)
print(pos - k)
# Judge status: Accepted
n, m = map(int, input().split())

a = [False]*n
b = [False]*n
for i in range(m):
    left, right = map(int, input().split())
    if left == 1:
        b[right-1] = True
    if right == n:
        a[left-1] = True

ans = 'IMPOSSIBLE'
for i in range(n):
    if a[i] == True and b[i] == True:
        ans = 'POSSIBLE'
print(ans)
# Judge status: Wrong Answer
import math
a, b, x = map(int, input().split())
if a**2*b == x:
    s = 0
elif (a**2)*b/2 <= x:
    s = math.degrees(math.atan(a/(2*(b-(x/(a**2))))))
else:
    s = math.degrees(math.atan(2*x/(a*b**2)))
print(90-s)
# Judge status: Wrong Answer
n, k = map(int, input().split())
H = sorted([int(input()) for _ in range(n)])

ans = 10e5
for i in range(n - k + 1):
    select = H[i: i + k]
    ans = min(ans, select[-1] - select[0])

print(ans)
# Judge status: Wrong Answer
A, B = map(int, input().split())
div, rem = divmod(abs(A - B), 2)
print("IMPOSSIBLE" if rem else abs(A - div))
# Judge status: Accepted
n,*l=map(int,open(0).read().split())
c=[0]*13
for i in l: c[i//400]+=1
a=8-c[:8].count(0)
print(max(1,a),a+sum(c[8:]))
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()


def main():
    L = list(map(int, input().split()))
    L.sort()
    a, b, c = L[0], L[1], L[2]
    ans = c - b
    a += ans
    if (c - a) % 2 != 0:
        ans += 1
        c += 1
    print(ans + (c - a) // 2)


if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
checknum = 1
for i in range(N):
    if a[i] == checknum:
        checknum += 1
if checknum == 1:
    print(-1)
else:
    print(N - checknum + 1)
# Judge status: Accepted
A, B, C, D = list(map(int, input().split()))

while (C > 0) and (A > 0):
    C = C - B
    if C > 0:
        A = A - D
    else:
        break

if A > 0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))
#xor_a = [bin(x) for x in a]
#print(xor_a)
b = [sum(a) ^ a[x] for x in range(N)]
#b = [sum(a) ^ x for x in a]　でもいける
print(' '.join(map(str, b))) #' 'joinにより空白を間にいれる。mapにより文字列に直す
# Judge status: Accepted
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):
        for k in range(c+1):
            if 500*i + 100*j + 50*k == x:
                cnt += 1
print(cnt)