peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
ins = list(map(int, input().split()))
N = ins[0]
L = ins[1]
Ss = []

for i in range(N):
  Ss.append(input())

for i, a in enumerate(Ss):
  key = a
  j = i - 1

  while j >= 0 and Ss[j] > a:
    Ss[j + 1] = Ss[j]
    j = j - 1

  Ss[j + 1] = key

print(' '.join(Ss))
# Judge status: Accepted
N = int(input())
ans = {}
for i in range(N):
    A = input()
    if  A in ans:
        ans[A] += 1
    else:
        ans[A] = 1
c = 0
for i in ans:
    if ans[i] % 2 == 1:
        c += 1
print(c)
# Judge status: Accepted
n,m=map(int,input().split())

print(int(n*(n-1)/2+m*(m-1)/2))
# Judge status: Wrong Answer
x,y=list(map(int, input().split()))
print(x+y/2)
# Judge status: Accepted
import sys
arr = list(input())

before = arr[0]
for I in range(1,len(arr)):
    if before == arr[I]: print('Bad');sys.exit()
    before = arr[I]
print('Good')
# Judge status: Accepted
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    A, B, C = map(int, input().split())
    if A < C < B or B < C < A:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()
# Judge status: Accepted
lst = input().split()
N = int(lst[0])
A = int(lst[1])
B = int(lst[2])

def sum(n):
   result = 0
   s = str(n)
   for i in range(len(s)):
      result += int(s[i])
   return result

count = 0

for i in range(1, N+1):
   if A <= sum(i) <= B:
      count += i

print(count)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=0
for i in range(0, N):
    ans+=B[A[i]-1]
    if i>0 and A[i]-A[i-1]==1:
        ans+=C[A[i-1]-1]
print(ans)
# Judge status: Wrong Answer
N,D=map(int,input().split())

print(round(N/(2*D+1)+0.5))
# Judge status: Wrong Answer
S = list(input())
A = sorted(S)
if A[0] == A[1] and A[2] == A[3]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n, x = map(int, input().split())

nums = sorted(list(map(int, input().split())))

count = 0
for i, num in enumerate(nums):
    if (i < n-1 and num <= x) or (i == n-1 and num == x):
        count += 1
        x -= num        
    else:
        break

print(count)
# Judge status: Wrong Answer
import numpy as np
N, K = map(int, input().split())
A = list(map(int, input().split()))
A = np.array(A)

for i in range(0, N - K):
    before = A[i:i+K].prod()
    after = A[i+1:i+1+K].prod()

    if before < after:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
N = input().strip()
Arr = input().strip().split(' ')
if len(Arr) - len(set(Arr)) == 0:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n = int(input())
li1 = list(map(int,input().split()))
li2 = []
count = 0
for i in range(n):
    li2.append(i+1)
for i in range(n):
    if li1[i] != li2[i]:
        count += 1
