peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import math
import os
import random
import re
import sys

def check_non_decreasing_squares(n: int, a: list):
    p = a[0]
    for i in range(1, n):
        if a[i] > p:
            p = a[i]
        if p - a[i] == 1 or p - a[i] == 0:
            continue
        print("No")
        exit(0)
    print("Yes")

if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().rstrip().split()))
    check_non_decreasing_squares(n, a)
# Judge status: Wrong Answer
from math import factorial

n, m = [int(i) for i in input().split()]
mod = 10 ** 9 + 7

ans = 0
diff = abs(n - m)
if diff == 0:
    ans = (factorial(n) * 2) * 2 % mod
elif diff == 1:
    ans = factorial(n) * factorial(m) % mod
print(ans)
# Judge status: Accepted
a,b = map(str,input().split())
a1 = a*int(b)
b1 = b*int(a)
print(min(a1,b1))
# Judge status: Accepted
N = int(input())
if N % 2 == 0:
    print(0.5)
else:
    print((N+1)/(2*N))
# Judge status: Wrong Answer
a,b,c,k=map(int,input().split())

if int(a) >= int(k):
  print(int(a))
elif int(a + b) >= int(k):
  print(int(a))
else:
  print(int(a - (k-a-b)))
# Judge status: Accepted
a,b,c = map(int,input().split())
ans = 'NO'
 
for i in range(1,b+1):
  if (a*i)%b == c:
    ans = 'YES'
    break
    
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
A = [list(map(int,input().split())) for i in range(m)]

ma = 0
mi = float("INF")
for i in range(0,m):
    ma = max(ma,A[i][0])
    mi = min(mi,A[i][1])

ans = mi-ma+1
if ans >0:
  print(ans)
else :
  print(0)
# Judge status: Accepted
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
num = 0
dif = 10000000

for n in range(N):
  C = T-H[n]*0.006
  if dif > abs(A-C):
    dif = abs(A-C)
    num = n+1
    
print(num)
# Judge status: Accepted
import bisect
N, K = [int(i) for i in input().split()]
xs = [int(i) for i in input().split()]

ans = []
bisect.insort_left(xs, 0)
for l in range(len(xs)):
    if l+K < len(xs):
        xl = xs[l]
        xr = xs[l+K]
    elif l-K > -1:
        xl = xs[l-K]
        xr = xs[l]
    else:
        continue

    tmp1 = abs(xl) + abs(xr-xl)
    tmp2 = abs(xr) + abs(xr-xl)
    ans.append(min(tmp1, tmp2))

print(min(ans))
# Judge status: Accepted
s = input()
key = "keyence"
l = len(key)
if s[:l] == key or s[-l:] == key:
	print("YES")
	exit()
for i in range(l):
	if s[:i] == key[:i] and s[-(l-i):] == key[-(l-i):]:
		print("YES")
		exit()
else:
	print("NO")
# Judge status: Accepted
n = int(input())
a = [1,2,3,5,6,9,10,13,17]
if n in a:
  print('No')
else:
  print('Yes')
# Judge status: Accepted
N = int(input())
data = []
for _ in range(N):
    A, B = map(int, input().split())
    data.append([B, A])
data.sort()

prefix_cost = []
current_cost = 0
for i in range(N):
    current_cost += data[i][1]
    prefix_cost.append(current_cost)

for i in range(N):
    if not prefix_cost[i] <= data[i][0]:
        print('No')
        exit()

print('Yes')
# Judge status: Accepted
import sys

input = sys.stdin.readline

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

cnt = [0] * N

for a in A:
    cnt[a - 1] += 1

combination = [0] * N

for a in A:
    combination[a - 1] = cnt[a - 1] * (cnt[a - 1] - 1) // 2

total = sum(combination)

for a in A:
    c = combination[a - 1]
    b = cnt[a - 1]
    ans = total - c + c * (b - 2) // b
    print(ans)
