peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
x = int(input())

def q(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

l = 6
ans = 0
while l > 1:
    b = q(x)
    x += 1
    l = len(b)
print(x - 1)
# Judge status: Wrong Answer
n = int(input())
print((n/2)**2) if n%2 == 0 else print((n//2) * (n//2+1))
# Judge status: Accepted
import bisect

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

numbers.sort()
maximum = numbers[-1]

half = maximum/2
index = bisect.bisect_left(numbers, half)
if index != 0:
    if numbers[index] - half < half - numbers[index-1]:
        print('{} {}'.format(maximum, numbers[index]))
    else:
        print('{} {}'.format(maximum, numbers[index-1]))
else:
        print('{} {}'.format(maximum, numbers[0]))
# Judge status: Accepted
N = int(input())
seki = set()
for i in range(9):
    for j in range(9-i):
        seki.add((i+1)*(i+j+1))
if N in seki:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
n=int(sys.stdin.readline())
arr=list(map(int,sys.stdin.readline().split()))
from collections import defaultdict
s=0
dic=defaultdict(int)
for i in range(n):
    dic[arr[i]]+=1
for i in dic:
    s+=(dic[i]*(dic[i]-1))//2
#print(s,'s')
for i in range(n):
    a=arr[i]
    ans=s
    
    ans-=dic[a]*(dic[a]-1)//2
    if dic[a]-2>=0:
        ans+=(dic[a]-1)*(dic[a]-2)//2
    print(ans)
# Judge status: Accepted
from collections import deque

S = input()
Q = int(input())
W = 0
ans = deque(list(S.rstrip()))

for _ in range(Q):
#    print(W,ans)
    qry = list(input().rstrip().split())
    if qry[0] == "1":
        W = 1-W
        continue
    T,F,C = qry
    C.rstrip()
    if (W == 0 and F=="2") or (W==1 and F=="1"):
        ans.append(C)
    else:
        ans.appendleft(C)
ans = "".join(map(str,ans))
if W == 1:
    ans = ans[::-1]
print(ans)
# Judge status: Wrong Answer
import math
A, B, N = map(int, input().split())

def f(x):
    return math.floor(A * x / B) - A * math.floor(x / B)

high = N
low = 0
while high - low > 1:
    mid_left = high / 3 + low * 2 / 3
    mid_right = high * 2 / 3 + low / 3
    # print(mid_left, mid_right)
    if f(mid_left) >= f(mid_right):
        high = mid_right
    else:
        low = mid_left
print(f(high))
# Judge status: Wrong Answer
n = int(input())
city = [int(input()) for _ in range(5)]
if n <= min(city):
    print(5)
    exit()
print(round(n/min(city))+4)
# Judge status: Accepted
a,b,k = map(int,input().split())

target = list()

for i in range(1, max(a,b)+1):
  if a%i==0 and b%i==0:
    target.append(i)

print(target[-k])
# Judge status: Accepted
D = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
print(D[input().strip()])
# Judge status: Accepted
n=int(input())
s=list(str(input()))
x=0
ans=0
for i in range(n):
  if s[i]=="I":
    x+=1
  else:
    x-=1
  ans=max(ans,x)
print(ans)
# Judge status: Accepted
s = input().lower()
if s[-1] == 's':
  print(str(s)+"es")
elif s[-1] != 's':
  print(str(s)+"s")
# Judge status: Wrong Answer
#c
x,k,d = map(int,input().split())

if x//d <k:
    if (k-x//d)%2 == 0:
        if x%d > abs(x%d-d):
            print(x%d-d)
        else:
            print(x%d)
    else:
        print(abs(x%d-d))
else:
    print(x-d*k)
# Judge status: Wrong Answer
#ABC130 B

N,X = map(int,input().split())
L = list(map(int,input().split()))
D = [0,L[0]]
count = 0
for i in range(2,N+2):
    D.append(D[i-1]+L[i-2])
for i in range(0,N+2):
    if D[i]<= X:
        count += 1

print(count)
# Judge status: Accepted
n = int(input())
s = input()
x = 0
max = 0
for i in range(n):
    if s[i] =="I":
        x += 1
        if x>max:
            max = x
    else:
        x -= 1
print(max)
# Judge status: Accepted
import math

mod = 1000000007

def solve():
    N = int(input())
    ans = math.factorial(N) % mod
    print(ans)

if __name__ == "__main__":
    solve()
# Judge status: Accepted
N, X, Y = map(int, input().split())

dis = [0 for _ in range(N)]
for i in range(1, N):
    for j in range(i + 1, N + 1):
        d = min(abs(i - j),
                abs(i - X) + 1 + abs(j - Y),
                abs(i - Y) + 1 + abs(j - X))
        dis[d] += 1

for k in range(1, N):
    print(dis[k])
# Judge status: Wrong Answer
N = int(input())
S = input()

x = 0
maxCount = 0
for s in S:
  former = x
  if s == "I":
    x += 1
  elif s == "D":
    x -= 1
  
  maxCount = max(former, x)
  
print(maxCount)
# Judge status: Accepted
import datetime
import string
import re
import math

inp = list(map(int, input().split()))
N=int(inp[0])
D=int(inp[1])
alist = [input().split() for i in range(N)]

count = 0
for i in range(N):
    if int(alist[i][0])**2 + int(alist[i][1])**2 <= D**2: count += 1

print(count)
# Judge status: Accepted
from collections import Counter
from itertools import combinations
n = int(input().rstrip())

c = Counter()

for i in range(1,n+1):
    i = str(i)
    a = int(i[0])
    b = int(i[-1])
    c[a, b] += 1

ans = 0
for a, b in combinations(range(1,10), 2):
    ans += 2 * c[a,b] * c[b,a]

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

print(ans)
# Judge status: Accepted
X, Y = map(int, input().split())
ans = 10 ** 18

# flipしない
if Y - X >= 0:
    ans = Y - X

# はじめにflip
if Y - (-X) >= 0:
    ans = min(ans, 1 + Y - (-X))

# 最後にflip
if (-Y) - X >= 0:
    ans = min(ans, (-Y) - X + 1)

# 両方flip
if (-Y) - (-X) >= 0:
    ans = min(ans, 1 + (-Y) - (-X) + 1)

print(ans)
# Judge status: Accepted
n = int(input())
ans = 0

d = 2
while d * d < n:
    if n % d != 0:
        d += 1
        continue

    e = d
    while n % e == 0:
        n //= e
        e *= d
        ans += 1

    while n % d == 0:
        n //= d
if n != 1:
    ans += 1

print(ans)
# Judge status: Accepted
a,s,c=input().split()
print("A"+s[0]+"C")
# Judge status: Accepted
def main():
    s = input()
    length = len(s)
    print("yes" if length == len(set(list(s))) else "no")


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

level = 0
step = 0
for i in range(n):
  if level < a[i]:
    level = a[i]
  else:
    step += level - a[i]
print(step)
# Judge status: Accepted

[L,R] = list(map(int,input().split()))

flag=0
for i in range(L,R+1):
    if i%2019 == 0:
        flag=1
        break

LL = L%2019
RR = R%2019
dammy=[]
for i in range(LL,RR):
    for j in range(i+1,RR+1):
        dammy.append((i*j)%2019)

if flag==0:
    print(min(dammy))
else:
    print(0)
# Judge status: Wrong Answer
def main():
    from math import ceil
    from itertools import accumulate
    from bisect import bisect
    n, h, *ab = map(int, open(0).read().split())

    x = max(ab[::2])
    *y, = filter(lambda i: i >= x, ab[1::2])
    y.sort(reverse=True)
    *z, = accumulate(y)

    if z[-1] <= h:
        print(len(y) + ceil((h - z[-1]) / x))
    else:
        print(bisect(z, h))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a = int(input())
b = int(input())
h = int(input())
area = 0.5*(a+b)*h
print(area)
# Judge status: Accepted
import fractions

n,st=map(int,input().split())
*x,=map(int,input().split())

e=abs(x[0]-st)
for i in range(1,n):
    e=fractions.gcd(e,abs(x[i]-st))

print(e)
# Judge status: Wrong Answer
n=int(input())
ans=10**13
for i in range(1,10**6):
  if n%i==0:
    cal=n//i+i-2
    ans=min(cal,ans)
print(int(ans))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

for a in A:
  if a%2 == 0 and not (a%3 == 0 or a%5 == 0):
    print('DENIED')
    break
else:
  print('APPROVED')
# Judge status: Accepted
# coding: utf-8

h = int(input())
w = int(input())
n = int(input())
count  = num = 0

higher = max(h,w)
lower = min(h,w)

for i in range(lower):
    count = higher*(i+1)
    num += 1
    if count>=n:
        print(num)
        exit()
# Judge status: Accepted
S=list(str(input()))

l=len(S)
if l%2 != 0:
    print("No")
    exit()


for i in range(l):
    if i%2 == 0 and S[i]!="h":
        print("No")
        exit()
    if i%2 != 0 and S[i]!="i":
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
# 問題：https://atcoder.jp/contests/abc138/tasks/abc138_c

n = int(input())
v = list(map(int, input().strip().split()))
v.sort(reverse=True)
res = 0
for i in range(n-1):
    res += v[i] / (2**(i+1))
res += v[-1] / (2**(n-1))

print(res)
# Judge status: Wrong Answer
def solve(s):
    if s == 'AAA' or s == 'BBB':
        print("No")
    else:
        return("Yes")

s = raw_input()
solve(s)
# Judge status: Accepted
# https://atcoder.jp/contests/code-festival-2016-quala/tasks/codefestival_2016_qualA_c

s = input()
k = int(input())
n = len(s)
ans = []
for i in range(n):
    t = (ord('z') - ord(s[i]) + 1) % 26
    if k - t >= 0:
        ans.append('a')
        k -= t
    else:
        ans.append(s[i])
if k > 0:
    k %= 26
    ans[-1] = chr(ord(ans[-1]) + k)
print(''.join(ans))
# Judge status: Accepted
x = list(map(int,input().split()))
x.reverse()
a = x.index(0)
if a == 4:
    print(x[a-1]-1)
else:
    print(x[a+1]+1)
# Judge status: Wrong Answer
s = str(input())
t = str(input())
revise = 0
len_str = len(s)
for i in range(len_str):
    if s[i] != t[i]:
        revise += 1
# Judge status: Accepted
import math


def main():
    n, s = map(int, input().split())
    xs = sorted(list(map(int, input().split())))

    for i in range(n):
        xs[i] = abs(xs[i] - s)

    for i in range(1, n):
        xs[i] = math.gcd(xs[i], xs[i-1])

    print(xs[n-1])


if __name__ == "__main__":
    main()
# Judge status: Accepted
def main():
  import sys
  n=int(input())
  AA=tuple(map(int,sys.stdin.readline().split()))
  b=[None]*n
  I=1
  for index in AA:
    b[index-1]=I
    I+=1
  print(" ".join(map(str,b)))
if __name__=="__main__":
  main()
# Judge status: Accepted
X,Y=map(int,input().split())
a=Y/2
print(int(X+a))
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
S, T = input().split()

U = S+T
print(U)
# Judge status: Accepted
S = list(input())
alpha = 'abcdefghijklmnopqrstuvwxyz'

for a in alpha:
  if S.count(a) == 0:
    print(a)
    break
else:
  print("None")
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = list(map(int, input().split()))
from fractions import gcd
def Lcm(x):
  L = 1
  for a in x:
    a=a//2
    L = (a // gcd(a, L))*L
  return L
X=Lcm(A)
fg = 0
for i in A:
  if (X//i)%2==0:
    fg=1
    break
if fg==1:
  print(0)
else:
  print(((M//X)+1)//2)
# Judge status: Accepted
a, b, k = map(int, input().split())

if b-a <= k:
  for i in range(a, b+1):
    print(i)
else:
  ans = []
  for i in range(a, a+k):
    if i not in ans:
      ans.append(i)
      print(i)
  for j in range(b-k+1, b+1):
    if j not in ans:
      print(j)
# Judge status: Wrong Answer
N = int(input()) #ここで標準入力
A = list(map(int, input().split()))
Q= int(input()) #ここで標準入力


list = []
for i in range(Q):
    a,b=input().split()
    list.append((int(a), int(b)))

for k in range(Q):
    for j in range(N):
        if list[k][0] == A[j]:
            A.remove(list[k][0])
            A.append(list[k][1])
        
    print(sum(A))
# Judge status: Wrong Answer
import sys
def input(): return sys.stdin.readline().strip()

def main():
    n = int(input())
    x = 800 * n
    y = 200 * n // 15
    print(x - y)
    

if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
pre = 0
onef = False
twef = False
badf = False
for i,num in enumerate(a):
    if i+1 != num:
        if not onef:
            onef = True
            badf = True
        elif not twef:
            twef = True
            badf = False
        else:
            badf = True
if not badf:
    print('YES')
else:
    print('NO')
# Judge status: Accepted

n=int(input())
A=sorted(list(map(int, input().split())))
amax=max(A)
half=amax/2

ans=0
now=amax
for a in A:
  if abs(a-half)<=now and a<amax:
    now=abs(a-half)
    ans=a
print(amax, ans)
# Judge status: Accepted
num=int(input().rstrip())
m=input().rstrip().split()
main=[]
for i in m:
    main.append(int(i))
sample=sorted(main,reverse=True)
result=0
for i in range(2,num+1):
    if i%2==0:
        y=i/2-1
        result+=sample[int(y)]
    else:
        y=(i+1)/2-1
        result+=sample[int(y)]
print(result)
# Judge status: Wrong Answer
a,b=map(int,input().split(" "))
print(round((a + b) / 2))
# Judge status: Accepted
X = int(input())
x = 100
i = 0
while True:
    if x >= X:
        print(i)
        break
    i += 1
    x = int(x*1.01)
# Judge status: Accepted
N,M = map(int,input().split())
A = []
for i in range(N):
    K, *B = map(int, input().split())
    A += B
ans = 0
#print(A)
for i in set(A):
    if A.count(i) == N:
        ans += 1
print(ans)
# Judge status: Accepted
import math
N=int(input())
print(int(pow(int(math.sqrt(N)),2)))
# Judge status: Accepted
n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
c, p = 0, 0
while c < n:
    if p + l[c] <= x:
        p += l[c]
        c += 1
    else:
        break
print(c + 1)
# Judge status: Accepted
import sys
input = sys.stdin.readline
N, C, K = [int(x) for x in input().split()]
T = [int(input()) for _ in range(N)]
T.sort()
depart = T[0] + K  # 出発時刻
passenger = 0  # 乗客数
bus = 1
for i in range(N):
    if passenger >= C or depart < T[i]:  # すでに満員または待ち時間オーバー
        bus += 1
        passenger = 1
        depart = T[i] + K
    else:
        passenger += 1

print(bus)
# Judge status: Wrong Answer
import copy
x, y, a, b, c = map(int, input().split())
#s= list(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
q.sort()
r.sort()
por = p[a-x:a]
qor = q[b-y:b]
qp = por.copy()
qp.extend(qor.copy())
qp.sort()
i=0
while(i < x+y and i < c and r[c-i-1] > qp[i]):
    qp[i] = r[c-i-1]
ans = sum(qp)
print(ans)
# Judge status: Wrong Answer
from collections import Counter

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

AC = list(Counter(A).items())
AC.sort()
MOD = 998244353
ans = 1
last_v = 1
last_k = -1
for k, v in AC:
  if k == 0:
    if v > 1:
      print(0)
      exit()
    last_k = 0
    continue
  if k != last_k+1:
    print(0)
    exit()
  ans = ans*pow(last_v, v, MOD)%MOD
  last_v = v
  last_k = k
print(ans)
# Judge status: Accepted
import sys
readline = sys.stdin.readline

N, K = map(int, readline().split())
P = list(map(int, readline().split()))
AP = P[:]
for i in range(1, N):
    AP[i] += AP[i-1]
AP = [0] + AP
ans = 0
for st in range(N-K+1):
    en = st+K
    ans = max(ans, AP[en] - AP[st])

print((ans+K)/2)
# Judge status: Accepted
import math
A, B, N = map(int, input().split())
if B <= N:
    x = B - 1
else:
    x = N
print(math.floor(A * x / B))
# Judge status: Wrong Answer
import heapq

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


while m > 0 :
  m -= 1
  heapq.heapify(a)
  heapq.heappush(a, heapq.heappop(a) // 2)

print(sum(a))
# Judge status: Accepted
#s = input()
n = int(input())
if n == 1:
    print(0)
else:
    print(1)
# Judge status: Accepted
def cost(x):
    cost = (x - ave)**2
    return cost


n = input()
a = list(map(int, input().split()))
ave = round(sum(a)/int(n))
print(sum(list(map(cost, a))))
# Judge status: Accepted
a,b = map(int,input().split())

if a == b:
  print("Draw")
elif a == 1:
  print("Alice")
elif b == 1:
  print("Bob")
elif a > b:
  print("Alice")
else:
  print("Bob")
# Judge status: Accepted
x, k, d = map(int, input().split())
x = abs(x)
n = x // d
if k <= n:
    print(x - k * d)
    quit()
k -= n
x %= d
print(x if k % 2 == 0 else d - x)
# Judge status: Accepted
N_,A_,B_=input().split()
N = (int)(N_)
A = (int)(A_)
B = (int)(B_)

sum = 0
for n in range(1,N+1):
    count = 0
    n_ = (str)(n)
    n_num = len(n_)
    for i in range(n_num):
        count = count + (int)(n_[i])
    if A<=count and B>=count:
        sum = sum + n
print(sum)
# Judge status: Wrong Answer
from collections import deque


X,Y,A,B,C = map(int, input().split())
A=[int(a) for a in input().split()]
B=[int(b) for b in input().split()]
C=[int(c) for c in input().split()]
A=sorted(A, reverse=True)[:X]
B=sorted(B, reverse=True)[:Y]
AB=deque(sorted(A+B))

for c in C:
  if c > AB[0]:
    AB.popleft()
    AB.append(c)
    break

print(sum(AB))
# Judge status: Accepted
a, b = map(int, input().split())
st_l = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]

if st_l.index(a) > st_l.index(b):
    print('Alice')
elif st_l.index(a) < st_l.index(b):
    print('Bob')
else:
    print('Draw')
# Judge status: Accepted
import sys
n,m = map(int, input().split())
SCs = [list(map(int, input().split())) for _ in range(m)]
for i in range(10**n):
  X=str(i)
  tf=True
  if len(X)==n:
    for j in SCs:
      if X[j[0]-1]!=str(j[1]):
        tf=False
        break
    if tf:#全ループ終わって条件を満たしていれば
      print(i)
      sys.exit()
print(-1)
# Judge status: Accepted
S=input()
L=[0]*(len(S)+1)
#print(L)
for i in range(len(S)):
  if S[i]=='<':
    L[i+1]=L[i]+1
for i in range(len(S)-1,-1,-1):
  if S[i]=='>':
    L[i]=max(L[i],L[i+1]+1)
print(sum(L))
# Judge status: Wrong Answer
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

a,b = map(int,input().split())
li = []
for i in range(1,1000):
    li.append((1/2)*i*(i+1))
for i in range(len(li)):
    if li[i]>a and li[i]<=b:
        check = i
        break
print(int(li[check]-a))
# Judge status: Accepted
A, B, C = map(int, input().split())

if A < C < B or B < C < A:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
# -*- coding: utf-8 -*-

a=int(input()) #500
b=int(input()) #100
c=int(input()) #50
x=int(input()) #sum

cnt=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            tmp=500*i+100*j+50*k
            if tmp==x:
                cnt+=1
            elif tmp>x:
                break
print(cnt)
# Judge status: Accepted
#094_A
a,b,x=map(int,input().split())
print('YES' if a<=x<=a+b else 'NO')
# Judge status: Accepted
n,q=list(map(int,input().split()))
s=input()

acum=[0]*(n+1)

for i in range(1,n):
    if s[i]=='C' and s[i-1]=='A':
        acum[i]=acum[i-1]+1
    else:
        acum[i]=acum[i-1]

for _ in range(q):
    l,r=list(map(int,input().split()))
    l-=1
    r-=1
    print(acum[r]-acum[l])
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
count = 0

for i in range(1,n):
    if l[i-1] == i:
        l[i-1],l[i] = l[i],l[i-1]
        count += 1
if l[n-1] == n:
    count += 1
print(count)
# Judge status: Accepted
A = list(map(int,input().split()))
N = 10*A[1]+A[2]
if N % 4 == 0:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
import sys

def main():
    N = int(sys.stdin.readline())
    A = list(map(int, sys.stdin.readline().rstrip().split()))

    n = max(A)
    a = -1
    d = n
    for e in A:
        if e == n:
            continue
        if abs(e - n/2) < d:
            a = e
            d = abs(e - n/2)
    
    print(n, a)


if __name__ == '__main__':
    main()
# Judge status: Accepted
S = input()
m = list(S)
ans = 'No'

if (m[2] == m[3]) and (m[4] == m[5]):
  ans = 'Yes'

print(ans)
# Judge status: Accepted
input = open(0).readline
s = {}
s['A'] = list(input().strip())
s['B'] = list(input().strip())
s['C'] = list(input().strip())

play_order = {'A':'B', 'B':'C', 'C':'A'}

def play(player):
    if s[player] == []:
        print(player.upper())
        return player
    next_play = s[player].pop(0)
    play(next_play.upper())
        
play('A')
# Judge status: Accepted
def main():
    S = list(input())
    K = int(input())
    k = K
    for i,c in enumerate(S):
        distance = (ord('z') + 1 - ord(c))%26
        if distance <= k:
            k -= distance
            S[i] = 'a'
    S[-1] = chr((ord(S[-1]) - ord('a') + k) % 26 + ord('a'))
    print(''.join(S))

main()
# Judge status: Wrong Answer
N = int(input())
INF = int(1e10)
dp = [INF] * N
dp[0] = 1

bt = set()
for i in range(1, 100):
    if 6**i > N:
        break
    bt.add(6**i)

for i in range(1, 100):
    if 9**i > N:
        break
    bt.add(9**i)

bt = sorted(bt)

for i in range(1, N):
    dp[i] = dp[i-1] + 1
    for j in bt:
        if i - j >= 0:
            dp[i] = min(dp[i], dp[i - j] + 1)
print(dp[N-1])
# Judge status: Accepted
def solve(sx, sy, tx, ty):

    dx = abs(tx-sx)
    dy = abs(ty-sy)

    ans = "U"*dy + "R"*dx + "D"*dy + "L"*dx
    dx += 1
    dy += 1
    ans += "L" + "U"*dy + "R"*dx + "D"
    ans += "R" + "D"*dy + "L"*dx + "U"

    return ans

if __name__ == "__main__":
    sx,sy,tx,ty = [int(i) for i in input().split()]
    print(solve(sx, sy, tx, ty))
# Judge status: Accepted
import sys
import bisect

input = sys.stdin.readline


def main():
    N = int(input())
    L = list(map(int, input().split()))

    L.sort()
    ans = 0
    for a in range(N - 2):
        for b in range(a + 1, N - 1):
            c = bisect.bisect_left(L, L[a] + L[b]) - 1
            ans += c - b

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
x = input()
if x[0] == 9 or x[1] == 9:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
def solve(n):
  cnt = 0
  for i in range(1,n+1):
    if n%i == 0: cnt += 1
  if cnt == 8: return True
  else: return False

n = int(input())
ans = 0
for i in range(1, n+1, 2):
  if solve(i): ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(1, n + 1, 2):
    yakusu = 0
    for j in range(1, i + 1):
        if i % j == 0:
            yakusu += 1
    if yakusu == 8:
        ans += 1
print(ans)
# Judge status: Accepted
a,b = map(int, input().split())

if a <= 5:
  print(0)
elif 6 <= a and a <= 12:
  print(int(b/2))
else:
  print(b)
# Judge status: Wrong Answer
N = int(input())
li = [list(map(int, input().split())) for i in range(N - 1)]

for n in range(N):
  if n == N - 1:
    print(0)
    break
  
  ans = 0
  for index, i in enumerate(li):
    if index < n:
      continue

    if ans < i[1]:
      ans = i[1]
    else:
      if (ans - i[1]) % i[2] != 0:
        ans += (ans - i[1]) % i[2]

    ans += i[0]
  print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

answer = 0
for i, a in enumerate(A, 1):
    if i % 2 and a % 2:
        answer += 1

print(answer)
# Judge status: Accepted
N=int(input())
ans=0
c=[[0 for _ in range(10)] for _ in range(10)]

for n in range(1,N+1):
    i=n%10
    j=n
    while 10<=j:
        j=j//10
    c[i][j]=c[i][j]+1

for i in range(10):
    for j in range(10):
        ans=ans+c[i][j]*c[j][i]
print(ans)
# Judge status: Accepted
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
l = LI()
x = 0
for i in range(1, N+1):
    if i != l[i-1]:
        x += 1
if x > 2:
    print('NO')
else:
    print('YES')
# Judge status: Wrong Answer
n,m=map(int,input().split())
sa=set()
sb=set()
for _ in range(m):
  a,b=map(int,input().split())
  if a==1:
    sa.add(b)
  if b==n:
    sb.add(a)
print("INPOSSIBLE" if len(sa&sb)==0 else "POSSIBLE")
# Judge status: Accepted
n, k = map(int, input().split())
s = input()
pre = "O"
cnt = 0
for i in range(n):
    now = s[i]
    if now != pre:
        cnt += 1
    pre = now
print(min((n - cnt + 2 * k), n - 1))
# Judge status: Wrong Answer
A, B = input().split()

a01 = int(A[0:2])
a43 = int(''.join(list(reversed(A[3:5]))))
if a01 <= a43:
  amin = int(A[1:3])
else:
  amin = int(A[1:3]) - 1

b01 = int(B[0:2])
b43 = int(''.join(list(reversed(B[3:5]))))
if b01 <= b43:
  bmin = 100 - int(B[1:3]) - 1
else:
  bmin = 100 - int(B[1:3])

n0 = int(B[0]) - int(A[0]) + 1

print(n0 * 100 - amin - bmin)
# Judge status: Accepted
n=int(input())
for i in range(1,10):
  if n % i ==0 and n / i <10:
    print("Yes")
    break
else:
  print("No")
# Judge status: Wrong Answer
n,k=map(int,input().split())
x=list(map(int,input().split()))
ans=2*(10**8)+1
for i in range(n-k+1):
    temp=x[i+k-1]-x[i]+min(abs(x[i]),abs(x[i+k-1]))
    if temp<ans: ans=temp
print(ans)