peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n = int(input())
x = sorted(list(map(int, input().split())))

x_min = x[0]
x_max = x[n-1]
min_sum = 10000000
for p in range(x_min, x_max):

    sum = 0
    for e in x:
        len = (e - p)**2
        sum += len
    # print("p", p, "sum", sum, "min_sum", min_sum)
    if sum <= min_sum:
        min_sum = sum
print(min_sum)
# Judge status: Accepted
s = list(input())
t = list(input())

s.sort()
t.sort(reverse=True)

S = "".join(s)
T = "".join(t)

if S < T:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, m = input().split()
print("Yes" if n == m else "No")
# Judge status: Accepted
n = int(input())

if n%10 == 3 :
    print("bon")
elif n%10 == 0 or n%10 == 1 or n%10 == 6 or n%10 == 8 :
    print("pon")
else :
    print("hon")
# Judge status: Accepted
n,k = map(int,input().split())
A = list(map(int,input().split()))
for i in range(n-k):
    print("Yes" if A[i+k]-A[i]>0 else "No")
# Judge status: Accepted
N=1
a=int(input())
ans=0
while N<=a :
  if N%3==0 and N%5==0 :
    pass
  elif N%3==0 :
    pass
  elif N%5==0 :
    pass
  else :
    ans+=N
  N+=1
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
subordinates = [0 for i in range(n)]
for e in a:
    subordinates[e-1] += 1
for e in subordinates:
    print(e)
# Judge status: Accepted
n = int(input())
print(n * (n+1) // 2)
# Judge status: Accepted
N = int(input())
T = []
X = []
Y = []
for _ in range(N):
    t, x, y = map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)
flag = 0
if T[0]-abs(X[0])-abs(Y[0]) < 0 or (T[0]-abs(X[0])-abs(Y[0]))%2 != 0:
    flag = 1
for i in range(N-1):
    if T[i+1]-T[i]-abs(X[i+1]-X[i])-abs(Y[i+1]-Y[i]) < 0 or (T[i+1]-T[i]-abs(X[i+1]-X[i])-abs(Y[i+1]-Y[i]))%2 != 0:
        flag = 1
print("Yes" if flag == 0 else "No")
# Judge status: Accepted
K, S = map(int, input().split())
cnt = 0
for i in range(K+1):
  for j in range(i, K+1):
    if 0 <= S - i - j <= K:
      if i == j:
        cnt += 1
      else:
        cnt += 2
