peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n,k = map(int,input().split())
h = []
for i in range(n):
    hi = int(input())
    h.append(hi)
h.sort()

min = 10**100
for i in range(n-k+1):
    if min > h[k+i-1]-h[i]:
        min = h[k+i-1]-h[i]

print(min)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split(' ')))
x=0
y=0
a.sort()
a.reverse()
for i in range(len(a)-1):
    if a[i]==a[i+1]:
        x=a[i]
        p=i+1
        break
if x!=0:
    for i in range(p,len(a)-1):
        if a[i]==a[i+1]:
            y=a[i]
            break
print(x*y)
# Judge status: Wrong Answer
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    s = list(input())
    a = ('ABC')
    if s == a:
        print('ARC')
    else:
      print('ABC')
    

if __name__ == '__main__':
    solve()
# Judge status: Accepted
n = int(input())
alst = list(map(int, input().split()))
ans = [-1 for _ in range(n)]
for i, a in enumerate(alst, start = 1):
  ans[a - 1] = i
print(*ans)
# Judge status: Accepted
from collections import Counter

s=Counter(input() for i in range(int(input())))
t=Counter(input() for i in range(int(input())))
print(max([0]+[s[i]-t[i] for i in s.keys()]))
# Judge status: Accepted
lst = input().split()
x = int(lst[0])
y = int(lst[1])
z = int(lst[2])

x -= z