# Judge status: Accepted
a,b = map(int,input().split())
print(a if a<=b else a-1)
# Judge status: Accepted
x = list(map(int, input().split()))
count = 0
a = 0
while a+1 < x[1]:
  a += (x[0]-1)
  count += 1
print(count)
# Judge status: Wrong Answer
def resolve():
    N, Y = map(int, input().split())
    if Y % 1000 != 0 or Y > 10000 * N:
        print("-1 -1 -1")
        return
    b10k = Y // 10000
    Y -= b10k * 10000
    b5k = Y // 5000
    Y -= b5k * 5000
    bk = Y // 1000
    print("-1 -1 -1") if b10k + b5k + bk > N else print(b10k, b5k, bk)


if __name__ == "__main__":
    resolve()
# Judge status: Accepted
print('abcdefghijklmnopqrstuvwxyz'['abcdefghijklmnopqrstuvwxyz'.index(input())+1])
# Judge status: Wrong Answer
n,m = map(int, input().split())
h = [0]
h.extend([int(i) for i in input().split()])
bld = [0]*(n+1)

for i in range(m):
  a,b = map(int, input().split())
  if h[a]>h[b]:
    bld[b] += 1
  elif h[a]<h[b]:
    bld[a] += 1
    
print(bld.count(0)-1)
# Judge status: Accepted
a = list(map(int,input().split()))

print(a[0]*a[1] if a[0] <= 9 and a[1] <= 9 else -1)
# Judge status: Accepted
N,Q=map(int,input().split())
S=input()
AC=[0]*N

cnt=0
for i in range(N-1):
    if S[i]+S[i+1]=='AC':
        AC[i]=cnt
        cnt+=1
        AC[i+1]=cnt
    else:
        AC[i],AC[i+1]=cnt,cnt

for _ in range(Q):
    l,r=map(int,input().split())
    print(AC[r-1]-AC[l-1])
# Judge status: Accepted
def main():
    num = int(K)
    if num >= len(S):
        print(S)
    else:
        print(S[:num]+'...')

K = int(input())
S = input()

main()
# Judge status: Wrong Answer
n = int(input())
ans = n

for i in range(1, n+1):
    j = n-i

    a = j
    p = 0
    while a>0:
        p += a%6
        a = a//6

    b = i
    q = 0
    while b>0:
        q += b%9
        b = b//9

    ans = min(ans, p+q)