if count == 0 or count == 2:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n,k = map(int, input().split())
amari=n%k
n=min(amari, k-amari)
print(n)
# Judge status: Wrong Answer
n,m=map(int,input().split())
l=[[] for _ in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    l[a-1].append(b-1)
    l[b-1].append(a-1)

p=[0]*n
p[0]=1
now=1
while 0 in p:
    cnt=0
    for to in l[now-1]:
        if p[to]==0:
            p[to]=now
            cnt+=1
    if cnt==0:
        break
    now=to+1
if 0 in p:
    print("No")
else:
    print("Yes")
    for i in range(1,n):
        print(p[i])
# Judge status: Wrong Answer
number = int(input())
print(1000 - number % 1000)
# Judge status: Accepted
n,k = map(int,input().split())

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

ansl = []
used = [0 for i in range(n+1)]
now = 0
while True:
    if used[now] == 1:
        break
    ansl.append(now)
    used[now] = 1
    now = al[now] - 1

l = len(ansl)
last = ansl.index(now)
loop = ansl[last:]

if k < len(ansl):
    print(ansl[k] + 1)
else:
    k -= len(ansl)
    print(loop[k % len(loop)] + 1)
# Judge status: Accepted
c = input()

if c=="a" or c=="e" or c=="i" or c=="o" or c=="u":
  print("vowel")
else:
  print("consonant")
# Judge status: Wrong Answer
n=int(input())
c=0
for i in range(n):
    if len(str(i))%2==1:
        c+=1
print(c)
# Judge status: Accepted
n, k = map(int, input().split())
x = list(map(int, input().split()))
ans = 10**9
for l in range(n - k + 1):
    r = l + k - 1
    ans = min(ans, abs(x[r]) + abs(x[r]-x[l]), abs(x[l]) + abs(x[r]-x[l]))

print(ans)
# Judge status: Wrong Answer
n, m = map(int,input().split())
c = {}
for _ in range(m):
    p, y = map(int,input().split())
    if p in c:
        c[p] += 1
    else:
        c[p] = 1
cs = sorted(c.items(), key=lambda x:x[0])
for i in cs:
    for j in range(i[1]):
        print(str(i[0]).zfill(6) + str(j+1).zfill(6))
# Judge status: Accepted
n = int(input())
dic = {}

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

for a in A:
    if a in dic:
        dic[a] += 1
    else:
        dic[a] = 1

ans = 0

for key in dic:
    if dic[key] != key:
        if dic[key] > key:
            ans += dic[key] - key
        else:
            ans += dic[key]

print(ans)
# Judge status: Accepted
x, y = map(int,input().split())

cnt = 1
while True:
    x = x * 2
    if x > y:
        break
    cnt += 1
print(cnt)
# Judge status: Wrong Answer
n = list(str(input()))
if n[1]=="B":
    n[1]="R"
elif n[1]=="R":
    n[1]=="B"
print("".join(n))
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,k=map(int, input().split())
    l=list(map(int,input().split()))
    cnt=0
    if n<=k:
        print(1)
    else:

        while True:
            n-=k
            n+=1
            cnt+=1
            if n<=k:
                cnt+=1
                print(cnt)
                break
resolve()
# Judge status: Accepted
import itertools
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

s = int(input())
if s == 1 or s == 2:
  print(0)
elif s >= 3 and s <= 5:
  print(1)
else:
  ans = 1
  for i in range(2,1000):
    x = s - 3*i
    if x < 0:
      break
    ans += combinations_count(x + i - 1, x)
  print(ans % (10**9 + 7))
# Judge status: Accepted
n, k = map(int, input().split())
fruits = list(map(int, input().split()))

if n == 1:
    print(fruits[0])
else:
    fruits.sort()
    print(sum(fruits[:k]))
# Judge status: Accepted
#!/usr/bin/env python3

def main():
    n = int(input())
    ab = [list(map(int, input().split())) for i in range(n)]
    ans = 0
    for i in range(n):
        tmp = ans + ab[n - i - 1][0]
        cnt = tmp % ab[n - i - 1][1]
        if cnt:
            ans += ab[n - i - 1][1] - cnt

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
s, w = input().split()
print("unsafe" if int(w) > int(s) else "safe")
# Judge status: Accepted
N = int(input())    # N泊
K = int(input())    # 最初のK泊までは1泊当たりX円
X = int(input())
Y = int(input())    # K+1泊目以降は1泊当たりY円

if N - K > 0:
    total = (K * X) + ((N - K) * Y)
else:
    total = N * X

print(total)
# Judge status: Accepted
N = int(input())
p = list(map(int, input().split()))

cnt = 0

for i in range(1, N+1):
    if p[i-1]!=i:
        cnt += 1

if cnt==0 or cnt==2:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
s=input()
up=s[0:2]
bot=s[2:4]
bot_m=True
up_m=True
if bot == "00" or int(bot) > 12:
        bot_m=False
if up == "00" or int(up) > 12:
        up_m=False
if bot_m and up_m:
        print("AMBIGUOUS")
elif bot_m and not up_m:
        print("YYMM")
elif not bot_m and up_m:
        print("MMYY")
else:
        print("NA")
# Judge status: Accepted
s = input()

A = s.count("a")
B = s.count("b")
C = s.count("c")

if max(A,B,C) - min(A,B,C) <= 1:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
n,a,b,c,d=map(int,input().split())
s=input()
S=list(s)

flag=0
for i in range(n-1):
    if S[i]==S[i+1]=="#":
        flag=1;break

if flag:print("No");exit()

if c<d:print("Yes")
else:
    for i in s[b-1:d].split("#"):
        if len(i)>=3:print("Yes");exit()
    print("No")
# Judge status: Accepted
a,b,c=sorted(map(int,input().split()))
print('NYoe s'[a+b==c::2])
# Judge status: Accepted
s = input()
len_s = len(s)
c = 0
for _ in range(int(len_s/2)):
    if(s[_] != s[len_s-1-_]):
        c+=1
print(c)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
a.reverse()
cnt = 0
flag = a[0]

for i in range(1, n):
    if flag <= a[i]:
        cnt += 1
    else:
        flag = a[i]

if flag == 1:
    print(cnt)
else:
    print(-1)
# Judge status: Wrong Answer
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
dlist = []

for i in range(n):
    d = t - h[i] * 0.006 - a
    
    if d >= 0:
        dlist.append(d)
    else:
        d = -d
        dlist.append(d)
        
        
m = 0
for j in range(n):
    if dlist[j-1] <= dlist[j]:
        m = dlist[j-1]
    else:
        m = dlist[j]
        
print(dlist.index(m) + 1)
# Judge status: Wrong Answer
s=input()
ans="No"
for i in range(4):
    if s.count(s[i])==2:
        ans="Yes"
print(ans)
# Judge status: Accepted
N=int(input())
A,B=[],[]
for i in range(N):
  a,b=map(int,input().split())
  A.append(a)
  B.append(b)
  
A,B=map(sorted,(A,B))

if N % 2 == 1:
  mA, mB = A[N//2],B[N//2]
  print(mB-mA+1)
else:
  mA, mB = (A[N//2-1]+A[N//2])/2,(B[N//2-1]+B[N//2])/2
  print(int((mB-mA)/0.5+0.5)+1)
# Judge status: Wrong Answer
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

a, b, k = inintm()

if (b-a)/2 <= k:
    for i in range(a,b+1):
        print(i)
    exit()

l = b-k+1
cnt = 0

for i in range(a,b+1):
    cnt += 1
    l -= 1
    if cnt <= k:
        print(i)
    elif l <= k:
        print(i)
# Judge status: Wrong Answer
N,x=input().split()
X=int(x)
n=int(N)
y=0
A = [int(i) for i in input().split()]
A.sort()
for z in range(n):
  y+=A[z]
  if y>=X:
    print(z+1)
    break
# Judge status: Accepted
s=input()

if len(s)%2==1:
  print('No')
  exit()

print('Yes' if len(s)//2==s.count('hi') else 'No')
# Judge status: Wrong Answer
N = int(input())
power = 1
for i in range(N):
    power = power*(i+1)
    poewr = power % (10**9 + 7)
print(power)
# Judge status: Accepted
H,N=map(int, input().split())
A=list(map(int, input().split()))

s=sum(A)
if s>=H:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
k = int(input())
print( (k//2) * (k+1)//2 )
# Judge status: Accepted
N,K,S=map(int,input().split())
a=[10**9 if S==1 else S-1]*N
for i in range(K):a[i]=S
print(' '.join(map(str,a)))
# Judge status: Accepted
def main():
    s = "".join(sorted(input()))
    t = "".join(reversed(sorted(input())))
    print("Yes" if s < t else "No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
# スペース区切りの整数の入力
a, b = map(int, input().split())
# 判定
# 2で割った余りが0の時、Evenと出力
if (a * b)% 2 == 0:
  print('Even')
# 余りが0でないとき、Oddと出力
else:
  print('Odd')
# Judge status: Accepted
import sys

N,T = map(int,input().split())
d = [list(map(int,input().split())) for _ in range(N)]

for i in sorted(d):
    if i[1] <= T:
        print(i[0])
        sys.exit()
else:
    print('TLE')
# Judge status: Accepted
N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=False)
count = 0
for i in range(N):
    if x>=a[i]:
        count += 1
        x -= a[i]
    else:
        break
if (x!=0)and(count==N):
    count -= 1
print(count)
# Judge status: Accepted
import itertools
def main():
  a,b,x = map(int,input().split())
  print("YES" if a <= x and b >= (x-a) else "NO")
if __name__ == '__main__':
  main()
# Judge status: Wrong Answer
s = input()

print(max(s.count("1"), s.count("0")) * 2)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

b = [0 for _ in range(n+1)]

ans = 0
for i in range(n):
    if a[i] > n:
        ans += 1
    else:
        b[a[i]] += 1 

print(b)

for i in range(n+1):
    if b[i] > i: ans += b[i] - i
    if b[i] < i: ans += b[i]

print(ans)
# Judge status: Accepted
from collections import deque
K = int(input())
que = deque(list(range(1, 10)))
for i in range(K):
    x = que.popleft()
    last = x % 10
    if last != 0:
        que.append(x*10 + last-1)
    que.append(x*10 + last)
    if last != 9:
        que.append(x*10 + last+1)
print(x)
# Judge status: Wrong Answer
import collections
a = int(input())
li1 = []

for i in range(a):
    li1.append(str(input()))

c = collections.Counter(li1)

print(c.most_common()[0][0])
for i in range(1,len(c)):
    if( c.most_common()[0][1] == c.most_common()[i][1] ):
        print(c.most_common()[i][0])
# Judge status: Accepted
n = int(input())
x = [int(i) for i in input().split()]
y = sorted(x)
a = y[n // 2 - 1]
b = y[n // 2]
for i in x:
  if i <= a:
    print(b)
  elif i >= b:
    print(a)
# Judge status: Accepted
k=int(input())
if k%2==0:
  print(k*k//4)
else:
  print((k+1)*(k-1)//4)
# Judge status: Wrong Answer
import sys

input = sys.stdin.readline

N = int(input())
W = []
for _ in range(N):
    W.append(input().strip())

check = set(W[0])
flag = True
before = W[0][-1]
for i in range(1, N):
    if before != W[i][0] or W[i] in check:
        flag = False
        break
    else:
        before = W[i][-1]
        check.add(W[i])

if flag:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A,B=map(int,input().split())
answer=str(min(A,B))*max(A,B)
print(answer)
# Judge status: Accepted
def main():
  name = list(map(str,input().split()))
  num = list(map(int,input().split()))
  n = input()
  if n==name[0]:
    print(num[0]-1,num[1])
  else:
    print(num[0],num[1]-1)

main()
# Judge status: Accepted
import math
N = int(input())
A = [list(map(int,input().split())) for _ in range(N-1)]
A.insert(0,0)
for i in range(1,N):
    C,S,F = A[i]
    T = S+C
    j = i+1
    while j<N:
        C,S,F = A[j]
        T = max(S,math.ceil(T/F)*F)
        T += C
        j += 1
    print(T)
print(0)
# Judge status: Accepted
# coding:utf-8
d, t, s = map(int, input().split())
if d / s <= t:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import math
N = int(input())
ans = 0
if N%2 == 1:
    print(0)
else:
    for i in range(1, 21):
        ans += N//(10**i)
        for j in range(1, 27):
            if N >= (5**j)*(10**i):
                ans += math.ceil(N//((5**j)*10**i)/2)    
    print(ans)
# Judge status: Wrong Answer
from collections import defaultdict
def main():
    N = int(input())
    D = [int(x) for x in input().split()]
    dic = defaultdict(int)
    for i in D:
        dic[i] += 1

    if dic[0]!=1:
        print(0)
        exit()
    ans = 1
    for i in range(1,max(dic.keys())+1):
        ans *= dic[i-1]**dic[i]
    print(ans)    
if __name__ == '__main__':
    main()
# Judge status: Accepted
n = input()
l = len(n)
def su(x):
	return sum([int(i) for i in str(x)])
ans = su(n)
for j in range(1,l):
	pre = su(int(n[:j])-1)
	suf = (l-j)*9
	ans = max(ans,pre+suf)
print(ans)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

if abs(a-c)<=d or abs(a-b)<=d and abs(b-c)<=d:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

import fractions

L = [A[0]]
R = [A[-1]]

for i in range(1, N):
    L.append(fractions.gcd(L[i-1], A[i]))
    R.append(fractions.gcd(R[i-1], A[-(i+1)]))

R.reverse()


ans = 0

for i in range(N):
    if i == 0:
        ans = max(ans, R[1])
    elif i == N-1:
        ans = max(ans, L[-2])
    else:
        ans = max(ans, fractions.gcd(L[i-1], R[i+1]))
    
print(ans)
# Judge status: Accepted
import sys
def input():return sys.stdin.readline().strip()

def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    ans = 0

    for i in range(N-1):
        if A[i] >= 2:
            ans += A[i]//2
        if A[i]%2 == 1 and A[i+1] >= 1:
            ans += 1
            A[i+1] -= 1
    
    ans += A[N-1]//2
    print(ans)
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
S=input()
con=0
ans=0
for s in S:
  con=(con+1)*(s=="<")
  ans+=con
print(ans)
# 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: Wrong Answer
N = int(input())
sum=0
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
from itertools import product
pools = product(range(N),range(N),range(N))
for i, j ,k in pools:
  sum =sum + gcd(i, j, k)
print(sum)
# Judge status: Accepted
X = int(input())
theta, k = 0, 0
while theta % 360 != 0 or theta == 0:
    theta += X
    k += 1
print(k)
# Judge status: Accepted
import fractions
from functools import reduce

def gcd(n):
  return reduce(fractions.gcd, n)

N, X=map(int, input().split())
C=list(map(int, input().split()))

sub=[]
for c in C:
  sub.append(abs(c-X))

print(gcd(sub))
# Judge status: Accepted
def main():
    N = int(input())
    ans = 0
    for i in range(1, N+1):
        if i % 15 == 0:
            pass
        elif i % 3 == 0:
            pass
        elif i % 5 == 0:
            pass
        else:
            ans += i

    print(ans)
    return 0


if __name__ == '__main__':
    main()
# Judge status: Accepted
n,k=map(int,input().split())
cnt=1
n-=k
while n>0:
    n-=(k-1)
    cnt+=1
print(cnt)
# Judge status: Accepted
N = int(input())
L = []
for i in range(N):
    N, K = input().split()
    K = int(K)
    L.append([N, -K, i+1])
L.sort()
for i in L:
    print(i[2])
# Judge status: Accepted
a = list(map(int,input().split()))
dic = {}
for i in range(len(a)):
    dic.setdefault(a[i],0)
    dic[a[i]]+=1
print(len(dic))
# Judge status: Accepted
S = input()
ans = 0
count = 0
ACGT = ['A', 'C', 'G', 'T']
for i in range(len(S)):
    for j in range(i, len(S)):
        if all(ACGT.count(c) == 1 for c in S[i : j+1]):
            ans = max(ans, j-i+1)
print(ans)
# Judge status: Accepted
# coding: utf-8
right=list(input())
left=list(input())

count=0

for i in range(len(right)):
    if right[i]!=left[i]:
        count=count + 1
    else:
        continue

print(count)
# Judge status: Accepted
def resolve():
    A, B = list(map(int, input().split()))
    S = str(input())
    import re
    if S[A] != '-':
        print('No')
        return
    if re.match('[0-9]+', S[:A]) and re.match('[0-9]+', S[A+1:]):
        print('Yes')
        return

    print('No')


resolve()
# Judge status: Wrong Answer
a, b, c, k = map(int, input().split())
b, c = a + b, a + b + c
if k <= a:
    print(a)
elif a <= k <= b:
    print(a)
else:
    print(a - (k - b))
# Judge status: Wrong Answer
a=input()
b=input()
if b[::-1]==a:
  print("Yes")
else:
  print("NO")
# Judge status: Accepted
#!/usr/bin/env python3

A, B, C = sorted([int(x) for x in input().split(" ")])

if A % 2 == 0 or B % 2 == 0 or C % 2 == 0:
    ans = 0
else:
    ans = A * B

print(ans)
# Judge status: Wrong Answer
N = int(input())
count = 0
for C in range(0, N+1):
    for A in range(0, N-C+1):
        if A != 0 and (N-C)%A == 0:
            B = (N-C)/A
            if A*B-C == N:
                count += 1
print(count)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
B = []
ans = 10 ** 20
for i in range(N // 2 + 1):
  B.append(A.pop(0))
  ans = min(ans,abs(sum(B) - sum(A)))
print(str(ans))
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print('Yes' if (a>c and b<c) or (a<c and b<c) else 'No' )
# Judge status: Wrong Answer
n=int(input())


a=0
for i in range(0,26):
    for j in range(0,20):
        if 4*i+7*j==n:
            a+=1


if a==0:
    print("N0")
else:
    print("Yes")
# Judge status: Accepted
N=int(input())
H=list(map(int,input().split()))

move=0
move_max=0
h_before=0

for h in H:
    if h_before >= h:
        move += 1
    else:
        move = 0
        
    if move_max < move:
        move_max = move
        
    h_before = h
    
print(move_max)
# Judge status: Accepted
N,M = map(int, input().split())
a = map(int,input().split())
goukei = sum(a)

if N-goukei<0:
    r=-1
else:r = N-goukei
print(r)
# Judge status: Accepted
a = list(input().split())
print(a[0][0] + a[1][0] + a[2][0])
# Judge status: Accepted
k, s = map(int, input().split())
t = 0
for x in range(k + 1):
    for y in range(k + 1):
        if k >= s - x - y >= 0:
            t += 1
print(t)
# Judge status: Wrong Answer
a = int(input())
j = 0
for i in range(a + 1):
    if i%3!=0 and i%5!=0:
        print(i)
        j+=i
print(j)
# Judge status: Accepted
n = sorted(map(int, input().split()))
print(round((n[0] * n[1]) / 2))
# Judge status: Wrong Answer
s = input()
q = 'keyence'

j, cnt = 0, 0
flag = False
for i in range(len(s)):
    if s[i] == q[j]:
        j += 1
        if flag:
            cnt += 1
        if j == len(q) - 1:
            break
        flag = False
    else:
        flag = True

if i < len(s):
    cnt += 1

if j == len(q)-1 and cnt <= 1:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
import re
S = input()
print(len(S))
T = 'x'
for i in range(len(S) - 1):
  T = T + 'x'
print(T)
# Judge status: Wrong Answer
N, M, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
A.reverse()
B.reverse()
cnt=0
for i in range(N+M):
    if len(A)>0 and len(B)>0:
        if A[-1] > B[-1]:
            K -= B.pop()
        else:
            K -= A.pop()
    elif len(A)>0:
        K-=A.pop()
    elif len(B)>0:
        K-=B.pop()
    if(K<0):
        break
    cnt += 1
print(cnt)
# Judge status: Wrong Answer
S = input()
N = len(S)
rS = S[::-1]

cum = [0] * (N+1)
for i in range(N):
    cum[i+1] = (cum[i] + (int(rS[i]) * pow(10,i,2019)) % 2019) % 2019

ans = 0
from collections import Counter
c = Counter(cum)
for v in c.values(): ans += v-1

print(ans)
# Judge status: Accepted
n=int(input())
import numpy as np
while True:
  r=True
  #print(n)

  for ii in np.arange(2,n//2):
    #print(n//(ii+1),n/(ii+1))
    if n//(ii+1)==n/(ii+1):
      r=False
      break

  #exit()
  if r:
    print(n)
    exit()
  n+=1
# Judge status: Accepted
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n = int(input())
    l = list(map(int, input().split()))
    l.sort()
    res = 0
    for i in range(n):
        k = i
        for j in range(i+1, n):
            while(k < n and l[k] < l[i]+l[j]):
                k += 1
            res += k - (j+1)
    print(res)
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
a, b, k = map(int, input().split())
if (b - a + 1) <= 2 * k:
  for i in range(a, b + 1):
    print(i)
else:
  for i in range(a, a + k):
    print(i)
  for i in range(b - k + 1, b + 1):
    print(i)
# Judge status: Accepted
A, B, C = map(int, input().split())

if C >= A and C <= B:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
x=int(input())
print('YES' if x==7 or x==5 or x==3 else 'NO')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
Alice = sum(a[::2])
Bob = sum(a[1::2])
print(Alice - Bob)
# Judge status: Wrong Answer
A=input()
B=input()
C=input()
p="a"

while True:
  #print(A,B,C)
  
  if p=="a":
    if len(A)>=1:
      p=A[0]
      A=A[1:]
    else:
      break
  elif p=="b":
    if len(B)>=1:
      p=B[0]
      B=B[1:]
    else:
      break
  else:
    if len(C)>=1:
      p=C[0]
      C=C[1:]
    else:
      break
if len(A)==0:
  print("A")
elif len(B)==0:
  print("B")
else:
  print("C")
# Judge status: Wrong Answer

n = int(input())
dp = [[0 for _ in range(3)] for _ in range(n+1)]
ls  = [[1,2],[0,2],[0,1]]
for i in range(1,n+1):
    day = list(map(int,input().split()))
    dp[i][0] = day[0] + max(dp[i-1][1],dp[i][2])
    dp[i][1] = day[1] + max(dp[i-1][0],dp[i][2])
    dp[i][2] = day[2] + max(dp[i-1][0],dp[i][1])
print(max(dp[n]))
# Judge status: Accepted
x, y = map(int, input().split())
mlt = x
count = 0
while mlt <= y:
    count += 1
    mlt *= 2
print(count)