peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
# 2020/01/25
# AtCoder Beginner Contest 065 - C

import math

# Input
n, m = map(int,input().split())

# Calc
sub = abs(n - m)

if sub >= 2:
    ans = 0
elif sub == 1:
    ans = (math.factorial(n) * math.factorial(m)) % (10 ** 9 + 7)  
else:
    ans = (math.factorial(n) * math.factorial(m) * 2) % (10 ** 9 + 7)

# Output
print(ans)
# Judge status: Accepted
n = input()
if n[-1] in ['2','4','5','7','9']:
    print('hon')
elif n[-1] in ['0','1','6','8']:
    print('pon')
else:
    print('bon')
# Judge status: Accepted
def main():
    N = int(input())
    X = list(map(int, input().split()))
    sorted_X = sorted(X)
    overall_med = (sorted_X[N//2 - 1] + sorted_X[N//2]) // 2
    for x in X:
        if x <= overall_med:
            print(sorted_X[N//2])
        else:
            print(sorted_X[N//2 - 1])


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n,x,t = map(int,input().split())
if n%x == 0:
    c = n/x
else:
    b = n/x
    c = b//1
a = c*t
print(a)
# Judge status: Accepted
from functools import reduce

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

def nCr(N, R, DIV):
    f = lambda x,y: x*y%DIV
    X = reduce(f, range(N-R+1, N+1))
    Y = reduce(f, range(1, R+1))
    return X*pow(Y, DIV-2,DIV)%DIV

all_combi = pow(2,n,DIV)
combi_a = nCr(n,a,DIV)
combi_b = nCr(n,b,DIV)


output = all_combi-1 - combi_a - combi_b
# if output>(10**9+7):
#     output = output%(10**9+7)
print(output%DIV)
# Judge status: Wrong Answer
b = int(input())
a = list(map(int,input().split()))
count = 1
for i in range(b):
    if a[i] != i + 1 :
        count += 1
if count <= 2:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
S = input()

#print(int(S[5:7]))
if int(S[0:4]) < 2019:
    print('Heisei')

elif int(S[5:7]) < 4:
    print('Heisei')

elif int(S[5:7]) == 4 and int(S[8:10]) <= 30:
    print('Heisei')
else:
    print('TBD')
# Judge status: Accepted
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()
print(sum(p[:k]))
# Judge status: Accepted
# coding: utf-8


def main():

  input_yyyymmdd = input()
  out_yyyy = '2018'
  
  print(out_yyyy + input_yyyymmdd[4:10])
 
  return 0


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n, k = map(int, input().split())
lst = sorted(list(map(int, input().split())))

if (n<=k):
  print(0)
else:

  sum_count = 0
  sum_count = sum(lst[:-k])
  print(sum_count)
# Judge status: Accepted
n,m = map(int,input().split())
if n >= m:
  print(0)
  exit()
l = list(map(int,input().split()))
l.sort()
ans = []
for i in range(m-1):
  ans.append(l[i+1]-l[i])
  
ans.sort()
mi = 0
for i in range(m-2,m-1-n,-1):
  mi += ans[i]
print(sum(ans)-mi)
# Judge status: Wrong Answer
n = int(input())
a_list = list(map(int, input().split()))
asc = [0] * (n + 1)
desc = [0] * (n + 1)
asc[0] = 1
desc[-1] = a_list[-1]
sum = 0

for i in range(n):
    asc[i + 1] = (asc[i] -a_list[i]) * 2
    desc[n - 1 - i] = desc[n - i] + a_list[n - 1 - i]

    if asc[i + 1] <= a_list[i + 1]:
        print(-1)
        exit()

for i in range(n + 1):
    sum += min(asc[i], desc[i])

print(sum)
# Judge status: Wrong Answer
s, t = input(), input()

cnt = 0
while cnt <= len(s):
    s = s[-1] + s[:-1]
    if s == t:
        print("YES")
        exit()
    cnt+=1
print("NO")
# Judge status: Accepted
S = input()

if S == "SUN":
	print("7")
elif S == "MON":
	print("6")
elif S == "TUE":
	print("5")
elif S == "WED":
	print("4")
elif S == "THU":
	print("3")
elif S == "FRI":
	print("2")
elif S == "SAT":
	print("1")
# Judge status: Wrong Answer
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

N = int(input())
A = list(map(int, input().split()))

ans = 2*(10**9)
S = sum(A)

x = 0
for a in A:
    x += a
    y = S - x
    ans = min(ans, abs(x-y))

print(ans)
# Judge status: Accepted
A,B = list(map(int,input().split()))
print(A * B)
# Judge status: Wrong Answer
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    A.sort()
    L = A[N-1]
    ans = -1
    for a in A[:N-1]:
        if abs(L/2 - a) < abs(L/2 - ans): ans = a
    print(ans, L)


    return 0

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
import math

N = int(input())

mini = math.ceil(N / 1.08)
maxx = math.floor((N + 1) / 1.08)

if (mini <= maxx):
    ans = mini
else:
    ans = ':('

print(ans)
# Judge status: Wrong Answer
N = int(input())
L = [int(i) for i in input().split()]

ans = 0
for i in range(N):
    for j in range(i):
        for k in range(j):
            if L[i] != L[j] and L[j] != L[k] and L[k] != L[i] and L[i] + L[j] > L[k] and L[i] + L[k] > L[j] and L[j] + L[k] > L[i]:
                print(L[i],L[j],L[k])
                ans += 1
print(ans)
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

import itertools

A, B, C, D = list(read().rstrip().decode('utf-8'))

for operators in itertools.product(['+', '-'], repeat=3):
    op1, op2, op3 = operators
    eq = A + op1 + B + op2 + C + op3 + D
    x = eval(eq)
    if x == 7:
        break

answer = eq + "=7"
print(answer)
# Judge status: Wrong Answer
N,L=map(int,input().split())
taste=0
for i in range(N):
  taste += (L + i)

ans=10*6
for j in range(N):
  tmp = L+j
  if abs(tmp) < abs(ans):
    ans = tmp
print(taste - ans)
# Judge status: Wrong Answer
a, b, c = input().split()
x = int(a)+int(b+c)
y = int(a+b)+int(c)
print(max(x, y))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
k = max(a)
b = [0] * n
for i in range(n):
    b[i] = abs(a[i]-k/2)
r = a[b.index(min(b))]
print(k, r)
# Judge status: Accepted
a, b, c = map(int, input().split())
for i in range(b):
    if (a * i) % b == c:
        print("YES")
        exit()
print("NO")
# Judge status: Accepted
l,r,d = map(int,input().split())
print(r//d-(l-1)//d)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())


from itertools import combinations
from collections import Counter as cc
def main():
    x, k , d = mi()
    x = abs(x)
    ans = max(x%d, x-k*d)
    k -= x//d
    if k > 0 and k%2 == 1:
        ans = abs(ans-d)
    print(ans)
    





if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

a = sorted(a, reverse=True)
ans = a[0]

for i in range((n-2)//2):
    ans += a[i+1]*2
    # print(ans)
if (n) % 2 == 1:
   # print(a[i+2], i+2)
    ans += a[i+2]
print(ans)
# Judge status: Wrong Answer
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if B > A:
    AtoB = B - A
    VtoW = V - W
else:
    AtoB = A - B
    VtoW = W - V

if AtoB <= VtoW * T:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
vowel = ['a','i','u','e','o']
print('vowel' if input() in vowel else 'consonant')
# Judge status: Wrong Answer
w,h,n = map(int, input().split())
xya = [list(map(int, input().split())) for i in range(n)]
x2 = w
x1 = 0
y2 = h
y1 = 0
for a,b,c in xya:
    if c == 1 and 0 <= a <= w:
        x1 = a
    elif c == 2 and 0 <= a <= w:
        x2 = a
    elif c == 3 and 0 <= b <= h:
        y1 = b
    elif c == 4 and 0 <= b <= h:
        y2 = b
if (0 <= x1 and 0 <= x2 and 0 <= x2-x1) and (0 <= y1 and 0 <= y2 and 0 <= y2-y1):
    print((x2-x1)*(y2-y1))
else:
    print(0)
# Judge status: Accepted
N,M = map(int, input().split())

A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(N-M+1):
    for j in range(N-M+1):
        C = [A[k][i:i+M] for k in range(j, j+M)]
        if B == C:
            print('Yes')
            exit()

print('No')
# Judge status: Accepted
a, b = input().split()
a = int(a)

b100 = int(b[0])*100 + int(b[2])*10 + int(b[3])
print(a * b100 // 100)
# Judge status: Accepted
h, a = [int(x) for x in input().split()]

if h % a == 0:
    print(h // a)
else:
    print(h // a + 1)
# Judge status: Wrong Answer
n = int(input())
sum = 0
for i in range(5):
    if n == 100000:
        sum = 90909
        break
    elif 10**i <= n < 10**(i+1):
        if (i+2) % 2 == 0:
            sum += n - 10**i + 1
            break
        else:
            break
    else:
        if (i+2) % 2 == 0:
            sum += 9 * (10**(2*i))
print(sum)
# Judge status: Accepted
a, b = map(int, input().split())

if a == b:
    ans = a + b
else:
    ans = max(a, b) + max(a-1, b -1)

print(ans)
# Judge status: Wrong Answer
from collections import deque
k=int(input())
deq=deque([1,2,3,4,5,6,7,8,9])
for i in range(k):
    a=deq.popleft()
    if not a%10==0:
        deq.append(a*10+a%10-1)
    deq.append(a*10+a%10)
    if a%10==9:
        deq.append(a*10+a%10+1)
print(a)
# Judge status: Accepted
N=str(input())
L=len(N)
dp=[[0]*2 for _ in range(L)]
dp[0][0]=int(N[0])
dp[0][1]=int(N[0])-1
for i in range(1,L):
  dp[i][1]=max(dp[i-1][0]+max(0,int(N[i])-1),dp[i-1][1]+9)
  dp[i][0]+=(dp[i-1][0]+int(N[i]))
print(max(dp[L-1][0],dp[L-1][1]))
# Judge status: Wrong Answer
from collections import defaultdict

data = defaultdict()
for i in range(3):
    s = input()
    data[chr(ord("a") + i)] = s

cnt = [0] * 3
turn = "a"
while 1:
    if cnt[ord(turn) - ord("a")] == len(data[chr(ord(turn))]):
        ans = ord(turn) - (ord("a") - ord("A"))
        break

    turn = data[chr(ord(turn))][cnt[ord(turn) - ord("a")]]
    cnt[ord(turn) - ord("a")] += 1
print(chr(ans))
# Judge status: Wrong Answer
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-07-30 16:55:09 +0900
# LastModified: 2020-07-30 18:15:00 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    n = int(input())
    if n == 1:
        print(1)
        return
    if n % 2 == 0:
        print(n//2-1)
        print(n//2+1)
    else:
        print(n//2)
        print(n//2+1)



if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
uA = list(set(A))
c = {u:A.count(u) for u in uA}

la = {}
lb = {}

for a in uA:
  la[a] = int(c[a]*(c[a]-1)/2)
  lb[a] = int((c[a]-1)*(c[a]-2)/2)
  
for a in A:
  ks = list(la.values())
  b = lb[a] + sum([k for k in ks if k !=a])
  print(b)
# Judge status: Accepted
w=input()
a=list('abcdefghijklmnopqrstuvwxyz')
for A in a:
    if w.count(A) % 2 == 1:
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
from fractions import gcd

N = int(input())
A = tuple(map(int, input().split()))
MOD = 10 ** 9 + 7


def modinv(a, mod=10 ** 9 + 7):
    return pow(a, mod - 2, mod)

lcm = A[0]
for i in range(1, N):
    lcm = (lcm * A[i] // (gcd(lcm, A[i])))
ans = 0
lcm %= MOD

for a in A:
    ans = (ans + lcm * modinv(a)) % MOD

print(ans)
# Judge status: Wrong Answer
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(0,n-k):
    if a[i]<a[i-n+k+2]:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
import numpy as np

n = int(input())
s_list = [input() for i in range(n)]

new_dict = {}
for s in s_list:
    if s not in new_dict.keys():
        new_dict[s] = 1
    else:
        new_dict[s] += 1
    
values = []
keys = []    
for key in new_dict.keys():
    values.append(new_dict[key])
    keys.append(key)
    
values = np.array(values)
keys = np.array(keys)

max_index = values == np.max(values)
keys = keys[max_index].tolist()
keys = sorted(keys)

for key in keys:
    print(key)
# Judge status: Wrong Answer
s = input()

a = ["Sunny", "Cloudy","Rainy"]

if(s == a[0]):
  print(a[1])
elif(a == a[1]):
  print(a[2])
else:
  print(a[0])
# Judge status: Accepted
a,b = map(int, input().split())
if a<=8 and b<=8:
    print("Yay!")
else:
    print(":(")
# Judge status: Wrong Answer
N,M = map(int, input().split())

print(str(max(N,M)) * min(N,M))
# Judge status: Accepted
n,x = map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
a.sort()

for i in range(n):
  if x - a[i] >= 0:
    cnt += 1
    x -= a[i]
  else:
    break
if x == 0 or cnt < n:
  print(cnt)
else:
  print(cnt-1)
# Judge status: Accepted
A, B, C, D = map(int, input().split())
a = set(range(A, B))
b = set(range(C, D))
c = a& b

print(len(c))
# Judge status: Accepted
a,b=map(int,input().split())
print("Even" if a*b%2==0 else "Odd")
# Judge status: Accepted
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

d = ni()

if d == 25:
    print("Christmas")
elif d == 24:
    print("Christmas Eve")
elif d == 23:
    print("Christmas Eve Eve")
elif d == 22:
    print("Christmas Eve Eve Eve")
# Judge status: Wrong Answer
import itertools

def countOrder(n, plist, qlist):

    ans = 0
    p = 0
    q = 0

    irelist = list(itertools.permutations(range(1, n+1), n))

    for index, i in enumerate(irelist):
        if i == plist:
            p = index
        elif i == qlist:
            q = index

    ans = abs(p-q)

    return ans

def main():
    n = int(input())
    plist = tuple(map(int, input().split()))
    qlist = tuple(map(int, input().split()))
    print(countOrder(n, plist, qlist))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
acount = 0
bcount = 0
ccount = 0

x, y = input().split()

for i in range(0, 7):
    if int(x) == a[i] or int(y) == a[i]:
        acount += 1

for i in range(0, 4):
    if int(x) == b[i] or int(y) == b[i]:
        bcount += 1

if int(x) == c[0]:
    ccount += 1
if int(y) == c[0]:
    ccount += 1


if acount == 2 or bcount == 2 or ccount == 2:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N=int(input())
boo=False
for i in range(1,10):
  for j in range(1,10):
    if i*j==N:
      boo=True
      break
if boo==True:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
S=int(input())
if S==25:
  print('Crisitmas')
if S==24:
  print("Christmas Eve")
if S==23:
  print("Christmas Eve Eve")
if S==22:
  print("Christmas Eve Eve Eve")
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
cnt = 0
d = {}
for i in range(n):
  sortsi = ''.join(sorted(s[i]))
  #print(sortsi)
  if sortsi in d: cnt+=1
  else: d[sortsi]=1
print(cnt)
# Judge status: Accepted
x = int(input())
u = 0

u += (x - (x % 500) ) * 2

u += (x - (x // 500) * 500 ) // 5 * 5

print(u)
# Judge status: Accepted
a,b,c=map(int,input().split());print("Yes" if c>=a and c<=b else "No")
# Judge status: Accepted
N = int(input())
ans = [0 for _ in range(N)]
for x in range(1, 1000):
    if x**2 > N:
        continue
    for y in range(1, 1000):
        if x**2 + y**2 > N:
            break
        for z in range(1, 1000):
            n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if n <= N:
                ans[n-1] += 1
            if n > N:
                break
for a in ans:
    print(a)
# Judge status: Wrong Answer
import sys

A, B, T = map(int, input().split())

t = 1
ans = 0

if A > T:
    print(0)
    sys.exit()

while t < T:
    ans += B
    t += A

print(ans)
# Judge status: Accepted
values = list(map(int, input().split(' ')))

m = max(values)
values.remove(m)

print(10 * m + sum(values))
# Judge status: Accepted
k,s = map(int,input().split())
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        if 0 <= s-x-y <= k:
            cnt += 1
print(cnt)
# Judge status: Accepted
w, h, n = map(int, input().split())
OPS = list(list(map(int, input().split())) for _ in range(n))
l, r, t, b = 0, w, h, 0
for i in OPS:
    if i[2] == 1 and i[0] > l:
        l = i[0]
    elif i[2] == 2 and i[0] < r:
        r = i[0]
    elif i[2] == 3 and i[1] > b:
        b = i[1]
    elif i[2] == 4 and i[1] < t:
        t = i[1]
print(max(r - l, 0) * max(t - b, 0))
# Judge status: Accepted
# UU  R     DD  L
#LUUU RR DR DDD LLU

sx, sy, tx, ty = map(int, input().split())
print('U'*abs(ty-sy),
        'R'*abs(tx-sx),
        'D'*abs(ty-sy),
        'L'*abs(tx-sx),
        'L',
        'U'*(abs(ty-sy)+1),
        'R'*(abs(tx-sx)+1),
        'DR',
        'D'*(abs(ty-sy)+1),
        'L'*(abs(tx-sx)+1),
        'U',
        sep='')
# Judge status: Wrong Answer
a, b = map(int, input().split())

print(round((a + b) / 2))
# Judge status: Wrong Answer
x = int(input())
job = []
time = []
for i in range(x):
    j, t = list(map(int, input().split()))
    job.append(j)
    time.append(t)
jt = 0
tt = 0
f = 0
for i in range(x):
    if job[i] <= time[i]:
        pass
    else:
        print("No")
        f = 1
        break
    jt += job[i]
    if tt < time[i]:
        tt = time[i]
    if jt > tt:
        f = 1
        print("No")
        break
if f == 0:
    print("Yes")
# Judge status: Accepted
N, K, *h = map(int, open(0).read().split())
h = sorted(list(h))
print(min(h[i + K - 1] - h[i] for i in range(N - K + 1)))
# Judge status: Wrong Answer
s = int(input())
def f(n):
	if n%2==0:
		return n//2
	else:
		return 3*n+1
cnt = 0
m = 1
S = -1
while True:
	s = f(s)
	m = m+1
	if cnt == 0 and s in [4,2,1]:
		S = s
		cnt=1
		continue
	if s == S:
		print(m)
	else:
		continue
	break
# Judge status: Wrong Answer
#ABC127 A

A, B = map(int,input().split())
if A >= 13:
    print(B)
elif 6 <= A <= 12:
    print(B/2)
elif A <= 5:
    print(0)
# Judge status: Wrong Answer
n,m=map(int,input().split())
AB=[]
for i in range(n):
    a,b=map(int,input().split())
    AB.append((a,b))

AB.sort()

cnt=0
ans=0
for a,b in AB:
    if cnt==m:
        print(ans)
        break
    temp=min(m-cnt,b)
    ans+=a*temp
    cnt+=temp
# Judge status: Accepted
# C - XYZ Triplets
from collections import Counter


def main():
    N = int(input())
    calc = lambda x, y, z: x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
    lim = int(N ** 0.5) + 1
    cnt = Counter(
        calc(i, j, k)
        for i in range(1, lim + 1)
        for j in range(1, lim + 1)
        for k in range(1, lim + 1)
    )
    res = [cnt[i] for i in range(1, N + 1)]
    print("\n".join(map(str, res)))


if __name__ == "__main__":
    main()
# Judge status: Accepted
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
a, b = [int(num) for num in lines.pop(0).split(" ")]
dif = b - a
height = dif * (dif - 1)  // 2
print(height - a)
# Judge status: Wrong Answer
import math
n, k = map(int, input().split())
pro = 0
if n < k:
  for i in range(1,n+1):
    if k/i % 2 == 0:
      x = int(math.log2(k/i))
    else:
      x = int(math.log2(k/i)) + 1
    coin = 2**x
    pro += (1/n) * (1/coin)
if n >= k:
  pro += (n-k+1)/n
  for j in range(1,k):
    if k/j % 2 == 0:
      x = int(math.log2(k/j))
    else:
      x = int(math.log2(k/j)) + 1
    coin = 2**x
    pro += (1/n) * (1/coin)
print(pro)
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
out = [0] * n
for i in range(len(a)): out[a[i] - 1] = i + 1
print(' '.join([str(i) for i in out]))
# Judge status: Accepted
n=int(input())
s=input()
b=""
for i in s:
    a=(ord(i)-ord("A")+n)%26
    b+=chr(a+ord("A"))
print(b)
# Judge status: Accepted
a,b,c = map(int,input().split())
if b-a==c-b:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
def c_many_requirements():
    from itertools import combinations_with_replacement as h
    N, M, Q = [int(i) for i in input().split()]
    Queries = [[int(i) for i in input().split()] for j in range(Q)]

    def calc_score(seq):
        return sum(d for a, b, c, d in Queries if seq[b - 1] - seq[a - 1] == c)
    return max([calc_score(sequence) for sequence in h(range(1, M + 1), N)])

print(c_many_requirements())
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())
if a*c >= b*d:
    if a*c >= a*d:
        if a*c >= b*c:
            print(a*c)
if a*d >= b*d:
    if a*d >= b*c:
        print(a*d)
if b*c >= b*d:
    print(b*c)
else:
    print(b*d)
# Judge status: Accepted
N, K = map(int, input().split())
P = list(map(int, input().split()))
E = [0] * N
E[0] = sum(P[:K])

for i in range(1, N-K):
  E[i] = E[i-1] + P[i+K-1] - P[i-1]

E[N-K] = sum(P[N-K:])
maxE = max(E)
#print(E)
print((maxE - K) / 2.0 + K)
# Judge status: Accepted
n,m = map(int,input().split())
A=[0]*(m+1)
for i in range(n):
    K = list(map(int,input().split()))
    for j in range(1,len(K)):
        A[K[j]]+=1
print(A.count(n))
# Judge status: Wrong Answer
lis = sorted(input().split())
print(lis)
if lis == ['5', '5', '7']:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
number, length = map(int, input().split())

dict_list = []

for i in range(number):
 dict_list.append(input())

new_dict_list = sorted(dict_list)

answer = ''.join(new_dict_list)

print(answer)
# Judge status: Accepted
n = int(input())
a_list = list(map(int,input().split()))
mid = round(sum(a_list)/n)
ans = 0
for a in a_list:
    ans += (a-mid) ** 2
print(ans)
# Judge status: Accepted
#!/usr/bin/python
# -*- Coding: utf-8 -*-

n = int(input())

if n % 1000 == 0:
    print(0)
elif n > 1000:
    a = (n//1000 + 1)*1000
    print(a - n)
else:
    print(1000 - n)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))
a = 0
for i in range(n-2):
  if p[i]<p[i+1] and p[i+1] < p[i+2]:
    a += 1
print(a)
# Judge status: Wrong Answer
N, M = list(map(int, input().split()))
K, A = [0] * N, [0] * N
for i in range(N):
    K[i], *A[i] = set(map(int, input().split()))
k = set(i for i in range(1, M + 1))
for j in range(N):
    k = k.intersection(A[j])
print(len(k))
# Judge status: Accepted
a, b = map(int, input().split())
if a >= 13:
  print(b)
elif 6 <= a <= 12:
  print(b // 2)
else:
  print(0)
# Judge status: Accepted
N = int(input())
h = [int(val) for val in input().split(' ')]
dp = [0, abs(h[0]-h[1])]

for i in range(len(h)-2):
    step1_cost = dp[i+1] + abs(h[i+1]-h[i+2])
    step2_cost = dp[i] + abs(h[i]-h[i+2])
    dp.append(min(step1_cost, step2_cost))
print(dp[-1])
# Judge status: Wrong Answer
n,d=[int(x) for x in input().rstrip().split()]
 
l=[]
for i in range(n):
  X=[int(x) for x in input().rstrip().split()]
  l.append(X)
 
ans=0
for i in range(n):
  ni=l[i]
  for j in range(i+1,n):
    nj=l[j]
    now=0
    for s in range(d):
      now+=(ni[s]-nj[s])**2
    now=now**0.5
# Judge status: Accepted
n=input()
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:print('Yes')
else:print('No')
# Judge status: Wrong Answer
n=int(input())
a=[int(input()) for _ in range(n)]

import bisect
#a=[0,2,3,4,67,8]
#a.sort()
#bisect.bisect_left(a, 4) #被ったら左側のindexを返す
#bisect.bisect_right(a, 4)#被ったら右側のindexを返す

color=[-1]

for aa in a:
    i=bisect.bisect_left(color, aa)
    if i==0:
        color.insert(aa,0)
    else:
        color[i-1]=aa
        
print(len(color))
# Judge status: Accepted
n, k, q = map(int, input().split())
p = int(k - q)
if p > 0:
    for _ in range(n): print("Yes")
else:
    a = {}
    for _ in range(q):
        a_i = str(input())
        if a_i not in a.keys():
            a[a_i] = 1
        else:
            a[a_i] += 1
    for i in range(1, n+1):
        if str(i) not in a.keys(): print("No")
        else: print("Yes") if p + a[str(i)] > 0 else print("No")
# Judge status: Wrong Answer
n,m=map(int,input().split())
check=[False]*n
check[0]=True
ball=[1]*n
for i in range(m):
    x,y=map(int,input().split())
    x-=1
    y-=1
    if check[x]:
        check[y]=True
    else:
        continue
    ball[y]+=1
    ball[x]-=1
    if ball[x]==0:
        check[x]=False


ans=0

for chk in check:
    if chk:
        ans+=1

print(ans)
# Judge status: Accepted
x, y = (int(x) for x in input().split())
ans = 100000000000
if x <= y: ans = min(ans, y - x)
if (-1) * x <= y: ans = min(ans, y + x + 1)
if x <= (-1) *y: ans = min(ans, (-1) * y + (-1) * x + 1)
if (-1) * x <= (-1) * y: ans = min(ans, (-1) * y + x + 2)
print(ans)
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split(' ')))
l.sort(reverse=True)
length = len(l)
ans = 0
for i in range(length-2):
    for j in range(i+1,length-1):
        if not l[i]==l[j]:
            for k in range(j+1,length):
                if not l[j]==l[k]:
                    if l[i]<l[j]+l[k]:
                        ans+=1
print(ans)