print(ans)
# Judge status: Accepted
a,b,x=map(int,input().split())
temp1=(b//x)+1
if 0<=a-1:
  temp2=((a-1)//x)+1
else:
  temp2=0
print(temp1-temp2)
# Judge status: Accepted
n = int(input())
while True:
    if n%111 == 0:
        print(n)
        break
    n += 1
# Judge status: Wrong Answer
s=input()
for x in s:
    if s.count(x)==1:
        print("yes")
        break
else:
    print("no")
# Judge status: Wrong Answer
X, Y, A, B, C = map(int, input().split())
Ap = list(map(int, input().split()))
Bq = list(map(int, input().split()))
Cr = list(map(int, input().split()))

Ap.sort()
Bq.sort()

print(Ap[A-X:] + Bq[B-Y:] + Cr)

print(sum(sorted(Ap[A-X:] + Bq[B-Y:] + Cr)[C:]))
# Judge status: Accepted
n = int(input())
a = 26
keta = 1
nn = 0
while n > 0:
    if n > a:
        keta += 1
        n -= a
        a *= 26
    else:
        nn = n - 1
        n -= a
#nnを桁数をketaとして26進法で表す
l = []
for i in range(keta):
    amari = nn % 26
    nn = nn // 26
    l.append(amari)
revl = []
for i in range(len(l)-1,-1,-1):
    revl.append(l[i]+97)
ansl = []
for i in revl:
    ansl.append(chr(i))
print("".join(ansl))
# Judge status: Wrong Answer
n = int(input())
a_char = input().split(" ")


a_char.sort(reverse=True)

fugo=1
sum = 0
for i in range(0, n):
    sum += (int(a_char[i]) * fugo)
    fugo = fugo * -1

print(sum)
# Judge status: Accepted
original = input()
new = input()
num = len(original)
ans = "Yes"

for i in range(num):
  if original[i] != new[i]:
    ans = "No"
    break
print(ans)
# Judge status: Accepted
n, l = map(int, input().split())
a = []
for i in range(l, n + l):
    a.append(i)
if a[0] > 0:
    b = a.pop(0)
elif a[n - 1] < 0:
    b = a.pop(n - 1)
else:
    for j in range(n):
        if a[j] == 0:
            b = a.pop(j)
            break
print(sum(a))
# Judge status: Accepted
n,x,t = map(int,input().split())
if n%x == 0:
    print(n//x*t)
else:
    print((n//x+1)*t)
# Judge status: Wrong Answer
import math
a=0
b=3
answer = 0

#偶数2
if a != 0:
    answer += math.factorial(a) / (math.factorial(a - 2)*2)

#奇数2
if b != 0:
    answer += math.factorial(b) / (math.factorial(b - 2)*2)

print(int(answer))
# Judge status: Accepted
N,K=map(int,input().split())
x=list(map(int,input().split()))
ans=0
j=0
for i in range(N):
  if i==K-1:
    ans=min(abs(x[K-1]-x[0])+abs(x[K-1]),abs(x[K-1]-x[0])+abs(x[0]))
  elif i>=K:
    bns=min(abs(x[i]-x[i-K+1])+abs(x[i]),abs(x[i]-x[i-K+1])+abs(x[i-K+1]))
    ans=min(ans,bns)
print(ans)
# Judge status: Accepted
X,Y = map(int,input().split())
count = 0
A = X
while(A<=Y):
    count+=1
    A *= 2
print(count)
# Judge status: Wrong Answer
line = input().split(' ')
if (int(line[0])+int(line[1]))%3 == 0:
  print("Possible")
else:
  print("Impossible")
# Judge status: Accepted
a,b,c = map(int,input().split())

if a-b>=c:
    print(0)
else:
    print(c-(a-b))
# Judge status: Accepted
import sys

input = sys.stdin.readline

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

if A < 10 and B < 10:
    print(A*B)
else:
    print(-1)
# Judge status: Accepted
K, X = map(int, input().split())
List=[]
i=X-K+1
while i<=X+K-1:
    if i < -1000000 or i>1000000:
        pass
    else:
        List.append(i)
    i+=1
    
print(*List)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
if a == b and b == c:
  print("No")
elif a != b and b != c:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())


N = I()
CSF = [tuple(MI()) for i_ in range(N-1)]

for i in range(N):
    time = 0
    for j in range(i,N-1):
        c,s,f = CSF[j]
        if time < s:
            time = s
        else:
            time = s+f*((time-s+f-1)//f)
        time += c
    print(time)
# Judge status: Accepted
a,b=[int(x) for x in input().split()]
k=(a+b)//2
if (a+b)%2==0:
  print(k)
else:
  print("IMPOSSIBLE")
# Judge status: Accepted
N = int(input())
t = [0 for _ in range(N + 10)]
x = [0 for _ in range(N + 10)]
y = [0 for _ in range(N + 10)]
res = 'Yes'
for i in range(N):
  t[i], x[i], y[i] = map(int, input().split(' '))
for i in range(N):
  if abs(x[i]) + abs(y[i]) <= t[i] and (abs(x[i]) + abs(y[i])) % 2 == t[i] % 2:
    x[i + 1] -= x[i]
    y[i + 1] -= y[i]
    t[i + 1] -= t[i]
  else:
    res = 'No'
    break
print(res)
# Judge status: Accepted
import heapq
n,m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x: x*(-1), A))
heapq.heapify(A)

while m > 0:
    x = heapq.heappop(A)*(-1)
    x //= 2
    A.append(-x)
    m -= 1
print(abs(sum(list(A))))
# Judge status: Accepted
n = int(input())

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

c = 0
for i in range(n):
    ai = a[i]
    bi = b[i]
    if ai < bi:
        c += (bi-ai)//2
    else:
        c -= (ai-bi)
print('Yes' if c >= 0 else 'No')
# Judge status: Accepted
N=input()
for i in range(len(N)):
    if N.count(N[i])%2==0:
        if i==len(N)-1:
            print("Yes")
        continue
    else:
        print("No")
        break
# Judge status: Wrong Answer
if __name__ == '__main__':
    a,b= map(int,input().split())
    maxnum =0
    minnum =0

    for i in range(0,b):
        minnum+=i
    for i in range(0,b):
        maxnum+=(a-i)
    ans = maxnum-minnum
    ans = int(ans*(ans+1)/2)

    print(ans)
# Judge status: Wrong Answer
S = str(input())

if S.endswith('s'):
  S += "es"
else:
  S += "s"
# Judge status: Accepted
S = input()

Q = int(input())

from collections import deque
ans = deque()

for s in S:
    ans.append(s)

rev = False
for _ in range(Q):
    q = input().split()
    if q[0] == "1":
        rev = not rev
    else:
        is_right = (q[1] =="2") ^ rev
        if is_right:
            for s in q[2]:
                ans.append(s)
        else:
            for s in q[2]:
                ans.appendleft(s)
if rev:
    ans.reverse()
print("".join(ans))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
B = A[::-1]
C = N-1
ans = 0
if N%2 == 0:
  ans += B[0]
  for i in range(N//2-1):
    ans += 2*B[i+1]
else:
  ans += B[0]
  ans += B[N//2]
  for i in range(N//2-1):
    ans += 2*B[i+1]
print(ans)
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))

dp = [-1] * n
dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2, n):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))

print(dp[n-1])
# Judge status: Accepted
p = 2019
s = list(map(int, list(input())))[::-1]

sum = 0
cnt = [0] * p
cnt[0] = 1
n = len(s)
for i in range(n):
    d = s[i] * pow(10, i, p)
    sum = (sum + d) % p
    cnt[sum] += 1

ans = 0
for i in range(p):
    ans += cnt[i] * (cnt[i]-1) // 2


print(ans)
# Judge status: Wrong Answer
from math import pi
from math import cos
from math import sqrt


a, b, h, m = map(int, input().split())
h *= 5
dist = abs(h - m)
ang = 2 * pi / 60 * dist + m / 60 * pi / 6

res = sqrt(a**2 + b**2 - 2 * a * b * cos(ang))
print(res)
# Judge status: Accepted
# C - Marks


def marks(n, k, a):
    results = []
    for i in range(n - k):
        if a[i] < a[i + k]:
            results.append("Yes")
        else:
            results.append("No")
    return results


if __name__ == "__main__":
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    results = marks(n, k, a)
    for i in results:
        print(i)
# Judge status: Accepted
A, s, C = input().split()
A = A[0]
s = s[0]
C = C[0]
print(A + s + C)
# Judge status: Wrong Answer
s, t = input().split()
print(s,t,sep='')
# Judge status: Accepted
A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if ((500*i)+(100*j)+(50*k))==X:
                count+=1

print(count)
# Judge status: Wrong Answer
a = int(input())
b= int(input())
c = int(input())
x = int(input())

pattern = 0

for i in range(a+1):
    if x-500*i==0:
        pattern+=1
    for j in range(b+1):
        if x-500*i-100*j==0:
            pattern+=1
        for k in range(c+1):
            if x-500*i-100*j-50*k==0:
                pattern+=1

print(pattern)
# Judge status: Wrong Answer
a=[]
a=input().split()
for i in range(0,4):
 if a[i]=='0':
  print(i)
 else:
  pass
# Judge status: Accepted
import fractions

A, B, C = map(int, input().split())
gcd = fractions.gcd(A, B)

if gcd == 1 and C != 0 or gcd != 1 and fractions.gcd(gcd, C) != 1:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n, m = nm()
    X = nl()
    if n >= m:
        print(0)
    else:
        X = sorted(X)
        D = [X[i + 1] - X[i] for i in range(m - 1)]
        D = sorted(D)
        print(sum(D[:-n + 1]))


if __name__ == '__main__':
    main()
# Judge status: Accepted
S=input()
d0=0
d1=0
for i in range(len(S)):
    d0+=int(S[i])!=i%2
    d1+=int(S[i])!=(i+1)%2
print(min(d0,d1))
# Judge status: Accepted
import sys 
X,Y = map(int, input().split())
for i in range(X+1):
    for j in range(X+1):
        if (((2*i) + (4*j)) == Y) or (((2*j) + (4*i)) == Y):
            if (i+j == X):
                print("Yes")
                sys.exit()
print("No")
# Judge status: Wrong Answer
n, W = map(int, input().split())

dp = [[float('inf') for _ in range(W+1)] for _ in range(n+1)]
dp[0][0] = 0

for i in range(n):
    w, v = map(int, input().split())
    for j in range(W+1):
        dp[i+1][j] = dp[i][j]
        if j-w >= 0:
            dp[i+1][j] = min(dp[i][j], v+dp[i][j-w])

ans = 0
for val in dp[-1]:
    if val == float('inf'): continue
    else: ans = max(ans, val)
print(ans)
# Judge status: Accepted
n = int(input())
arr = list(map(int, input().split()))
res, i = 0, 0
while i < n:
    j = i
    while j < n-1 and arr[j]>=arr[j+1]:
        j += 1
    res = max(res, j-i)
    i = j+1
print(res)
# Judge status: Accepted
h = int(input())
T = [[h,1]]
s = 0

l = 10**6 + 3
A = [0] * l
A[1] = 1
for i in range(2, l):
    A[i] = 1 + A[i//2] * 2
a = 0
while s < len(T):
    if T[s][0] >= l:
        T.append([T[s][0]//2, T[s][1]*2])
        a += T[s][1]
        T[s] = [0,0]

    s += 1

# print(T)


for i in range(len(T)):
    a += A[T[i][0]] * T[i][1]
print(a)
# Judge status: Accepted
w,h,x,y=map(int,input().split())
if x==w/2 and y==h/2:
  print("{} {}".format(w*h/2,1))
else:
  print("{} {}".format(w*h/2,0))
# Judge status: Wrong Answer
S = input('Day of the week')
print()
if S== 'SUN':
    print(7)
if S == 'MON':
    print(6)
if S == 'TUE':
    print(5)
if S == 'WED':
    print(4)
if S == 'THU':
    print(3)
if S == 'FRI':
    print(2)
if S == 'SAT':
    print(1)
# Judge status: Wrong Answer
s = input()
for i in range(len(s) - 1):
    if s[i] == s[i + 1]:
        judge = 'Yes'
        break
    judge = 'No'
print(judge)
# Judge status: Accepted
#https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_c
# -*- coding: utf-8 -*-
import math
from decimal import *
a,b,c = map(int, input().split())
if Decimal(a).sqrt() + Decimal(b).sqrt() <  Decimal(c).sqrt():
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,m=map(int, input().split())
    if n==1 and m==1:
        ans=1
    # n,m=1,1を除外してるからどっちか１だったら他方の-2でok
    elif m==1 or n==1:
        ans=max(n,m)-2
    else:
        ans=(n-2)*(m-2)
    print(ans)
resolve()
# Judge status: Accepted
A,B = map(int,input().split())
print('Yay!' if A<=8 and B<=8 else ':(')
# Judge status: Accepted
s = input()

counter = 0
if s[0] == "1":
    counter += 1
if s[1] == "1":
    counter += 1
if s[2] == "1":
    counter += 1

print(counter)
# Judge status: Accepted
N = int(input())
li = []
for i in range(N):
  s = int(input())
  li.append(s)
  
new = sorted(li, reverse=True)

s = max(li)
for index, i in enumerate(li):
  if s == li[index]:
    print(new[1])
  else:
    print(new[0])
# Judge status: Accepted
import random
d = int(input())
c = list(map(int, input().split()))
s = []
for i in range(d):
  s = list(map(int, input().split()))
  print(1+s.index(max(s)))
# Judge status: Wrong Answer
n=int(input())
if n < 1000:
    print("ABC"+str(n).zfill(3))
else:
    print("ABD"+str(n-999).zfill(3))
# Judge status: Wrong Answer
L,R = map(int, input().split())
dif = 2019 if R-L+1 > 2019 else R-L+1
ans = [0]*dif
index = 0
for i in range(L, L+dif):
  ans[index] = i%2019
  index += 1
ans.sort()
print(ans[0]*ans[1])
# Judge status: Accepted
import math
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())
n = ii()
a = li()
b = [0]*(n+10)
for i in range(n-1):
    b[a[i]-1]+=1
for i in range(n):
    print(b[i])
# Judge status: Accepted
S = input()

ans = "WA"

if S[0] != "A":
  print(ans)
  
else:
  if S[2:len(S) - 1].count("C") != 1:
    print(ans)
  else:
    s = S.index("C")
    SS = S[1:s] + S[s + 1:]
    if SS.islower() == False:
      print(ans)
    else:
      print("AC")
# Judge status: Wrong Answer
n,r=map(int,input().split())
if n<10:
    r-=100*(10-n)
print(r)
# Judge status: Wrong Answer
a = input()
b = input()
c = len(a)
d = list(a)
e = list(b)

count = 0

for i in range(c):
    if d[i] == e[i]:
        count += 1
        
print(count)
# Judge status: Wrong Answer
a,b = map(int,input().split())
s = input()
if len(s) == a + b + 1:
    if s[a] == "-":
        s = s.replace("-","")
        if s.isdecimal():
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")
# Judge status: Accepted
X, K, D = map(int, input().split())

ans = None

if K*D <= abs(X):
    print(abs(X)-abs(K*D))
else:
    times0 = abs(X) // D
    X = abs(X) - times0 * D
    K -= times0
    if K % 2 == 0:
        print(X)
    else:
        print(abs(X-D))
# Judge status: Accepted
import sys

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


def main():
    N, D = map(int, readline().split())

    x = 2 * D + 1

    print((N + x - 1) // x)


if __name__ == '__main__':
    main()
# Judge status: Accepted
from itertools import combinations_with_replacement

N, M, Q = list(map(int, input().split()))
num_list = [list(map(int, input().split())) for _ in range(Q)]

m_range = list(range(1, M+1))
max_point = 0
for array in combinations_with_replacement(m_range, N):
    point = 0
    for (a, b, c, d) in num_list:
        if array[b-1] - array[a-1] == c:
            point += d
    max_point = max(max_point, point)
print(max_point)
# Judge status: Wrong Answer
S, W = map(int, input().split())
if S >= W:
    print("unsafe")
else:
    print("safe")
# Judge status: Wrong Answer
n = input()
ans = []
for c in n:
    c = int(c)
    if c == 0:
        continue
    num = c * 111
    if num >= int(n):
        ans.append(num)

print(min(ans))
# Judge status: Accepted
N = int(input())
S = []
for _ in range(N):
    S.append(input())
print(len(set(S)))
# Judge status: Wrong Answer
x,y = map(int,input().split())
c = x * 2
for _ in range(x):
  if c == y:
    print("Yes")
    quit()
  elif c > y:
    print("No")
    quit()
  c += 2
print("No")
# Judge status: Accepted
n=int(input())
print(n//2+n%2)
# Judge status: Wrong Answer
k = int(input())

lis = []

while len(lis) <= k:
    test = 1
    if test < 10:
        lis.append(test)
    else:
        for i in range(len(str(test)) - 1):
            truf = True
            if not abs(str(test)[i] - str(test)[i+1]) <= 1:
                truf = False
                break
            if truf:
                lis.append(test)

print(lis[k])
# Judge status: Accepted
A = list(map(int,input().split()))
A.sort()
print(A[0]+A[1])
# Judge status: Wrong Answer
N = int(input())
c = (N+1)//2
ans = 0
for i in range(1,N-c+1):
    ans += i*(1+N//i)*(N//i)/2
ans += N*c -(c+1)*c/2
print(int(ans))
# Judge status: Accepted
#!/usr/bin/env python3
n = int(input())
s = input()
l = 0
r = n - 1
cnt = 0
while l < r:
    if s[l] == "R":
        l += 1
    elif s[r] == "W":
        r -= 1
    else:
        cnt += 1
        l += 1
        r -= 1
print(cnt)
# Judge status: Wrong Answer
x,a,b = map(int,input().split())

if abs(a-x) > abs(b-x):
    print("A")
else:
    print("B")
# Judge status: Accepted
(x, y, a, b, c), p, q, r = [map(int, o.split()) for o in open(0)]
print(sum(sorted(sorted(p)[-x:] + sorted(q)[-y:] + list(r))[-x-y:]))
# Judge status: Wrong Answer
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    print(a[0]*a[1]/2)
# Judge status: Wrong Answer
import sys
c= [list(map(int, input().split())) for i in range(3)]
csum=[0]*3
for a1 in range(100):
  if (a1-(sum(c[0])-sum(c[1]))/3)>=0 and (a1-(sum(c[0])-sum(c[2]))/3)>=0:
    for b1 in range(100):
      for k in range(3):
        csum[k]=c[0][k]+c[1][k]+c[2][k]
      if (b1-(csum[0]-csum[1])/3)>=0 and (b1-(csum[0]-csum[2])/3)>=0:
        print('Yes')
        sys.exit(0)
print('No')
# Judge status: Accepted
A,B = [int(i) for i in input().split()]

if A == 1:
    A = 14
if B == 1:
    B = 14

if A > B:
    print('Alice')
elif A < B:
    print('Bob')
elif A == B:
    print('Draw')
# Judge status: Accepted
K, S = map(int, input().split())

c = 0
for x in range(K + 1):
    if x > S:
        break
    for y in range(K + 1):
        if x + y > S:
            break
        z = S - x - y
        if 0 <= z <= K:
            c += 1

print(c)
# Judge status: Wrong Answer
# coding: utf-8
# Your code here!

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

sum = 0
B = []
B.append(0)

for t in range(N):
    B.append(A[t] + B[t])
    
B.remove(0)
    
print(B)
    
for i in range(N):
    sum += A[i] * (B[N-1] - B[i])
            
        
print(sum % (10**9+7))
# Judge status: Accepted
c=open(0).read().count
for s in'AC','WA','TLE','RE':print(s,'x',c(s))
# Judge status: Accepted
print("YNeos"[tuple(map(int, input().split())) != tuple(map(len, input().split("-")))::2])
# Judge status: Accepted
# -*- coding: utf-8 -*-

s=set(list(input()))

if ('N' in s)==('S' in s) and ('W' in s)==('E' in s):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from math import sqrt
X = int(input())
c = 1
for b in range(1,int(sqrt(X)+1)):
    for p in range(2,X):
        if b**p<=X: c = max(c,b**p)
print(c)
# Judge status: Wrong Answer
S = input()

count_r = 0
count_s = 0
tmp = 0
for i,s in enumerate(S):
  if(s == "R"):
    count_r +=1
  if(s=="S"):
    count_s += 1
    tmp = count_r
    
print(tmp)
# Judge status: Accepted
print("bust") if sum(list(map(int, input().split()))) >= 22 else print("win")
# Judge status: Accepted
mod=10**9+7
l,a,b=map(int,input().split())
def C(n,k,m):
  g=k
  f=n
  for i in range(1,k):
    n=n*(f-i)%m
    k=k*(g-i)%m
  return (n*pow(k,m-2,m))%m
ans=pow(2,l,mod)-1
ca=C(l,a,mod)
cb=C(l,b,mod)
print((ans-ca-cb)%mod)
# Judge status: Accepted
N = int(input())

if N % 2 == 0:
  ans = (N//2) / N
else:
  ans = ((N//2)+1) / N

print(ans)