print(x // (y + z))
# Judge status: Wrong Answer
import math
n,X=map(int,input().split())
x=list(map(int,input().split()))
x.append(X)
x.sort()
a=x[1]-x[0]
for i in range(1, n):
  a = math.gcd(a, x[i]-x[i-1])
print(a)
# Judge status: Accepted
H = int(input())
W = int(input())
N = int(input())

Num = 0
Count = 0
if(H > W):
  while(Num < N):
    Num += H
    Count += 1
else:
  while(Num < N):
    Num += W
    Count += 1

print(Count)
# Judge status: Accepted
s= input()
t = input()
S = s+s
if t in S:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = input()
n = 0
for a in s:
  if a =='1':
    n += 1
print(n)
# Judge status: Accepted
from collections import deque

s = deque(input())
q = int(input())
rev = False

for _ in range(q):
    t = input()
    if t[0] == "2":
        _, f, c = t.split()
        if rev:
            if f == "2": s.appendleft(c)
            else: s.append(c)
        else:
            if f == "1": s.appendleft(c)
            else: s.append(c)
    else: rev = not rev

if rev: s.reverse()
print("".join(s))
# Judge status: Accepted
h, n = list(map(int, input().split()))
a = list(map(int, input().split()))
if sum(a) >= h:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n>k:
  print((n-k)*y+x*k)
else:
  print(x*n)
# Judge status: Accepted
N = int(input())
d = list(map(int, input().split()))
d.sort()
print(d[int(N/2)]-d[int(N/2-1)])
# Judge status: Accepted
from collections import Counter

n = int(input())
d = list(map(int, input().split()))
mod = 998244353

c = Counter(d)

if d[0] != 0 or c[0] != 1:
    print(0)
    exit()

ans = 1
for i in range(1, max(d)+1):
    if i not in c:
        print(0)
        exit()
    ans *= pow(c[i-1], c[i], mod)

print(ans % mod)
# Judge status: Accepted
import math
a,b = map(str,input().split())
c = (int)(a+b)
d = (int)(math.sqrt((float)(c)))
if d*d == c:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a % b == 0:
    print('Even')
else:
    print('Odd')
# Judge status: Wrong Answer
a,b = map(int,input().split())

c = b - a + 1
d = b + a - 1

print(list(range(c,d)))
# Judge status: Wrong Answer
a = int(input())
print((a*(a-1))//2)
# Judge status: Accepted
n=int(input())
N=list(map(int,input().split()))

max_n=max(N)
N.remove(max_n)
print("Yes" if max_n<sum(N) else "No")
# Judge status: Accepted
s = input()
day = ['SAT','FRI','THU','WED','TUE','MON','SUN']
for i in range(7):
  if s == day[i]:
    print(i + 1)
    exit()
# Judge status: Accepted
k = int(input())

s = input()

if len(s) <= k:
    print(s)
else:
    for i in range(k):
        print(s[i],end='')
    print('...')
# Judge status: Accepted
AtCoder,s,Contest = map(str, input().split())
w = 'A' + str(s[0]) + 'C'
print(w)
# Judge status: Accepted
import math

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


ans = 0

for a, b in zip(A[::-1], B[::-1]):
    a += ans
    ans += math.ceil(a / b) * b - a

print(ans)
# Judge status: Accepted
A, B = map(int, input().split())
S = str(input())

if S.isdecimal():
    print("No")
else:
    s = list(map(str, S))
    del s[A]

    count = s.count("-")

    if count ==0:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
import math
n = int(input())
a = sorted(list(map(int,input().split())))
b = (a[-1]+1)//2
d = float("inf")
for i in a:
    if abs(b-i) < d:
        d = abs(b-i)
        ans = i
print(a[-1],ans)
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    k, x = map(int, input().split())
    black = [i for i in range(x-(k-1), x+k)]
    print(*black)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = input()

def digitSum(n):
    array = list(map(int, n))
    return sum(array)

if digitSum(n)%9==0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
import numpy as np
import math
s = int(input())
if s < 3:
  print(0)
  sys.exit()
max1 = s // 3
min1 = s // 9 + np.sign(s % 9)
answer = 0
for j in range(min1, max1+1):
  keta = [3] * j
  choice = j
  answer1 = 1
  for i in range(s-j*3):
    answer1 *= choice
    keta[-1] += 1
    if keta[-1] == 9:
      keta.pop()
      choice -= 1
  answer += answer1
print(answer % (10**9+7))
# Judge status: Accepted
a,b,c = map(int,input().split())

if a >= c >= b or a <= c <= b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
#sortedをつけながらinput
a,b,c=sorted(map(int,input().split()))
# a,b,cに偶数があれば0
print((a*b*c)%2*a*b)
# Judge status: Accepted
s = [int(i) for i in list(input())]

num_li = []
for i in range(len(s)-2):
    num_li.append(s[i]*100+s[i+1]*10+s[i+2])
if 753 in num_li:
    print(0)
else:
    print(min([abs(753-n) for n in num_li]))
# Judge status: Wrong Answer
N, K = map(int, input().split())
data = set(range(N + 1))
data = data - {0}
data_remove = set()
for i in range(K):
    n = int(input())
    data_n = set(input().split())
    data_remove = data_remove | data_n
print(len(data - data_remove))
# Judge status: Accepted
ans = 0
for s, t in zip(input(), input()):
    if s != t : ans+=1
print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
h=[]
for i in range(n):
    h.append(int(input()))
h_sort=sorted(h)
print(min(h_sort[j+k-1]-h_sort[j] for j in range(n-k+1)))
# Judge status: Wrong Answer
N = int(input())
A = [int(input()) for _ in range(N)]


ans = 0
cnt = 0
for i in range(N):
    ans += (A[i]+cnt)//2
    cnt = A[i]%2
print(ans)
# Judge status: Wrong Answer
N = int(input())
for x in range(1,10000):
  if x*108//100==N:
    print(x)
    break
if x==9999:
  print(":(")
# Judge status: Accepted
n = int(input())
s = input()
ans = s.count('R')*s.count('G')*s.count('B')
for i in range(n-2):
  for j in range(i+1,n-1):
    if 2*j - i > n-1:
      break
    if s[i] != s[j] and s[j] !=  s[2*j-i] and s[2*j-i] != s[i]:
      ans -=1
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
ans = ["-1"]*n

for _ in range(m):
    s,c = input().split()
    s = int(s)-1
    if ans[s] != "-1" and ans[s] != c: 
        print(-1)
        exit()
    ans[s] = c

if n != 1 and ans[0] == "0":
    print(-1)
    exit()



for i in range(n):
    if ans[i] == "-1":
        ans[i] = "0" if i != 0 or n == 1 else "1"

print("".join(ans))
# Judge status: Wrong Answer
a,b=map(int,input().split())
L=[]
for i in range(b):
   L.append(list(map(int,input().split())))
for i in range(b):
      print(L.count(i+1))
# Judge status: Accepted
x,y,a,b,c = map(int,input().split())
n = a+b+c
ar = list(map(int,input().split()))
br = list(map(int,input().split()))
cr = list(map(int,input().split()))
ls = []
for i in ar:
  ls.append([i,1])
for i in br:
  ls.append([i,2])
for i in cr:
  ls.append([i,3])
ls.sort(reverse = True)
nx = 0
ny = 0
cnt = 0
res = 0
for item in ls:
  if item[1]==1:
    if nx==x: continue
    nx+=1
  if item[1]==2:
    if ny==y: continue
    ny+=1
  res+=item[0]
  cnt+=1
  if cnt==x+y:
    break
print(res)
# Judge status: Accepted
a = int(input())
print(a+ a**2+ a**3)
# Judge status: Accepted
n = int(input())

ans = abs(n)
for i in range(n > 0, 50, 2):
    if ans & (1 << i) == (1 << i):
        ans += (1 << (i + 1))
print(f'{ans:b}')
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math


def main():
    A, B, C, D = map(int, input().split())
    print(max(min(B, D) - max(A, C), 0))


if __name__ == "__main__":
    main()
# Judge status: Accepted
# Vicfred
# https://atcoder.jp/contests/abc071/tasks/abc071_b
# string manipulation, implementation
S = input().strip()
alphabet = "abcdefghijklmnopqrstuvwxyz"

for ch in alphabet:
    if ch not in S:
        print(ch)
        exit()
print("None")
# Judge status: Accepted
a, b, c = map(int, input().split())

if a <= c <= b:
    print('Yes')
elif b <= c <= a:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, K = map(int, input().split())
t = [1] * N
for i in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    t[a-1] = 0
print(sum(t))
# Judge status: Accepted
# -*- coding: utf-8 -*-

X = int(input())

if X == 1:
    print('0')
else:
    print('1')
# Judge status: Accepted
N = int(input())

ans = []
def dp(arg, level):
    global N
    if len(arg) == N:
        ans.append(arg)
        return
    #
    orda = ord('a')
    for i in range(level):
        dp(arg + chr(orda + i), level)
    dp(arg + chr(orda + level), level + 1)
    return

dp('', 0)
for ansi in ans:
    print(ansi)
# Judge status: Accepted
n = int(input())
s = input()
ans = 0
for i in range(n-1):
    s1 = s[:i+1]
    it = iter(s[i+1:])
    it2 = iter(s[i+1:])
    s2 = dict(zip(it,it2))
    visited = {}
    for i in s1:
        if i in visited:
            continue
        if i in s2:
            visited[i] = 1
    ans = max(ans,len(visited))
print(ans)
# Judge status: Wrong Answer
import collections as c
import sys
s = input()
l = len(s)

if l == 1:
	print("NO")
else:
	S = c.Counter(list(map(str,s)))

	if len(S.keys()) <= 2:
		if l == 2:
			print("YES")
		else:
			print("NO")
		sys.exit()

	cnt = set(list(S.values()))

	if len(cnt) == 3:
		print("NO")
	elif len(cnt) == 2:
		a,b = cnt
		if abs(a-b) <= 1:
			print("YES")
		else:
			print("NO")
	else:
		print("YES")
# Judge status: Accepted
N=int(input())
P=[1]+list(map(int,input().split()))

ans=0
for i in range(1,N+1):
    if P[i]==i:
        if (i<N and i+1==P[i+1]) or i==1:
            P[i+1],P[i]=P[i],P[i+1]
            ans+=1
        else:
            P[i-1],P[i]=P[i],P[i-1]
            ans+=1
print(ans)
# Judge status: Wrong Answer
s = input()

ans1 = True
ans2 = True

if "N" in s:
    ans1 = "S" in s
if "W" in s:
    ans2 = "E" in s

print("Yes" if ans1 and ans2 else "No")
# Judge status: Accepted
from heapq import heapify, heappush, heappop
n, m = [int(it) for it in input().split(' ')]
items = [ - int(it) for it in input().split(' ')]
heapify(items)
for i in range(m):
    heappush(items, - (- heappop(items) // 2))

print(- sum(items))
# Judge status: Wrong Answer
A,B=map(int,input().split())
if A%2==B%2: print('IMPOSSIBLE')
else: print(int((A+B)/2))
# Judge status: Accepted
x = list(map(int, input().split()))

print(sum(range(1, 5 + 1)) - sum(x))
# Judge status: Wrong Answer
X = int(input())
counta = 0
countb = 0
while X%500 == 0:
  counta +=1
  X//=500
  
while X%5==0:
  countb +=1
  X//=5
print(1000*counta+5*countb)
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    count = 0
    for i, c in enumerate(S):
        if i % 2 == int(c):
            count += 1

    print(min(count, len(S) - count))
    return


if __name__ == '__main__':
    main()
# Judge status: Accepted
from math import ceil
N,X,T=map(int,input().split())
print(T*ceil(N/X))
# Judge status: Accepted
s,w = map(int,input().split())

ans = 'unsafe' if s<=w else 'safe'
print(ans)
# Judge status: Accepted
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


# inputna
s = input()
d = {"a":0, "b":0, "c": 0}
for c in s:
    d[c] += 1
if max(d.values()) - min(d.values())<=1:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
S=str(input())
T=str(input())
min_count=len(T)
for i in range(len(S)-len(T)):
    count=0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            count+=1
    min_count=min(count,min_count)
print(min_count)
# Judge status: Wrong Answer
X = int(input())

if (X < 599):
    print('8')
elif (X < 799):
    print('7')
elif (X < 999):
    print('6')
elif (X < 1199):
    print('5')
elif (X < 1399):
    print('4')
elif (X < 1599):
    print('3')
elif (X < 1799):
    print('3')
elif (X < 1999):
    print('1')
# Judge status: Accepted
N=int(input())
S=[]
for i in range(N):
  S.append(input())
d=set(S)

print(len(d))
# Judge status: Accepted
a = set(map(lambda x: int(x), input().split()))

if(len(a) == 2):
    print('Yes')
else: print('No')
# Judge status: Wrong Answer
x = list(map(str,input().split()))

if(len([0]) < 2 and len(x[1]) < 2):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in a:
  b[i-1]+=1
print(*b)
# Judge status: Wrong Answer
x = 'TSSTTTSS'
while 'ST' in x:
    x = x.replace('ST', '', 1)
print(len(x))
# Judge status: Accepted
A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
C = [2]
x,y = map(int,input().split())
if x==y==2 or x in A and y in A or x in B and y in B:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
S=0
for i in range(2*N):
    if i%2==1:
        S+=a[i]

print(S)
# Judge status: Wrong Answer
n = int(input())
*p, = map(int, input().split())
ans = 0
for i in range(n-1):
    if (p[i] == (i+1) or p[i+1] == (i+2)):
        if p[i] == (i+2):
            continue
        ans += 1
        p[i], p[i+1] = p[i+1], p[i]
print(ans)
# Judge status: Accepted
d, n = list(map(int, input().split()))
cnt = 0
i = 1

while True:
  if(d == 0 and i % 100 != 0):
    cnt += 1    
  if(d != 0 and i % (100 ** d) == 0 and i % (100 ** (d+1)) != 0):
    cnt += 1
  if(cnt == n):
    print(i)
    exit()
  i += 1
# Judge status: Accepted
x,y=map(int,input().split())
count=abs(abs(x)-abs(y))
if x==-y:
    print(1)
elif x*y<0:
    print(count+1)
elif x<y:
    print(count)
elif x*y:
    print(count+2)
else:
    print(count+1)
# Judge status: Accepted
n = int(input())
z = list(map(int, input().split()))
a = sorted(t - i - 1 for i, t in enumerate(z))
print(sum(abs(t - a[n//2]) for t in a))
# Judge status: Wrong Answer
n,y = map(int,input().split())
y = y // 1000

for a in range(n+1):
    rest = y - a * 10
    if rest < 0:break
    for b in range(n+1):
        rest = rest - b * 5
        c = n - a - b
        if rest < 0:break
        if rest == c:
            print(a,b,c);exit()
print(-1,-1,-1)
# Judge status: Wrong Answer
C = [list(map(int, input().split())) for i in range(3)]
ans = [[], []]
for i in range(3):
    l = []
    for j in range(3):
        l.append(C[j][i])
    ans[1].append(min(C[i]))
    ans[0].append(min(l))

for i in range(3):
    for j in range(3):
        if ans[0][i] + ans[1][j] != C[j][i]:
            print('No')
            exit()
print('Yes')
# Judge status: Wrong Answer
n = int(input())
dishes = list(map(int, input().split()))
points = list(map(int, input().split()))
bonuses = list(map(int, input().split()))

score = 0
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i == prev + 1: score += bonuses[i-2]
  print(score)
  prev = i

print(score)
# Judge status: Accepted
def resolve():
    S = list(input())
    if len(S)%2 == 0:
        s1, s2 = S[:len(S)//2], S[len(S)//2:]
    else:
        s1, s2 = S[:len(S)//2], S[(len(S)//2)+1:]
    s2.reverse()
    cnt = 0
    for i in range(len(s1)):
        if s1[i] != s2[i]:
            cnt += 1
    print(cnt)


if '__main__' == __name__:
    resolve()
# Judge status: Wrong Answer
x=int(input())
a=0
for i in range(x):
  if a+i>=x:
    print(i)
    break
  else:
    a+=i
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

ans = 0

for i in range(n-2):
    #比較する3つのｐの値
    buf = p[i:i+3]
    #真ん中の数値
    buf1 = buf[1]
    
    buf.sort()
    if buf[1] == buf1:
        ans += 1
    #print(buf)

print(ans)
# Judge status: Wrong Answer
# C - Skip

import numpy as np
import fractions

N, X = map(int, input().split())
x = list(int(x) for x in input().split())
x.append(X)
x.sort()
x = np.array(x)
x = x - x[0]

ans = 10**18
if N == 1:
    print(x[1] - x[0])
else:
    for i in range(N-1):
        ans = min(ans, fractions.gcd(x[i], x[i+1]))
    print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
if 0 < n and n < 10 and 0 < m and m < 10:
    print(n*m)
else:
    print(-1)
# Judge status: Wrong Answer
n = int(input())
c = input()
n = len(c)//2
ans = max(c.count('W',0,n), c.count('R',n,n*2))
print(ans)
# Judge status: Accepted
N,K,S = map(int,input().split())
A = [S for i in range(K)]
if S<10**9:
    A += [S+1 for i in range(N-K)]
else:
    A += [1 for i in range(N-K)]
print(*A)
# Judge status: Accepted
import sys
N, K = map(int, sys.stdin.readline().rstrip().split())
number = list(range(1, N+1))
lists = []
for i in range(K):
  d = sys.stdin.readline().rstrip()
  li = [int(x) for x in sys.stdin.readline().rstrip().split()]
  for k in li:
    if k in number:
      number.remove(k)
  lists.append(li)
#print(lists)
print(len(number))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
print("APPROVED" if all(i % 6 == 0 or i % 10 == 0 for i in a) else "DENIED")
# Judge status: Wrong Answer

n=int(input())
s=str(input())
e_cnt=s.count('E')
num=[0]*n
num2=[0]*n
count=0
count2=0
for i in range(n):
    if s[i]=='W':
        count+=1
    else:
        count2+=1
    num[i]=count
    num2[i]=e_cnt-count2


ans=[0]*n

for i in range(n):
    ans[i]=abs(num[i]+num2[i])
print(min(ans))
# Judge status: Accepted
from fractions import gcd
from functools import reduce 
N, X = map(int,input().split())
xi = list(map(lambda x: abs(x-X), list(map(int,input().split()))))
print(reduce(gcd,xi))
# Judge status: Accepted
n = int(input())
hlist = list(map(int, input().split()))

# The minimum cost to reach step i (1->n)
dp = [0]*(n+1)
dp[1] = 0 # 1->1

for i in range(2, n+1):
    dp[i] = min(dp[i-1] + abs(hlist[i-2] - hlist[i-1]), (dp[i-2] + abs(hlist[i-3] - hlist[i-1]) if i>2 else 10**9))

print(dp[n])
# Judge status: Accepted
import sys
N = int(input())

num = sorted([int(input()) for i in range(N)])
MAX = sum(num)

if MAX % 10 != 0:
    print(MAX)
    sys.exit()
else:
    for i in range(N):
        if num[i] % 10 != 0:
            print(MAX - num[i])
            sys.exit()

print(0)
# Judge status: Accepted
s = int(input())
dp =[0]*2001
dp[0] = dp[1] = dp[2] = 0
dp[3] = dp[4] = dp[5] = 1
dp[6] = dp[3]+1
for i in range(7,s+1):
    dp[i] = dp[i-1]+dp[i-3]
print(dp[s] % (10**9+7))
# Judge status: Accepted
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
A=[input().strip() for _ in range(n)]
B=[input().strip() for _ in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        flg=True
        for k in range(m):
            #print(A[i+k][j:j+m],B[k])
            if A[i+k][j:j+m]!=B[k]:
                flg=False
        if flg:
            print("Yes")
            exit()

print("No")
# Judge status: Wrong Answer
a,b = [int(x) for x in input().split()]


def sosu(n):
    ret = True
    for i in range(2,int((n**0.5)+1)):
        if n % i == 0:
            ret = False
            break
    return ret


def f(n):
    ret = []
    for i in range(1,int((n**0.5)+1)):
        if n % i == 0 and sosu(i):
            ret.append(i)
    return ret

A = f(a)
B = f(b)

ans = set(A) & set(B)
print(len(ans))
# Judge status: Wrong Answer
A,B,C,X,Y=map(int,input().split())
if A+B<=C*2:
  print(A*X+B*Y)
elif min(A,B)<=C:
  if X>=Y:
    print(Y*2*C+(X-Y)*A)
  else:
    print(X*2*C+(Y-X)*B)
else:
  print(2*Y*C)
# Judge status: Accepted
N, X, Y = map(int, input().split())
ans = [0]*(N-1)
for i in range(1, N):
    for j in range(i+1, N+1):
        d = min(j-i, abs(X-i)+abs(j-Y)+1)
        ans[d-1] += 1

print(*ans, sep='\n')
# Judge status: Accepted
X = list(map(int, input().split()))
Y = sorted(X)
ans = 0
if Y[0]%2==Y[1]%2 and Y[1]%2 != Y[2]%2:
  ans +=1
  Y = [Y[0]+1,Y[1]+1,Y[2]]
elif Y[1]%2==Y[2]%2 and Y[2]%2 != Y[0]%2:
  ans +=1
  Y = [Y[0], Y[1]+1,Y[2]+1]
elif Y[2]%2==Y[0]%2 and Y[0]%2 != Y[1]%2:
  ans +=1
  Y = [Y[0]+1, Y[1], Y[2]+1]

A = Y[2]-Y[0]
B = Y[2]-Y[1]
C = min(A,B)
D = max(A,B)
ans += C + (D-C)//2
print(ans)
# Judge status: Wrong Answer
N=int(input())
s=set([input() for _ in range(N)])
M=int(input())
t=set([input() for _ in range(M)])

print(sum([1 for x in s if not x in t]))
# Judge status: Wrong Answer
n,m = map(int,input().split())
stds = [tuple(map(int,input().split())) for _ in range(n)]
points = [tuple(map(int,input().split())) for _ in range(m)]

def d(s,p):
  return abs(s[0]-p[0]) + abs(s[1] + p[1])

for std in stds:
  ans = (-1, float('inf'))
  for i, pnt in enumerate(points):
    dst = d(std,pnt)
    #print(i, dst, ans)
    if dst < ans[1]:
      ans = (i, dst)
  print(ans[0]+1)
# Judge status: Wrong Answer
N,x = map(int,input().split())

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

a.sort()

sum =x
cnt=0

for i in range(N):
    if x -a[i] >= 0:
        cnt+=1
        x = x-a[i]

if x >0:
    if cnt >0:
        cnt = cnt-1
        
print(cnt)
# Judge status: Wrong Answer
a, b = [int(x) for x in input().strip().split()]
if a <= 0 and 0 <= b:
  print('Zero')
elif a > 0:
  print('Positive')
else:
  if a == b:
    print('Netative')
  elif (b - a) % 2:
    print('Netative')
  else:
    print('Positive')
# Judge status: Accepted
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())

b = set(int(input()) for i in range(n))

def check():
    for i in range(3):
        if all(a[i][j] in b for j in range(3)):
            return True
        if all(a[j][i] in b for j in range(3)):
            return True
    return all(a[i][i] in b for i in range(3)) or all(a[2-i][i] in b for i in range(3))

print('Yes' if check() else 'No')
# Judge status: Accepted
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

# ①割引券を使わない場合の最少額
ans = min(a) + min(b)

# 割引券の金額を1つずつ確認し、①よりも低い場合に入れ替える
for _ in range(M):
    x, y, c = map(int, input().split())
    price = a[x - 1] + b[y - 1] - c
    ans = min(ans, price)

print(ans)
# Judge status: Accepted
n, *a = map(int, open(0).read().split())

ans = prev = 0
for i in a:
        tmp, prev = divmod(i+prev, 2)
        ans += tmp
        if i==0: prev=0
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
s = input()

print(s[0:k - 1] + s[k - 1].lower() + s[k:])
# Judge status: Accepted
import sys
input = sys.stdin.readline

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

def main():
    mod=10**9+7
    N=I()
    ans=1
    for i in range(N):
        ans*=(i+1)
        ans%=mod
        
    print(ans)

main()
# Judge status: Accepted
N,K = map(int,input().split())
A = list(map(int,input().split()))
A.insert(0,0)
for i in range(K+1,N+1):
    if A[i]>A[i-K]:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
#スペース区切りの整数の入力
h1, m1, h2, m2, k = map(int, input().split())

asa = h1 * 60 + m1 + 1
yoru = h2 * 60 + m2 -1




ans = int((yoru - asa )/k)

print(ans* k)
# Judge status: Accepted
N=int(input())
A=dict()
for i in range(N):
	tmp=int(input())
	if not tmp in A:
		A[tmp]=1
	elif A[tmp]==1:
		A[tmp]=0
	else:
		A[tmp]=1
print(sum(A.values()))