print(cnt)
# Judge status: Accepted
import sys
import collections
from math import ceil
ma = lambda : map(int,input().split())
ni = lambda : int(input())
def divisor(n):
    d = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            d.append(i)
            if i != n//i:
                d.append(n//i)
    #d.sort()
    return d
n,m = ma()
gcd = 1
D = divisor(m)
for d in D:
    q,r = divmod(m,d)
    if q>=n and r==0:gcd = max(gcd,d)
print(gcd)
# Judge status: Accepted
X, Y, Z = map(int, input().split())

print(Z, X, Y)
# Judge status: Accepted
from decimal import Decimal

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

y = x.copy()

y.sort()

m1 = y[n//2]
m2 = y[n//2 - 1]
m = Decimal(m1 + m2) / Decimal(2) 
#print(m1, m2)

for z in x:
    if z <= m:
        print(m1)
    else:
        print(m2)
# Judge status: Wrong Answer
N = int(input())

ans = "No"

while N > 0:
  if N % 4 == 0:
    ans = "Yes"
    break
  else:
    N = N - 7
    
    
print(ans)
# Judge status: Wrong Answer
N = int(input())

A = [0] * N

ED = [chr(i + 97) for i in range(N)]
ED = ''.join(ED)
ans = []
while True:
    for i in range(N - 1, 0, -1):
        if A[i] == A[i - 1] + 2:
            A[i] = 0
            A[i - 1] += 1
    ret = ['' for _ in range(N)]
    for i in range(N):
        ret[i] = chr(A[i] + 97)

    ret = ''.join(ret)
    ans.append(ret)

    if ret == ED: break
    else: A[-1] += 1

print(*sorted(ans),sep='\n')
# Judge status: Accepted
n = int(input())
print((n+1)//2)
# Judge status: Wrong Answer
import fractions
A,B,C,D = (int(x) for x in input().split())
c = 0
d = 0
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
M = lcm(C,D)
c = B//C - A//C
d = B//D - A//D
m = B//M - A//M
print(B-A+1-(c+d-m))
# Judge status: Accepted
# -*- coding: utf-8 -*-
# 整数の入力
num, x = map(int, input().split())
# loop
flag = 0
for i in range(num + 1):
  if((2*i + 4*(num - i)) == x): flag += 1
print("No") if flag == 0 else print("Yes")
# Judge status: Wrong Answer
from collections import deque

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

tmp = []
cnt = 0
while d:
  v = d.popleft()
  if len(tmp)<=1:
    pass
  else:
    if not v >= tmp[-1] >= tmp[-2] or v <= tmp[-1] <= tmp[-2]:
      tmp = []
      cnt += 1
  tmp.append(v)
#  print(d,tmp,cnt)
if tmp:
  cnt+=1
print(cnt)
# Judge status: Accepted
# -*- coding: utf-8 -*-
from collections import deque
import sys
#input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

S = input()
T = input()

for i in range(len(S)+1):
    if S == T[i:] + T[:i]:
        print("Yes")
        break
else:
    print("No")
# Judge status: Wrong Answer
t = input()

t.replace("?", "D")

print(t)
# Judge status: Accepted
N=int(input())
count=0
for A in range(1,N):
  count+=(N-1)//A
print(count)
# Judge status: Accepted
import sys

n = sys.stdin.readline().rstrip()

def main():
    ans = 'Yes'
    if n[1] != n[2]:
        ans = 'No'
    else:
        if n[0] != n[1] and n[2] != n[3]:
            ans = 'No'
    print(ans)

if __name__ ==  '__main__':
    main()
# Judge status: Accepted
N = int(input())
mini = float('inf')

for i in range(1, 10**6 + 1):
    if N%i == 0:
        mini = min(mini, i+(N//i))

print(mini - 2)
# Judge status: Accepted
import bisect
n = int(input())
lis = sorted(list(map(int, input().split())))
ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += max(bisect.bisect_left(lis, lis[j]+lis[i]) - j - 1, 0)
print(ans)
# Judge status: Accepted
x, a, b = map(int, input().split())

if abs(a - x) < abs(b - x):
	print('A')
else:
	print('B')
# Judge status: Accepted
import math
n = int(input())
print(math.ceil(n/2))
# Judge status: Wrong Answer
A, B = map(int, input().split())
print(A+B)
# Judge status: Accepted
n, m= map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
r = range(n-m+1)
 
for i in r:
    for j in r:
        for k in range(m):
            if a[i+k][j:j+m] != b[k]:
                break
        else:
            print('Yes')
            exit()
print('No')
# Judge status: Accepted
import sys
sys.setrecursionlimit(10000000)
import numpy as np
from heapq import heapify, heappop, heappush
import copy
import math


def main():
    A, B, H, M = map(int, input().split())
    theta = abs(6 * M - 30 * (H + M / 60))
    c = (B ** 2 + A ** 2 - 2 * A * B * math.cos(math.radians(theta))) ** 0.5
    print(c)

if __name__ == '__main__':
    main()
# Judge status: Accepted
h, n = map(int,input().split())
maho = []
for i in range(n):
    aa,ba = map(int,input().split())
    maho.append([aa,ba])

dp = [0 for i in range(h+1)]


for i in range(1,h+1):
    cost = 10000000000
    for j in range(n):
        if i - maho[j][0] < 0:
            cost = min(cost, maho[j][1])
        else:
            cost = min(cost, dp[i-maho[j][0]] + maho[j][1])

    dp[i] = cost

#print(dp[175:183])
print(dp[h])
# Judge status: Wrong Answer
from math import ceil
x = int(input())
print(ceil(360/x))
# Judge status: Accepted
H, N = map(int, input().split())
A = list(map(int, input().split()))
print('Yes' if sum(A) >= H else 'No')
# Judge status: Accepted
import fractions

def prime_function(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return a

A,B=map(int,input().split())
GCD=fractions.gcd(A,B)
print(len(set(prime_function(GCD)))+1)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

import collections
ans = 0
c = collections.Counter(A)
lis = []
for k,v in c.items():
  if v>=2:
    lis.append(k)
if len(lis)>=2:
  lis.sort()
  ans = lis[-1]*lis[-2]
print(ans)

#print(*ans, sep='\n')
# Judge status: Accepted
w,h,n=map(int,input().split())
l,r,u,d=0,w,h,0
for _ in [0]*n:
  x,y,a=map(int,input().split())
  l=max(l,x) if a==1 else l
  r=min(r,x) if a==2 else r
  d=max(d,y) if a==3 else d
  u=min(u,y) if a==4 else u
print(max(0,r-l)*max(0,u-d))
# Judge status: Accepted
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a = [0]
b = [0]

for i in range(N):
    a.append(a[i] + A[i])

for j in range(M):
    b.append(b[j] + B[j])

ans = 0
j = M

for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(i + j, ans)

print(ans)
# Judge status: Accepted
s = list(input())
if len(set(s)) == 3:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
A, B, C = map(int, input().split())

AB = A+B
BC = B+C
CA = C+A

if AB==C or BC==A or CA==B:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from collections import deque
import sys


def input():
    return sys.stdin.readline().rstrip()


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

ans, nd = 0, 0
lim = [1 for _ in range(N + 2)]
for i in range(N):
    lim[i+1] = (lim[i] - v[i]) * 2

for i in range(N, -1, -1):
    if v[i] + nd > lim[i] * 2 or lim[i] - v[i] < 0:
        print(-1)
        sys.exit(0)
    if v[i] + nd > lim[i]:
        nd = lim[i] - v[i]

    nd += v[i]
    ans += nd

print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
a=list(map(int,input().split()))
aa=sum(a)
count=0
for i in range(len(a)):
    if a[i]>=aa*(1/(4*m)):
        count+=1
    else:
        pass
if count>=m:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, a, b, c, d = map(int, input().split())
s = input()

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

for i in range(a+1, d):
    if s[i-1] == '#' and s[i] == '#':
        print('No')
        exit()

if c < d:
    print('Yes')
    exit()

for i in range(b, d+1):
    if s[i-1] == '.' and s[i] == '.' and s[i+1] == '.':
        print('Yes')
        exit()
print('No')
# Judge status: Accepted
from collections import deque
N,M=map(int,input().split())
to=[[] for _ in range(N)]
for _ in range(M):
  a,b=map(int,input().split())
  to[a-1].append(b-1)
  to[b-1].append(a-1)
q=deque([0])
r=[-1]*N
r[0]=0
while q:
  x=q.popleft()
  for i in to[x]:
    if r[i]==-1:
      q.append(i)
      r[i]=x+1
print("Yes",*r[1:],sep="\n")
# Judge status: Accepted
N = int(input())
A = map(int, input().split())

ans = 0
i = 1
for a in A:
    if a == i:
        i += 1
    else:
        ans += 1

print([ans, -1][i==1])
# Judge status: Wrong Answer
from collections import deque
S=list(map(lambda x: 1 if x=="T" else 0,list("ST"*10**4)))

q=deque()

for i in S:

    if i:
        if (not q) or q[-1]!=0:
            q.append(i)
        elif q and q[-1]==0:
            q.pop()
    else:
        q.append(i)
print(len(q))
# Judge status: Accepted
import sys
import numpy as np
input = sys.stdin.readline

N = int(input())
A = []
B = []
for _ in range(N):
    a,b = list(map(int,input().split()))
    A.append(a)
    B.append(b)
cnt = 0
for i in range(N-1,-1,-1):
    if (A[i]+cnt)%B[i] == 0:
        continue
    else:
        cnt += B[i] - (A[i]+cnt)%B[i]
print(cnt)
# Judge status: Accepted
def main():
    import sys
    input=sys.stdin.readline
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    S=sum(A)
    if S>n:
        print(-1)
    else:
        print(n-S)
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a = sorted(list(map(int, input().split())))

ans = 0
if (a[2]-a[1])%2==0:
  ans += (a[2]-a[1])//2
else:
  if (a[2]-a[1])%2==1 and (a[2]-a[0])%2==1:
    ans -= (a[2]-a[1])
  else:
    ans += (a[2]-a[1])
if (a[2]-a[0])%2==0:
  ans += (a[2]-a[0])//2
else:
  ans += (a[2]-a[0])
print(ans)
# Judge status: Wrong Answer
N = int(input())

for i in range(N-1):
    X = i * 1.08
    if int(X) == N:
        print(i)
        exit()

print(':(')
# Judge status: Accepted
# A - Changing a Character

n, k = map(int, input().split())
s = list(str(input()))
ans = []

for i in range(n):
    if i==(k-1):
        ans.append(s[i].lower())
    else:
        ans.append(s[i])


print(''.join(ans))
# Judge status: Wrong Answer
import math
n, k = map(int, input().split())
print(math.ceil(math.log(n, k)))
# Judge status: Accepted
a,b,c,K=list(map(int,input().split()))
print((a-b)*((-1)**K))
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    _ = int(input())
    L = tuple(map(int, input().split()))

    sum_l = sum(L)
    for l in L:
        if 2 * l >= sum_l:
            print('No')
            break
    else:
        print('Yes')
    
if __name__ == '__main__':
    main()
# Judge status: Accepted

a = int(input())
b = int(input())
h = int(input())

print(int((a+b)*h/2))
# Judge status: Accepted
a,b,c,d=map(int,input().split())
x1=a*c
x2=a*d
x3=b*c
x4=b*d
lst=[]
lst.append(x2)
lst.append(x3)
lst.append(x4)
lst.append(x1)
lst.sort()
print(lst[-1])
# Judge status: Accepted
a,b,c=map(int,input().split())
m=max(a,b,c)
d=3*m-(a+b+c)

if d%2==0:
  print(d//2)
else:
  print((d+3)//2)
# Judge status: Accepted
s = input()

lis = ['A','C','G','T']

sub = []
for i in range(len(s)):
  for j in range(i+1,len(s)+1):
    tmp = s[i:j]
    flag = True
    for k in range(len(tmp)):
      if tmp[k] in lis:
        pass
      else:
        flag = False
    if flag: sub.append(tmp)
      
ma = 0
for i in sub:
  l = len(i)
  if l > ma: ma = l
print(ma)
# Judge status: Accepted
s=input()
n=len(s)
k=s[::-1]
a=s.index("A")
z=n-k.index("Z")
print(z-a)
# Judge status: Accepted
N = int(input())
yes = True
for _ in range(N):
  t, x, y = map(int, input().split())
  margin = t - (x + y)
  if not(margin >= 0 and margin % 2 == 0):
    yes = False
if yes:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
letter = input()

if "a" <= letter <= "z":
    print("a")
elif "A" <= letter <= "Z":
    print("A")
# Judge status: Accepted
N=int(input())
if N%10 in {2,4,5,7,9}:
    print("hon")
elif N%10 in {0,1,6,8}:
    print("pon")
else:
    print("bon")
# Judge status: Accepted
def main():
    X, K, D = map(int, input().split())
    if X < 0:
        X *= (-1)
    i = min(X // D, K)
    out = X - i * D
    if (K - i) % 2 == 0 or K < X//D:
        print(out)
    else:
        print(min(abs(out - D), abs(out + D)))


if __name__ == '__main__':
    main()
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
dp=[[0]*2 for i in range(N+1)]
dp[0][1]=-10**30
for i in range(N):
    dp[i+1][0]=max(dp[i][0]+A[i],dp[i][1]-A[i])
    dp[i+1][1]=max(dp[i][1]+A[i],dp[i][0]-A[i])
print(dp[N][0])
# Judge status: Accepted
N = int(input())
for i in range(10):
    if (i+1)*1000 >= N:
        print((i+1)*1000-N)
        exit()
# Judge status: Accepted
A=[list(map(int,input().split())) for i in range(3)]
N=int(input())
B=[int(input()) for i in range(N)]
x=[[0]*3 for i in range(3)]
for b in B:
    for i,l in enumerate(A):
        for j,a in enumerate(l):
            if a==b:
                x[i][j]=1
print('Yes' if sum([all(l) for l in x]+[all(l) for l in zip(*x)]+[all([x[i][i] for i in range(3)]),all([x[i][2-i] for i in range(3)])]) else 'No')
# Judge status: Wrong Answer
a=int(input())
if a==3 or a==5 or a==9:
  print('YES')
else :
  print('NO')
# Judge status: Accepted
import sys
read = sys.stdin.readline
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

N, K = inpl()
A = inpl()
for i in range(K, N):
    if A[i] > A[i-K]:
        print('Yes')
    else:
        print('No')

# -----------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)
# Judge status: Accepted
N  = int(input())

ans = N%1000
if ans == 0:
    print(0)
else:
    print(1000-ans)
# Judge status: Accepted
N, A, B = map(int, input().split())
S = input()

a = 0
b = 0

for char in S:
    if char == 'a' and a + b < A + B:
            a += 1
            print('Yes')
    elif char == 'b' and a + b < A + B and b < B:
            b += 1
            print('Yes')
    else:
        print('No')
# Judge status: Accepted
*A, = list(input())
s = ['+', '-']
for i in range(2**3):
    formula = A[0]
    for j in range(3):
        if i >> j & 1:
            formula += s[0]
        else:
            formula += s[1]
        formula += A[j+1]
    if eval(formula) == 7:
        print(formula+'=7')
        exit()
# Judge status: Wrong Answer
N, M = map(int, input().split())

To_List = []
for _ in range(M):
    a, b = map(int, input().split())

    if a == 1:
        To_List.append(b)
    if b == N:
        if a in To_List:
            print("POSSIBLE")

print("IMPOSSIBLE")
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))
hantei=10**10+1
for i in range(0,n-k+1):
  #print(a[i],a[i+k-1])
  d=a[i+k-1]-a[i]+min(abs(a[i]),abs(a[i+k-1]))
  if hantei>d:
    hantei=d
print(hantei)
# Judge status: Accepted
a,b,c = map(int, input().split())
print("Yes" if a<=c<=b else "No")
# Judge status: Accepted

url = "https://atcoder.jp//contests/abc096/tasks/abc096_a"

def main():
    m, d = list(map(int, input().split()))
    ans = m
    if m > d:
        ans -= 1
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=sum(a)
l=[]
for i in range(len(a)-1):
  b-=a[i]
  l.append(a[i]*b)
print(sum(l)%(1000000007))
# Judge status: Accepted
def actual(A, B, C):
    if A <= C <= B:
        return 'Yes'

    return 'No'

A, B, C = map(int, input().split())
print(actual(A, B, C))
# Judge status: Wrong Answer
x,y = map(int,input().split())
if x *500 >= y :
    print("Yes")
else: print("NO")
# Judge status: Accepted
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

m = 0
for i in range(N):
    if A[i] >= B[i]:
        m += B[i]
    else:
        m += A[i]
        if A[i+1] >= (B[i]-A[i]):
            m += (B[i]-A[i])
            A[i+1] -= (B[i]-A[i])
        else:
            m += A[i+1]
            A[i+1] = 0
        
print(m)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    if p[i-1] < p[i] < p[i+1] or p[i-1] > p[i] > p[i+1]:
        ans += 1

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

print(-(-(b-1) // (a-1)))
# Judge status: Wrong Answer
a = list(map(str, input().split()))
num = len(a)
TorF = True

if num % 2 == 0:
    for i in range(num/2):
        if not a(2*i ) == 'h' and a(2*i + 1) == 'i':
            TorF = False
            break
else:
  TorF = False
  
if TorF == True:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S=input()
if S=="ABC":
  print("ARC")
else:
  print("ABC")
# Judge status: Accepted
n=input()
s=input()
x=0
a=0
for i in s:
    if i=="I":x+=1
    else:x-=1
    a=max(a,x)
print(a)
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))

m = float('inf')
ans = 0
n_min = 0
for i in range(0,n):
  if m >= p[i]:
    ans += 1
    m = p[i]
print(ans)
# Judge status: Accepted
import sys
read = sys.stdin.read
#readlines = sys.stdin.readlines
from bisect import bisect, bisect_left
from itertools import accumulate
def main():
    data = list(map(int, read().split()))
    n = data[0]
    a = data[1:n + 1]
    b = data[n + 1: n * 2 + 1]
    c = data[n * 2 + 1:]
    a.sort()
    b.sort()
    c.sort()
    b2 = [bisect_left(a, be) for be in b]
    b2a = list(accumulate(b2))
    b2a = [0] + b2a
    ans = sum([b2a[bisect_left(b, ce)] for ce in c])
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n,x,t=[int(i) for i in input().split()]
k=n//x
if n%x:
    print((k+1)*t)
else:
    print(k*t)
# Judge status: Accepted
n = int(input())
cnt = 0
ab_l = [list(map(int, input().split())) for _ in range(n)]
for ab in ab_l[::-1]:
    a, b = ab[0], ab[1]
    a += cnt
    if a % b != 0:
        cnt += b - a%b
print(cnt)
# Judge status: Accepted
from math import factorial

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

if abs(n-m) >= 2:
    print(0)
else:
    n_per = factorial(n) // factorial(n - n)
    m_per = factorial(m) // factorial(m - m)
    if n != m:
        print((n_per * m_per) % (10**9 + 7))
    else:
        print((n_per * m_per *2) % (10**9 + 7))
# Judge status: Wrong Answer
import math
n = int(input())
print(math.floor(n / 3) * math.floor(n / 3) * math.ceil(n / 3))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
ans=0
for i in range(60):
  o=0
  x=1<<i
  for j in a:
    if j&x:o+=1
  ans+=x*o*(n-o)
  ans%=mod
print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())

if a<=5:
    print(0)
elif a>=12:
    print(b)
else:
    print(b//2)
# Judge status: Wrong Answer
A, B = map(int, input().split())
if A <= 8:
    if B <=8:
        print("Yay!")
else:
    print(":(")
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
tf = True
for i in a:
    if i%2 ==0:
        if i % 3 ==0:
            pass
        elif i % 5 == 0:
            pass
        else:
            tf = False
if tf:
    print('APPROVED')
else:
    print('DENIED')
# Judge status: Accepted
n, m = map(int, input().split())

ans = 0
res = 0

if n >=  (m//4) * 2:
    print((m//4) * 2)
else:
    ans += n
    res = m - 2*n
    ans += (res//4)
    print(ans)
# Judge status: Accepted
N, R = map(int, input().split())

if N < 10:
    answer = R + 100 * (10 - N)
    print(answer)
else:
    print(R)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
ans = 0
m = 1000000007

s = 0
for i in range(N):
    ans += A[i] * s
    s += A[i]

print(ans % m)
# Judge status: Accepted
N, M = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(M)]
red = [0] * (N+1) #赤になりうる場所を１とする
red[1] = 1
red[0] = ""
ball = [1] * (N+1) #個数
ball[0] = ""
for x, y in xy:
  ball[y] += 1
  ball[x] -= 1
  if red[x] == 1:
    red[y] = 1
    if ball[x] == 0: red[x] = 0
print(red.count(1))
# Judge status: Accepted
a,b = map(int,input().split())
print((a+b+1)//2)
# Judge status: Accepted
# A - Takoyaki
N,X,T = map(int,input().split())
ans = T*((N-1)//X+1)
print(ans)
# Judge status: Accepted
n,d = map(int,input().split())
import math
print(math.ceil(n/(2*d+1)))
# Judge status: Wrong Answer
n,m = map(int,input().split())
a = [0]*n
k = [0]*n

for i in range(0,n):
  a[i] = input().split()
  k[i] = a[i][0]
  del a[i][0]

l = a[0]
#print(l)
for i in range(1,n):
  if(len(l) == 0):
    #print(0)
    exit()
  else:
    for j in l:
      if(j not in a[i]):
        k = l.index(j)
        del l[k]
            
print(len(l))
# Judge status: Accepted
l=sorted(map(int,input().split()))
if l[0]+l[1]==l[2]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a, b = map(int, input().split())
def gcd(x, y):
    x, y = max(x, y), min(x, y)
    if y == 0:
        return x
    return gcd(y, x % y)
  
print(a * b // gcd(a, b))
# Judge status: Wrong Answer
a, b, x= map(int, input().split())

if a + b >= x and b > x and a <= x:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
def max_coins(a, b):
  if a > b:
    print(a + (a -1))
  elif a == b:
    print(a + b)
  else:
    print(b + (b-1))
# Judge status: Accepted
n = int(input())

di = len(str(n))
ans = sum([int(w)for w in str(n)])

for i in range(di):
    digits = [int(w)for w in str(n)]
    if digits[i] == 0:
        continue
    t = sum(digits[0:i])

    t += digits[i]-1
    t += 9 * (di - i - 1)
    ans = max(ans, t)

print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
import collections
N = int(input())
A = list(map(int, input().split()))

T = collections.Counter(A)
hen1 = 0 # 小さい
hen2 = 0 # 大きい
for h, c in sorted(T.items(), key=lambda x:x[0]):
    if c >= 4:
        hen1 = h
        hen2 = h
    elif c >= 2:
        if hen1 >= hen2:
            hen2 = h
        else:
            hen1 = h
print(hen1*hen2)
# Judge status: Accepted
n = int(input())
S = input()
from collections import Counter
ans = 0
for i in range(1,n):
    f = S[:i]
    b = S[i:]
    f = set(f)
    #print(f)
    #print(S[:i],S[i:])
    cnt = 0
    for v in f:
        #print(v)
        if v in b:
            cnt += 1
    ans = max(ans,cnt)
print(ans)
# Judge status: Accepted
H1, M1, H2, M2, K = map(int, input().split())

time1 = H1*60 + M1
time2 = H2*60 + M2
time = time2 - time1

ans = time - K

print(max(ans, 0))