peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
 
import bisect
 
ans=0
l.sort()
 
for i in range(n):
    a=l[i]#一番短い棒を確定
    for j in range(i+1,n):
        b=l[j]#二番目に短い棒を確定
        ind=bisect.bisect_left(l,a+b)#二辺の和と同じだったら耐えないので，left
        ans+=max(0,ind-(j+1))#三角形の成立条件と，一番長い棒であることを考える

print(ans)
# Judge status: Accepted
N = int(input())
aaa = list(map(int, input().split()))
x = [(a, i) for i, a in enumerate(aaa, 1)]
x.sort()
ans = []
for a, i in x:
    ans.append(i)
print(*ans)
# Judge status: Accepted
a = input()
if 'A' <= a <= 'Z':
    print('A')
else:
    print('a')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    a[i] -= (i+1)
a.sort()
c = a[n//2]
if n % 2 == 0:
    c = int((a[n//2] + a[n//2-1]) // 2 + 0.5)
ans = 0
for i in range(n):
    ans += abs(a[i] - c)
print(ans)
# Judge status: Wrong Answer
import bisect

n = int(input())
a = list(map(int, input().split()))
a.sort()
M = max(a)
m = M // 2

left = bisect.bisect_left(a, m)
right = bisect.bisect_right(a, m)

if abs(m - left) < abs(m - right):
    print(M, a[left])
else:
    print(M, a[right])
# Judge status: Accepted
n = int(input())

cnt=[[0,0,0,0,0,0,0,0,0,0] for _ in range(10)]
ans = 0


for i in range(n+1):
    i = list(str(i))
    cnt[int(i[0])][int(i[-1])] += 1

for i in range(1, 10):
    for j in range(1, 10):
        ans += cnt[i][j] * cnt[j][i]

print(ans)
# Judge status: Wrong Answer
n, k, s = map(int, input().split())
A = [s]*k + [s+1]*(n-k)
print(*A)
# Judge status: Accepted
def main():
    n = int(input())
    ans = [0] * n

    for x in range(1,100):
        for y in range(1,100):
            for z in range(1,100):
                m = x**2+y**2+z**2+x*y+y*z+z*x
                if m <= n:
                    ans[m-1] += 1

    for i in range(n):
        print(ans[i])

main()
# Judge status: Accepted
S = input()
n = len(S)
a=S[0:(n-1)//2]
b=S[(n+3)//2-1:0]
if S==S[::-1] and a==a[::-1] and b==b[::-1]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
K = int(input())
odd = 0
even = 0
for i in range(1,K+1):
  if i % 2 == 0:
    odd += 1
  else:
    even += 1

print(odd * even)
# Judge status: Wrong Answer
Sold = list(map(str, input()))
Snew = set(Sold)
alph = set(list('abcdefghijklmnopqrstuvwxyz'))
if len(list(Snew-alph))==0:
  print('none')
else:
  print(sorted(list(Snew-alph))[0])
# Judge status: Accepted
s = input()

A = 0
B = 0
C = 0

for x in s:
    if x == 'a':
        A += 1
    elif x == 'b':
        B += 1
    else:
        C += 1

l = sorted([A, B, C])

print('YES' if (l[2] <= l[1] + 1 and l[0] == l[1]) or (l[2] == l[1] and l[0] == l[1] - 1) else 'NO')
# Judge status: Wrong Answer
from itertools import groupby
N = int(input())
S = input()
ans = []
#S1 = groupby(S)
a=0
a1=0
b=0
b1=0
S1 = groupby(list(S))
for key,group in S1:
  group = list(group)
  if list(key)==['(']:
    a=len(group)
    a1+=a
  else:
    b=len(group)
    b1+=b-a
    a1-=b
S = "("*b1+S
S = S+")"*a1
print("".join(S))
# Judge status: Wrong Answer
N = int(input())
A = [int(input()) for i in range(N)]
B = 1
for j in(A):
  if j == 2:
    print(B)
    break
  else:
    B += 1
print('-1')
# Judge status: Accepted
# itne me hi thakk gaye?
x, n = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
if x in arr:
    ans = 10**9
    diff = 10**9
    for i in range(0, 102):
        if i not in arr:
            if(abs(x - i) < diff):
                diff = abs(x-i)
                ans = i
    print(ans)
else :
    print(x)
# Judge status: Accepted
# 入力　数字3つ
a, b, c = map(int, input().split())

# 柱の並び方が美しい場合 YES を、そうでない場合 NO を 1行に出力せよ。
if b-a == c-b :
    print("YES")
else :
    print("NO")
# Judge status: Wrong Answer
K = int(input())
S = input()
if len(S) >= K:
    print(S[:K] + "...")
else:
    print(S)
# Judge status: Wrong Answer
import sys
from scipy.misc import comb
import bisect
input = sys.stdin.readline
N = int(input())
A = sorted(list(map(int, input().split())))
l = bisect.bisect_left(A,A[-1]//2)-1
r = l+1
if r==N-1 or comb(A[-1],A[l]) > comb(A[-1],A[r]):
    print(A[-1],A[l])
else:
    print(A[-1],A[r])
# Judge status: Accepted
#!/usr/bin/env python3

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

L = []
R = []
for i in range(N):
    L.append(i+A[i])
    R.append(i-A[i])

C_L = collections.Counter(L)
C_R = collections.Counter(R)
ans = 0
for l, t in C_L.items():
    if l in C_R:
        ans += t*C_R[l]
print(ans)
# Judge status: Accepted
[A,B,H,M] = list(map(int,input().split()))

X = (H+M*1/60)*30
Y = M*6
Z = min(abs(X-Y),abs(X+360-Y),abs(Y+360-X))
import math
cos = math.cos(math.radians(Z))
print((A**2+B**2-2*A*B*cos)**0.5)
# Judge status: Wrong Answer
N = int(input())

sum_N = 0

while N >= 10:
  print(N)
  sum_N += N % 10
  N = N //10

if (sum_N+N) % 9 == 0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
from collections import Counter

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

C = Counter(D)

if D[0] > 0 or C[0] > 1:
  print(0)
  exit(0)
  
mod = int(998244353)
ans = 1
for i in range(2,max(D)+1):
  ans = (ans * (C[i-1] ** C[i]) % mod) % mod
  
print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-

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


li = [0]*n
for i in range(q):
    a = int(input())
    li[a-1] += 1

for i in range(n):
    if li[i] > q-k:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
B=[A[i]-i-1 for i in range(N)]
B.sort()
if N%2==1:
  med=B[N//2]
else:
  med=(B[N//2-1]+B[N//2])//2
ans=0
for i in range(N):
  ans+=abs(B[i]-med)
print(ans)
# Judge status: Wrong Answer
x,a,b=map(int,input().split())
if x-a<b-x:
    print('A')
else:
    print('B')
# Judge status: Wrong Answer
n = int(input())
S = input()
L = [0]*26

for s in S:
    L[ord(s)-97] += 1

ans = 1
for i in range(26):
    if L[i] != 0:
        ans *= L[i]+1

print(ans-1)
# Judge status: Wrong Answer
X=int(input())

d5=[0]*(101)
for i in range(101):
    d5[i]=i**5


for i in range(101):
    for j in range(101):
        ans1=d5[i]-d5[j]
        if ans1==X:
            print(i,j)
            exit()
        ans2=d5[i]+d5[j]
        if ans2==X:
            print(i,(-1)*j)
            exit()
# Judge status: Accepted
N, T = map(int, input().split())

d = {}
for _ in range(N):
    Ns = [int(i) for i in input().split()]
    time = Ns[1]
    if time <= T:
        d[Ns[0]] = time
if d:
    print(min(d))
else:
    print('TLE')
# Judge status: Accepted
N,M,X = map(int,input().split())
li = []
import numpy as np
C = []

for _ in range(N):
    c,*a = map(int,input().split())
    li.append(np.array(a))
    C.append(c)

counter = []

for i in range(1<<N):
    skill_li = np.zeros(M).astype(int)
    sum_price = 0
    for k in range(N):
        if (i>>k) & 1:
            skill_li += li[k]
            sum_price += C[k]
    if all(skill_li>=X):
        counter.append(sum_price)

if len(counter)==0:
    print(-1)
else:
    print(min(counter))
# Judge status: Accepted
import math
def check(x):
    return math.sqrt(x) == int(math.sqrt(x)) and x != 1

n = int(input())
a = [1]* (n +1);
for i in range(2, n+1):
    for j in range(i, n+1, i):
        if j // i != i:
            a[j] += 1
        else:
            a[j] += 2
ans = 0
for i in range(1, n):
    ans += a[n - i] if not check(n-i) else a[n-i] - 1

print(ans)
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
if 2* max(l) < sum(l):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
k, a, b = map(int, input().split())
ans = k + 1
if a <= k:
  ans2 = a
  k -= a - 1
  if k % 2 == 1:
    ans2 += 1
  ans2 += (b - a) * (k // 2)
print(max(ans, ans2))
# Judge status: Accepted
n,k = map(int, input().split())
r,s,p = map(int, input().split())
t = list(input())

rsp = {"r":p, "s":r, "p":s}
ans = 0
for i in range(n):
  if i < k: ans += rsp[t[i]]
  else:
    if t[i] != t[i-k]: ans += rsp[t[i]]
    else: t[i] = "a"
print(ans)
# Judge status: Wrong Answer
D, N = map(int, input().split())

if D == 0 and N < 100:
  print(N)
elif D == 0 and N == 100:
  print(101)
elif D == 1 and N < 100:
  print(N * 100)
elif D == 1 and N == 100:
  print(N)
elif D == 2 and N < 100:
  print(N * 100 * 100)
elif D == 2 and N == 100:
  print(N)
# Judge status: Wrong Answer
n=int(input())
p=list( map(int, input().split()))
ans=0
for i in range(0,n-1):
    if (p[i-1]<p[i]<p[i+1]) or (p[i-1]>p[i]>p[i+1]):
        ans=ans+1
print(ans)
# Judge status: Wrong Answer
n,k,s = map(int,input().split())
li = [s]*k + [(s+10000)]*(n-k)
print(*li)
# Judge status: Wrong Answer
n,m = map(int, input().split())
n-=1
if n == 0:
    print(0)
else:
    print(pow(2,n))
# Judge status: Wrong Answer
import math
a,b,h,m = map(int,input().split())
c = math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(abs(30*h-6*m))))
print(c)
# Judge status: Accepted
import math
X = int(input())

for k in range(1, 361):
  if (k * X) % 360 == 0:
    print(k)
    break
# Judge status: Wrong Answer
n = int(input())
a=0
if n > 1:
  a = n//2
else:
  a = n
while True:
  if a**2 <= n:
    print(a**2)
    break
  a -= 1
# Judge status: Accepted
l = int(input())

print(l**3/27)
# Judge status: Accepted
# Problem https://atcoder.jp/contests/abc082/tasks/abc082_b
# Python 3rd Try

yes = "Yes"
no = "No"

def solver(sStr,tStr):
    ssStr = ''.join(sorted(sStr))
    srtStr = ''.join(sorted(tStr,reverse=True))
    result = yes if ssStr < srtStr else no
    return result

if __name__ == "__main__":
    s = input()
    t = input()
    answer = solver(s,t)
    print(answer)
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
ans=100000
for i in range(n-1):
    ans=min(ans,abs(sum(l[:i+1])-sum(l[i+1:])))
print(ans)
# Judge status: Accepted
X,Y,Z = map(int,input().split())
print(Z,X,Y)
# Judge status: Wrong Answer
import bisect

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

l.sort()

r = bisect.bisect_right(l, l[-1]/2)

a = l[r]
if r+1==N:
  b = l[r-1]
else:
  b = l[r+1]

a2 = min(a,l[-1]-a)
b2 = min(b,l[-1]-b)

if a2 >= b2:
  c = a
else:
  c = b

print( int( l[-1] ) ,int(c))
# Judge status: Accepted
S,W=map(int,input().split())
print("safe" if S>W else "unsafe")
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 0
for a_ in range(a+1):
    for b_ in range(b+1):
        for c_ in range(c+1):
            can = 500*a_ + 100*b_ + 50*c_
            if x == can:
                cnt += 1

print(cnt)
# Judge status: Accepted
n,p = map(int,input().split())
a  = list(map(int,input().split()))
cnt = 0
for x in a:
    if x%2:cnt+=1
if cnt == 0:
    if p:ans = 0
    else:ans = 2**n
else:
    ans = 2**(n-1)
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
ac, wa=[False]*n,[0]*n
for i in range(m):
  p,s = input().split()
  p=int(p)
  if s=='AC': ac[p-1]=True
  elif (s=='WA') and (ac[p-1]==False): wa[p-1]+=1

penalty, clear=0,0
for i,tf in enumerate(ac):
  if tf:
    penalty += wa[i]
    clear += 1
print('%d %d'%(clear,penalty))
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))

if n == 2:
    print(abs(A[0]-A[1]))
    exit()

cum_sum = [0]
for a in A:
    cum_sum.append(cum_sum[-1]+a)

ans = 10**9+1
for x in cum_sum[1:-1]:
    y = cum_sum[-1] - x
    ans = min(ans, abs(x-y))
print(ans)
# Judge status: Wrong Answer
h=int(input())
c=0
while h>0:
  h=(h//2)
  c+=1
print((c*2)+1)
# Judge status: Wrong Answer
def solve():
    s = list(input())

    if s[0] == 'B':
        s[0] = ''

    for i in range(1, len(s)):
        if s[i] == 'B':
            s[i-1], s[i] ='', ''


    return ''.join(s)

    
print(solve())
# Judge status: Wrong Answer
import sys


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


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

odd = sum([a % 2 for a in A])
even = len(A) - odd

ans = (2 ** even) * (2 ** (odd - 1))
# Judge status: Accepted
a = list(map(int,input().split()))

print(len(set(a)))
# Judge status: Accepted
n = int(input())
a = list(filter(lambda x : x & 1 or x % 3 == 0 or x % 5 == 0, map(int, input().split())))
print('APPROVED' if len(a) == n else 'DENIED')
# Judge status: Accepted
n, m, q = map(int, input().split())
queries = [tuple(map(int, input().split())) for _ in range(q)]

def calc_score(p):
    score = 0
    for a, b, c, d in queries:
        if p[b-1] - p[a-1] == c:
            score += d
    return score

def f(p):
    if len(p) == n:
        return calc_score(p)
    ans = 0
    l = p[-1] if len(p) else 1
    for x in range(l, m+1):
        p.append(x)
        ans = max(ans, f(p))
        p.pop()
    return ans

print(f([]))
# Judge status: Accepted
from math import gcd

k=int(input())
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            ans+=gcd(gcd(i,j), l)
            #print(gcd(i,j,l))
print(ans)
# Judge status: Wrong Answer
N = int(input())
p = [int(s) for s in input().split()]
print(sum([ sorted([p1,p2,p3])[1] == p1 for p1,p2,p3 in zip(p[2:],p[1:(N-1)],p[:(N-2)])]))
# Judge status: Accepted
A,B = input().split()
print(int(A)*int(B))
# Judge status: Accepted
from collections import defaultdict

cnt = defaultdict(int)

n = int(input())
for i in range(n):
    value = int(input())
    cnt[value] += 1

ret = 0
for c in cnt.values():
    if c % 2 == 1:
        ret += 1
print(ret)
# Judge status: Accepted
a,b = map(int,input().split())

if (a*b)%2 == 0:
    print("Even")
else:
    print("Odd")
# Judge status: Wrong Answer
import numpy as np

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

CS_L = np.cumsum(L).tolist()
ans = len([l for l in CS_L if l <= x])
print(ans)
# Judge status: Accepted
N = input()
nlen = len(N)
n = int(N)
j = nlen
ans = 0
while j > 0:
    if j % 2 == 0:
        j -= 1
        continue
    else:
        if j == nlen:
            ans += n - 10**(j-1) + 1
        else:
            ans += 10**j - 10**(j-1)
        j -= 1
print(ans)
# Judge status: Wrong Answer
K, X = map(int,input().split())

LX = []
for i in range(X-K+1, X+K):
    LX.append(i)

print(LX)
# Judge status: Accepted
import math
N, K = list(map(int,input().split()))
print(math.ceil((N - 1) / (K - 1)))
# Judge status: Accepted
sx,sy,tx,ty = map(int, input().split())
ans = ""
ans += "U"*(ty-sy)
ans += "R"*(tx-sx)
ans += "D"*(ty-sy)
ans += "L"*(tx-sx)
ans += ("L"+"U"*(ty-sy+1)+"R"*(tx-sx+1)+"D")
ans += ("R"+"D"*(ty-sy+1)+"L"*(tx-sx+1)+"U")
print(ans)
# Judge status: Accepted
# B k-th common Divisor
a, b, k = map(int, input().split())
ans = []
for i in range(1, 101):
    if a % i == 0:
        if b % i == 0:
            ans.append(i)
ans = sorted(ans)
print(ans[-k])
# Judge status: Accepted
x,y = map(int,input().split())
ans = 0
while x <= y:
    x *= 2
    ans += 1
print(ans)
# Judge status: Accepted
a,b=map(str,input().split())
c=int(a+b)
print("Yes" if (int(c**0.5))**2==c else "No")
# Judge status: Accepted
date=input()

if date=="ABC":
    print("ARC")
elif date=="ARC":
    print("ABC")
# Judge status: Accepted
a,b = map(int, input().split())
print(a + b//2)
# Judge status: Accepted
import sys


def _i(): return int(sys.stdin.readline().strip())


def main():
    x = _i()
    return "Yes" if x >= 30 else "No"


if __name__ == "__main__":
    print(main())
# Judge status: Wrong Answer
n=int(input())
d=list(map(int,input().split()))
ans=0
di=sorted(d)

half1=di[(n-1)//2]
half2=di[(n-1)//2+1]
ans=half2-half1
if ans>1:
    print(ans)
else:
    print(0)
# Judge status: Accepted
n = int(input())
CSF = [list(map(int, input().split())) for i in range(n-1)]

ans = [0 for i in range(n)]

for i in range(n):
    cnt = 0
    for j in range(i, n-1):
        c, s, f = CSF[j][0], CSF[j][1], CSF[j][2]
        if cnt < s:
            cnt = s
        elif cnt % f != 0:
            cnt = (cnt//f + 1) * f
        cnt += c
    ans[i] += cnt

for a in ans:
    print(a)
# Judge status: Accepted
s, c = map(int, input().split())
i = min(s, c//2)
m = i
s -= i
c -= i*2
if s == 0:
    m += c//4
# print(s,c)
print(m)
# Judge status: Accepted
import sys
from collections import deque, Counter
def I(): return int(sys.stdin.readline().rstrip())

if __name__=='__main__':
    n = I()
    l = []
    for _ in range(n):
        l.append(I())
    c = Counter()
    now = 0
    for i in range(1,n+1):
        now = l[now]-1
        c[now] += 1
        if now==1:
            print(i)
            exit()
        if c[now]==2:
            print(-1)
            exit()
    exit()
# Judge status: Accepted
def solve():
    c = [list(map(int, input().split())) for _ in range(3)]
    if c[0][0] + c[1][1] + c[2][2] == c[0][1] + c[1][2] + c[2][0] == c[0][2] + c[1][0] + c[2][1]:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    solve()
# 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
S = input()

if S[2] == S[3] and S[4] == S[5]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def INT():
    return int(input())

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

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

N = INT()
ans = {}

for i in range(N):
    S, P = input().split()
    P = int(P)
    
    if S in ans.keys():
        ans[S].append([P, i + 1])
        ans[S].sort(key = lambda x : x[0], reverse = True)
    else:
        ans[S] = [[P, i + 1]]
    
store = list(ans.keys())
store.sort()

for s in store:
    for p in ans[s]:
        print(p[1])
# Judge status: Accepted
N, D = map(int, input().split())
R = 0
for i in range(1,N+1):
  R += 2 * D + 1
  if N <= R:
    print(i)
    exit()
# Judge status: Accepted
n=int(input())
print(n*800-n//15*200)
# Judge status: Accepted
#import math
#import bisect
#import numpy as np
#import itertools
#import copy
import sys

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n, m = list(map(int,ipti().split()))
    l = [0] * m
    r = [0] * m

    for i in range(m):
        l[i], r[i] = list(map(int,ipti().split()))

    lower = -INF
    upper = INF

    for i in range(m):
        lower = max(lower, l[i])
        upper = min(upper, r[i])

    print(max(0, upper-lower+1))

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
s = input()
if n%2 == 0 and s[:int(n/2)] == s[int(n/2):] :
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]

H = sorted(H)
ans = float('Inf')
for i in range(N - (K - 1)):
    ans = min(ans, H[i + (K - 1)] - H[i])
print(ans)
# Judge status: Accepted
print("".join(sum(zip(input(),input()+" "),())))
# Judge status: Accepted
s = [list(reversed(input())) for _ in range(3)]
now = 0
turn = {"a": 0, "b": 1, "c": 2}
while True:
    if len(s[now]) == 0:
        break
    x = s[now].pop()
    now = turn[x]

print("ABC"[now])
# Judge status: Wrong Answer
w,h,x,y=map(int,input().split())
p=w*h/2
a=1 if w*y==x*h or x*h+y*w==w*h else 0
print(p,a)
# Judge status: Accepted
N,M = map(int, input().split())
M_list = input().split()

for i in range(M):
  N -= int(M_list[i])
  
if N >= 0:
  print(N)
else:
  print(-1)
# Judge status: Wrong Answer
a,b=input().split()
a=int(a)
b=int(b)
if a/b <= 1:
  print(1)
else :
  print(int(a/b)+1)
# Judge status: Accepted
N, M = map(int, input().split())
A = set([int(input()) for _ in range(M)])

mod = 1000000007

dp = [0] * (N + 2)
dp[N] = 1  # GOAL

for i in range(N-1, -1, -1):
  if i not in A:
    dp[i] = dp[i+1] + dp[i+2]

print(dp[0] % mod)
# Judge status: Accepted
n = int(input())
s = input()
t1 = [0]*n
t2 = [0]*n
for i in range(1, n):
  t1[i] = t1[i-1] + (s[i-1] == 'W')
  t2[n-i-1] = t2[n-i] + (s[n-i] == 'E')
ans = n
for i in range(n):
  ans = min(ans, t1[i] + t2[i])
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
ans = -float('inf')
for i in range(1, int(M ** .5 ) + 1):
    if M % i == 0:
        if N <= i:
            ans = max(ans, M // i)
        if N <= M // i:
            ans = max(ans, i)
print(ans)
# Judge status: Accepted
h,w = map(int,input().split(" "))
if h == 1 and w == 1:
    print(1)
elif h == 1:
    print(w - 2)
elif w == 1:
    print(h - 2)
else:
    print((h - 2) * (w - 2))
# Judge status: Accepted
W,a,b=map(int,input().split())

if a<=b and a+W >= b:
    print(0)
    exit()

if a<b:
    print(b-(a+W))

if a>=b and b+W >= a:
    print(0)
    exit()

if a>b:
    print(a-(b+W))
# Judge status: Wrong Answer
W,H,x,y=map(int,input().split())
S = (W*H)/2
if x == W//2 and y == H//2:
    print(S,1)
else:
    print(S,0)
# Judge status: Accepted
s = input()
if(len(s)==0):
  print("")
if(s[-1] == "s"):
  print(s+"es")
if(s[-1] != "s"):
  print(s+"s")
# Judge status: Accepted
n=int(input())
list=[[0]*n]
list=input().split()
g=0
c=0
for i in range(n):
  list[i]=int(list[i])
  if list[i]%2==0:
    g+=1
    if list[i]%3==0 or list[i]%5==0:
      c+=1
if g==c:
  print("APPROVED")
else:
  print("DENIED")
# Judge status: Wrong Answer

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

c=a>b

for i in range(a if c else b):
	print(b,end="")

print()
# Judge status: Accepted
N = int(input())
dice = [tuple(map(int, input().split())) for _ in range(N)]
count = 0
for d1, d2 in dice:
    if d1 != d2:
        count = 0
        continue
    else:
        count += 1
    if count == 3:
        print('Yes')
        break
else:
    print('No')
# Judge status: Accepted
a, b = map(int, input().split())
if a*b < 0: print("Zero")
elif b < 0 and (b-a)%2 == 0: print("Negative")
else: print("Positive")
# Judge status: Accepted
n = int(input())

i = 0
while i*1000<n:
    i += 1

print((i)*1000-n)
# Judge status: Wrong Answer
from fractions import gcd
a,b,c,d = map(int, input().split())
ci = (b//c) - (a//c)
di = (b//d) - (a//d)
e = c * d // gcd(c, d)
cdi = (b//e) - (a//e)
print(b-(a-1)-(ci+di-cdi))
# Judge status: Accepted
from collections import defaultdict
N, M = list(map(int, input().split()))
K = []
A = []
for _ in range(N):
    line = list(map(int, input().split()))
    K += [line[0]]
    A += [line[1:]]

count = defaultdict(int)
for a_ in A:
    for a in a_:
        count[a] += 1

result = 0
for k, v in count.items():
    if v == N:
        result += 1
print(result)
# Judge status: Accepted
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())


x = min(a, b, c, d, e)
print((n + x - 1) // x + 4)
# Judge status: Wrong Answer
import math
n,d = map(int,input().split())
try:
  a = [list(map(int,input().split())) for j in range(0,n)]
except EOFError:
  pass
c = 0
r = 0
for i in range(0,n-1):
  for j in range(i+1,n):
    for k in range(0,d):
      c+=(a[i][k]-a[j][k])**2
  if math.sqrt(c)==int(math.sqrt(c)):
    r += 1
print(r)
# Judge status: Accepted
a,b,c,d = map(int,input().split())
ans = "No"
if abs(a-c)<=d or (abs(a-b)<=d and abs(b-c)<=d):
    ans = "Yes"
print(ans)
# Judge status: Accepted
A,B,M = map(int,input().rstrip().split())
a = list(map(int, input().rstrip().split()))
b = list(map(int, input().rstrip().split()))
x = [list(map(int,input().rstrip().split())) for _ in range(M)]
Low_price = min(a) + min(b)
disc_prices = []
for i in range(M):
	disc_prices.append(a[x[i][0]-1] + b[x[i][1]-1] - x[i][2])
if Low_price <= min(disc_prices):
	print(Low_price)
else:
  	print(min(disc_prices))
# Judge status: Wrong Answer
s=input()
n=len(s)
s1=s[(n-1)//2]
flag=0
for i in range(len(s1)//2):
    if(s1[i]!=s1[-1-i]):
        flag=1
        break

s1=s[(n+3)//2-1]
for i in range(len(s1)//2):
    if(s1[i]!=s1[-1-i]):
        flag=1
        break

for i in range(n//2):
    if s[i]!=s[-1-i]:
        flag=1
        break

if flag==1:
    print("No")
else:
    print("Yes")
# Judge status: Accepted

a, b, c, d = map(int, input().split())

print(max(a*c, a*d, b*c, b*d))
# Judge status: Accepted
S = input()

if S == 'AAA' or S == 'BBB':
    print('No')
else:
    print('Yes')
# Judge status: Accepted
N = int(input())
odds_size = -(-N//2)
print(odds_size/N)
# Judge status: Accepted
x = int(input())
if x == 0:
    print (1)
elif x == 1:
    print (0)
# Judge status: Accepted
s=input()
k=int(input())
if s=="1"*len(s):
  print(1)
else:
  i=0
  while True:
    if s[i]!="1":
      n=s[i]
      break
    else:
      i+=1
  if k-1<i:
    print(1)
  else:
    print(s[i])