peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
# -*- coding: utf-8 -*-
N = input()
ans = 0
for i in N:
    ans += int(i)
    ans = ans % 9
if ans == 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n=int(input())

ans=[]
s=0
for i in range(1,n+1):
    s+=i
    ans.append(i)
    if s>=n:
        break

if s==n:
    for a in ans:
        print(a)
else:
    ans.remove((s-n))
    for a in ans:
        print(a)
# Judge status: Accepted
#d
n=int(input())
c=input()
rr=c.count('R')
ans=0
for i in range(rr):
    if c[i]=='W':
        ans+=1
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
N,T = [int(i) for i in input().split()]
minc = 100000
for i in range(N) :
    c,t = [int(i)for i in input().split()]
    if t > T :
        continue
    else :
        minc = min(minc,c)
if minc == 100000 :
    print("TLE")
else :
    print(minc)
# Judge status: Wrong Answer
# C - Splitting Pile
N = int(input())
A = list(map(int,input().split()))

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

ans = 10**10
for i in range(1,N):
    diff = abs((s[N-1] + A[-1] - s[i]) - s[i])
    ans = min(ans,diff)
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
List=[]
for i in range(m):
    a,b=map(int,input().split())
    List.append([a,b])
    List.append([b,a])
ans=0
for i in range(1,n+1):
    for j in range(len(List)):
        if i==List[j][0]:
            ans+=1
    print(ans)
    ans=0
# Judge status: Accepted
n=int(input())
s=input()
t=input()
if s==t:
    print(n)
    exit()
for i in range(n):
    if s[i:]==t[:-i]:
        print(n+i)
        exit()
print(n*2)
# Judge status: Accepted
K, S = map(int, input().split())
a = 0
for x in range(K+1):
  for y in range(K+1):
    if 0<=S-x-y<=K :
      a+=1   
print(a)
# Judge status: Accepted
A = input()

def bfs(i, f):
    if i == 3:
        if eval(f) == 7:
            print(f+'=7')
            exit()
        else:
            return None
    bfs(i+1, f+'+'+A[i+1])
    bfs(i+1, f+'-'+A[i+1])
    return None

print(bfs(0, A[0]))
# Judge status: Accepted
s = list(input())
k = int(input())
n = len(s)
for i in range(n-1):
    d = (ord('z')-ord(s[i])+1)%26
    if d<=k:
        s[i] = 'a'
        k -= d

x = ord(s[-1])+k%26
if x>ord('z'):x-=26
s[-1] = chr(x)


print(''.join(s))
# Judge status: Accepted
import math
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
    s=str(i)
    tmp=0
    for k in range(len(s)):
        tmp+=int(s[k])
    if tmp>=a and tmp<=b:
        ans+=i
print(ans)
# Judge status: Accepted
N = int(input())
P = [ int(s) for s in input().split() ]
P_S = sorted(P)
 
if sum(map(lambda x: x[0] != x[1], zip(P,P_S))) <= 2:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n = int(input())
gacha = []

for i in range(n):
  gacha.append(input())

import collections
c = collections.Counter(gacha)  
  
print(len(c))
# Judge status: Accepted
N,A,B = map(int,input().split())
W = N // (A+B)
if N - W*(A+B) <= A:
    print(W*A + N-W*(A+B))
else:
    print(W*A + A)
# Judge status: Wrong Answer
A, B, K = map(int, input().split())
limit = min(A, B)
ans = limit
count = 0

for i in range(1, limit + 1):
    if A % i == 0 and B % i == 0:
        count += 1
        if count == K:
            ans = i
            break

print(ans)
# Judge status: Wrong Answer
a, b = input().split(' ')
c = int(a)
d = int(b)

if d%c == 0:
  print(str(d//c))
else:
  print(str(d//c+1))
# Judge status: Accepted
from collections import *

# def solve():


# for _ in range(int(input())):
#     solve()
n = int(input())
l = []
for i in range(n):
    l.append(input())

print("AC x",l.count("AC"))
print("WA x",l.count("WA"))
print("TLE x",l.count("TLE"))
print("RE x",l.count("RE"))
# Judge status: Accepted
a=int(input())
print(a*800-(a//15)*200)
# Judge status: Accepted
N,K = map(int,input().split())
A = sorted([list(map(int,input().split())) for _ in range(N)],key=lambda x:x[0])
cnt = 0
i = 0
while i<N:
    a,b = A[i]
    if cnt+b<=K:
        cnt += b
    else:
        break
    i += 1
if cnt==K:
    print(A[i-1][0])
else:
    print(A[i][0])
# Judge status: Accepted
h, n = map(int, input().split())
a = list(map(int, input().split()))
if sum(a) >= h:
   print("Yes")
else:
   print("No")
# Judge status: Accepted
import sys
read_=sys.stdin.buffer.readline

N=int(read_())
A=[list(map(int,read_().split())) for _ in range(2)]

D=[[0]*N for _ in range(2)]

D[0][0]=A[0][0]
D[1][0]=A[0][0]+A[1][0]

for i in range(2):
    if i==0:
        for j in range(1,N):
            D[i][j]=D[i][j-1]+A[i][j]
        continue
    for j in range(1,N):
        D[i][j]=max(D[i][j-1],D[i-1][j])+A[i][j]

print(D[1][N-1])
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
from collections import deque
d = deque()


if len(a) %2 == 0:
    d.extend(a[::2])
    d.extendleft(a[1::2])
else:
    d.extend(a[1::2])
    d.extendleft(a[::2])
print(*list(d))
# Judge status: Wrong Answer
S = list(input())
s = 0
num = 0
ans = 0
for i in range(len(S)):
    if i < num:
        continue
    for j in range(1,len(S)-i):
        if S[i:i+j] != s:
            s = S[i:i+j]
            num = i+j
            ans += 1
            break
print(ans+1)
# Judge status: Accepted
import bisect
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans=0
for i in range(n):
  temp1=bisect.bisect_left(a,b[i])
  temp2=bisect.bisect(c,b[i])
  ans=ans+temp1*(n-temp2)
print(ans)
# Judge status: Accepted

import math

x=input()
y=input()
flag=True
if(x[0]!=y[2]):
    flag=False
elif(x[2]!=y[0]):
    flag=False
elif(x[1]!=y[1]):
    flag=False
if(flag):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
a,b,k=map(int,input().split())
ans=[]
i=0
while i<k and a+i<=b-i:
  ans.append(a+i)
  ans.append(b-i)
  i=i+1
ans=list(set(ans))
ans.sort()
for i in range(0,len(ans)):
  print(ans[i])
# Judge status: Accepted
n=int(input())
ans=0
for i in range(1,int((n**0.5)+1)):
  if n%i==0: 
    ans=i
print(int(-2+ans+n/ans))
# Judge status: Accepted
a = list(map(int,input().split()))
ans = 0
if a[0]>a[1]:
  ans += a[0]
  a[0] -= 1
else:
  ans += a[1]
  a[1] -= 1
if a[0]>a[1]:
  ans += a[0]
else:
  ans += a[1]
print(ans)
# Judge status: Accepted
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

s = input()
print(s[:3])
# Judge status: Accepted
N=int(input())
A=[]
for i in range(N):
    A.append(int(input()))

ans=0
for i in range(N-1):
    x=A[i]
    ans+=x//2
    if x%2==1 and A[i+1]>=1:
        ans+=1
        A[i+1]-=1

ans+=A[N-1]//2
print(ans)
# Judge status: Wrong Answer
n = int(input())

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

l.sort()

ans = 0
if n <3:
  print(0)
else:
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        if l[i] + l[j] > l[k]:
          ans += 1
  print(ans)
# Judge status: Accepted
s = int(input())
if 400 <= s <= 599:
    print("8")
elif 600 <= s <= 799:
    print("7")
elif 800 <= s <= 999:
    print("6")
elif 1000 <= s <= 1199:
    print("5")
elif 1200 <= s <= 1399:
    print("4")
elif 1400 <= s <= 1599:
    print("3")
elif 1600 <= s <= 1799:
    print("2")
elif 1800 <= s <= 1999:
    print("1")
# Judge status: Accepted
# ABC 116: A – Right Triangle
ab, bc, ca = [int(s) for s in input().split()]
print(ab * bc // 2)
# Judge status: Accepted
import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
a = set([I() for _ in range(M)])
dp = [0]*(N+1) #1_indexed
dp[0] = 1
dp[1] = 0 if 1 in a else 1
for i in range(N+1):
    if i in a:
        dp[i] = 0
        continue
    if i-2>=0:
        dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
print(dp[-1])
# Judge status: Accepted
def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

X = cin()
cnt = 0
i = 0
while(i < X):
    cnt += 1
    i += cnt
print(cnt)
# Judge status: Accepted
# -*- coding: utf-8 -*-

def main():

    N = int(input())

    x = N * 800
    y = (N // 15) * 200

    ans = x - y

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
L = int(input())
print((L / 2) ** 3)
# Judge status: Accepted
a = str(input())
alp = 'abcdefghijklmnopqrstuvwxyz'
if a in alp:
    print('a')
else:
    print('A')
# Judge status: Accepted
def main():
    s = input()

    if s[2]==s[3] and s[4]==s[5]:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())

def ans(n):
    if n % 2 != 0:
        return 0
    else:
        index,count = 1,0
        while 2 * 5**index <= n:
            count += n // (2 * 5**index)
            index += 1
    return count

print(ans(N))
# Judge status: Accepted
from collections import Counter
n = int(input())
lists = list(input())
l = dict(Counter(lists))
for i in range(n-1):
  tmp_l = dict(Counter(list(input())))
  for key in l.keys():
    if key not in tmp_l.keys():
      l[key] = 0
    elif l[key] > tmp_l[key]:
      l[key] = tmp_l[key]

string = ""
for key in l:
  string += ''.join([key for _ in range(l[key])])
    
l = list(string)
l.sort()

string = ''.join(l)
print(string)
# Judge status: Accepted
n, m = map(int,input().split())
data = [list(map(int, input().split())) for _ in range(m)]
start = set(i[1] for i in data if i[0] == 1)
goal = set(j[0] for j in data if j[1] == n)

if start & goal:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Judge status: Accepted
import sys
import numpy as np


scan = sys.stdin.readline


def main():
    n, m = map(int, scan().rstrip().split())
    a = np.array([int(_) for _ in scan().rstrip().split()])

    votes = np.sum(a)
    candidate_num = np.sum(a >= (votes / (4 * m)))
    
    if candidate_num >= m:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
#create date: 2020-06-29 13:35

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    w, h, x, y = na()
    print("{:.10f} {}".format(w*h/2, 1 if w/2==x and h/2==y else 0))

if __name__ == "__main__":
    main()
# Judge status: Accepted
S = str(input())
s0 = s1 = 0
for s in S:
  if s == "1":
    s1 += 1
  else:
    s0 += 1
print(min(s0, s1)*2)
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))
odd=0
four=0
for i in range(N):
  if a[i]%4==0:
    four+=1
  elif a[i]%2!=0:
    odd+=1
if four>=odd:
  print("Yes")
else:
  if odd==four+1 and odd+four==N:
    print("Yes")
  else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
X, Y, T=0, 0, 0
for i in range(n):
    t, x, y = map(int, input().split())
    if abs(x-X)+abs(y-Y) <= t-T and t % 2 == (x+y) % 2:
        continue
    else:
        print('No')
        quit()
    X, Y, T= x, y, T
print('Yes')
# Judge status: Wrong Answer
A, B, C, X, Y = map(int, input().split())
if C * 2 < A and C * 2 < B:
    print(C * max(X, Y) * 2)
elif C * 2 < A + B:
    if X < Y:
        print(C * X * 2 + B * (Y - X))
    else:
        print(C * Y * 2 + A * (X - Y))
else:
    print(A * X + B * Y)
# Judge status: Accepted
N = int(input())
V = list(map(int,input().split()))

V.sort()

T = V[0]
for i in range(1,N):
    T = (T+V[i])/2
print(T)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

cnt = 0
for i in range(1,n-1):
  if (p[i] > p[i-1]) and (p[i] < p[i+1]): cnt += 1
  if (p[i] < p[i-1]) and (p[i] > p[i+1]): cnt += 1
print(cnt)
# Judge status: Accepted
import sys
input = sys.stdin.readline


def main():
    n,a,b = [int(i) for i in input().strip().split()]
    if (b-a) % 2 == 0:
        print(abs(b - a) // 2)
    else:
        ans = min(a - 1, n - b) + 1 + (b - a - 1) // 2
        print(ans)
    return 



if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
 
l = [2,1]
for i in range(2,n+1):
  l.append(l[i-1] + l[i-2])
 
print(l[n])
# Judge status: Accepted
s = ["Sunny", "Cloudy", "Rainy"]
x = input()
print(s[(s.index(x) + 1)%3])
# Judge status: Wrong Answer
A,B,C = input().split()
ls = [int(A+B)+int(C),int(A)+int(B+C),int(B)+int(A+C)]
print(max(ls))
# Judge status: Accepted
n = int(input())
list = list(map(int,input().split()))
count = 0
minimum = list[0]
for i in range(n):
  if minimum >= list[i]:
    count += 1
    minimum = list[i]

print("%d"%(count))
# Judge status: Accepted
def main():
    N = int(input())
    a = sorted([int(x) for x in input().split(" ")], reverse=True)
    Alice = sum([x for i, x in enumerate(a) if i % 2 == 0])
    Bob = sum([x for i, x in enumerate(a) if i % 2 == 1])
    print(Alice-Bob)


if __name__ == '__main__':
    main()
# Judge status: Accepted
w,h,n = map(int,input().split())
x1 = 0
x2 = w
y1 = 0
y2 = h
for i in range(n):
  x,y,a = map(int,input().split())
  if a == 1:
    x1 = max(x1,x)
  elif a == 2:
    x2 = min(x2,x)
  elif a == 3:
    y1 = max(y1,y)
  else:
    y2 = min(y2,y)
if x1 >= x2 or y1 >= y2:
  print(0)
else:
  print(w*h-h*(x1+w-x2)-(x2-x1)*(y1+h-y2))
# Judge status: Accepted
X,Y,A,B,C = map(int,input().split())
r_l = list(map(int,input().split()))
b_l = list(map(int,input().split()))
n_l = list(map(int,input().split()))

r_l.sort(reverse=True)
b_l.sort(reverse=True)

a_l = r_l[:X] + b_l[:Y] + n_l
a_l.sort(reverse=True)
print(sum(a_l[:X+Y]))
# Judge status: Wrong Answer
X,Y,Z = map(int,input().split())
print(Y,Z,X)
# Judge status: Accepted
N = int(input())
ps  = list(map(int, input().split()))
m = 10**10
cnt = 0
for p in ps:
    if p < m:
        cnt += 1
        m = p
print(cnt)
# Judge status: Wrong Answer
a, b = map(int,input().split())

if a <9 and b < 9:
  print("Yay")
else:
  print(":(")
# Judge status: Accepted
s = input()
t = input()
ans = 10000
if t in s:
    print(0)
    exit()

for i in range(len(s)-len(t)+1):
    cut = s[i:i+len(t)]
    cnt = 0
    for k, j in zip(cut, t):
        if k != j:
            cnt += 1
    ans = min(ans, cnt)

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

for i in range(n):
    if (n-i)**(0.5)==int((n-i)**(0.5)):
        print(n-i)
        break
# Judge status: Accepted
def main():
 n,y = map(int,input().split())
 flag = 0
 for i in range(n + 1):
     for j in range(n - i + 1):
         if flag == 0 and  i * 10000 + j * 5000 + 1000 * (n - i - j) == y:
             flag = 1
             print(i,j,n - i - j)
 if flag == 0:
     print('-1 -1 -1')
main()
# Judge status: Accepted
# 3:06
s = input()
out = True
for c in s[1:]:
    if c != '9':
        out = False
        break

if out:
    print(int(s[0]) + (len(s) - 1) * 9)
else:
    print(int(s[0]) - 1 + (len(s) - 1) * 9)
# Judge status: Accepted
N = int(input())

old_t = 0
old_x = 0
old_y = 0

for _ in range(N):
    t, x, y = list(map(int, input().split()))
    rest_t = t - old_x
    diff = abs(x - old_x) + abs(y - old_y)
    if (rest_t < diff) or (old_t - t + old_x - x + old_y -y) % 2 != 0:
        print("No")
        exit()
    old_t = t
    old_x = x
    old_y = y

print("Yes")
# Judge status: Accepted
a, b, c = map(int, input().split())

if b-a == c-b:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
X,Y = map(int,input().split())
cnt = 0
while X<=Y:
    cnt += 1
    X *=2
print(cnt)
# Judge status: Wrong Answer
import math

a,b = map(int, input().split())
gcdab = math.gcd(a,b)

def soinsu(x):
  s = {}
  if x % 2 == 0:
    t = 0
    while x % 2 == 0:
      x //= 2
      t += 1
    s[2] = t
  for i in range(3, 10**12, 2):
    t = 0
    while x % i == 0:
      x //= i
      t += 1
    s[i] = t
    if x == 1:
      break
  return s

ans = len(soinsu(gcdab)) + 1
print(ans)
# Judge status: Accepted
from math import floor

def main(N, rate=1.08):
    ans = -1
    for x in range(1, N+1):
        if floor(x * 1.08) == N:
            ans = x
    return ans


if __name__ == "__main__":
    N = int(input())
    ans = main(N)
    print(ans if ans > 0 else ':(')
# Judge status: Wrong Answer
A,B=map(int,input().split())
if A+B<=24:
  print(A+B)
else:
  print(A+B-24)
# Judge status: Wrong Answer
n = int(input())
prime = [2]
for i in range(3, 101):
  for j in range(2, i + 1):
    if (i % j) == 0:
      break
  if i == j:
    prime.append(i)
pflag = True
for k in prime:
  if k >= 10:
    if (n % k == 0):
      pflag = False
for l in range(50, 101, 10):
  if (n % l) == 0:
    pflag = False
if(pflag):
  print('Yes')
else:
  print('No')
# 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] >p[i] > p[i+1] or p[i-1] <p[i] <p[i+1]:
        cnt += 1
    
print(cnt)
# Judge status: Wrong Answer
n=int(input())
x=[int(i) for i in input().split(" ")]
x=sorted(x)
mind=-1
for i in range(x[0],x[len(x)-1]):
    sum=0
    for j in x:
        sum+=(j-i)**2
    if mind>sum or mind==-1:
        mind=sum

print(mind)
# Judge status: Wrong Answer
import math

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

v.sort(reverse=True)

while len(v) > 1:
    v.append((v.pop() + v.pop())/2)

print(v)
# Judge status: Accepted
N, A, B = map(int, input().split())

if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    ans = min(A, N - B + 1) + (B - A - 1) // 2
    print(ans)
# Judge status: Accepted
sx, sy, tx, ty = map(int, input().split())

dx, dy = tx - sx, ty - sy
print('U' * dy + 'R' * dx + 'D' * dy + 'L' * (dx + 1) + 'U' * (dy + 1) +
      'R' * (dx + 1) + 'DR' + 'D' * (dy + 1) + 'L' * (dx + 1) + 'U')
# Judge status: Accepted
c = input()

print(chr((ord(c) + 1)))
# Judge status: Wrong Answer
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    a,b,c,k = map(int,input().split())

    if a == b == c:
        print(0)
    elif a*k>10**18 or b*k > 10**18 or c*k > 10**18:
        print("Unfair")
    elif k % 2==0:
        print(-1*((b+c)-(a+c)))
    else:
        print((b+c)-(a+c))
    

if __name__=="__main__":
    main()
# Judge status: Accepted
import math
import itertools
N = int(input())
x = []
result = 0
for _ in range(N):
    x.append(list(map(int, input().split())))
for i in itertools.permutations(list(range(N))):
    for j in range(len(i)-1):
        result += math.sqrt((x[i[j]][0] - x[i[j+1]][0])**2 +
                            (x[i[j]][1] - x[i[j+1]][1])**2)
print(result/math.factorial(N))
# Judge status: Accepted
import os, sys, re, math

A,B = map(int,input().split(' '))
ret = max(A,B) + min(A,B)
if ret % 2 == 0:
    print(ret // 2)
else:
    print('IMPOSSIBLE')
# Judge status: Wrong Answer
h, n = map(int, input().split())
a = map(int, input().split())
if h < sum(a):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
a = int(input())
total = 0
for i in range(1, a+1):
  if i % 5 != 0 and i % 3 != 0:
    total += i

print(total)
# Judge status: Wrong Answer
n=int(input())
dp=[0]*10**5
 
dp[0]=1
 
for _ in range(n):
    s=int(input())
    tmp=[0]*10**5
    for i in range(10**4+1):
        tmp[i]=dp[i]
        if s<=i:
            tmp[i]=dp[i-s]
    dp=tmp
 
for i in range(10**4,0,-1):
    if i%10==0:
        continue
 
    if dp[i]:
        print(i)
        break
else:
    print(0)
# Judge status: Wrong Answer
N = input()
if N[0] == 9 or N[1] == 9:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S, T = input().split()
print (T+S)
# Judge status: Accepted
D = int(input())
a = "Christmas "
b = "Eve "
print(a+b*(25-D))
# Judge status: Accepted
X = list(input())
if len(X)<=2:
    print(0)
    exit()
con = X[len(X)-2:len(X)]
kak = X[0:len(X)-2]
kak = int("".join(kak))
con = int("".join(con))
if con>=5:
    imp1 = con//5
    imp2 = con%5
else:
    imp1 = 1
    imp2 = 0
#print(kak, imp1, imp2)
if kak>=imp1+imp2:
    print(1)
else:
    print(0)
# Judge status: Accepted
X = int(input())
res = 0
for i in range(1, 1000):
    for j in range(2, 1000):
        if i**j <= X:
            res = max(i**j, res)
        else:
            break
print(res)
# Judge status: Accepted
from collections import deque

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

ans = deque()

if n %2 == 0:
    for i in range(0,n):
        if i %2 != 0:
            ans.appendleft(a_L[i])
        else:
            ans.append(a_L[i])
else:
    for i in range(0,n):
        if i %2 == 0:
            ans.appendleft(a_L[i])
        else:
            ans.append(a_L[i])

print(*ans)
# Judge status: Wrong Answer
n = input()
print((len(n) - 1) * 9 - 1 + int(n[0]))
# Judge status: Accepted
n,x = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
cnt = 0
if x > sum(A):
    print(n-1)
else:
    for i in range(n):
        if (x - A[i]) >= 0:
            x -= A[i]
            cnt += 1
        else:
            break
    print(cnt)
# Judge status: Accepted
s=str(input())
s=list(s)
ans=1
i=1
temp=s[0]
while True:
  if s[i]!=temp:
    ans=ans+1
    temp=s[i]
    i=i+1
  elif s[i]==temp and i==len(s)-1:
    i=i+1
  else:
    temp=s[i]+s[i+1]
    i=i+2
    ans=ans+1
  if i>len(s)-1:
    break
print(ans)
# Judge status: Accepted
N, L = map(int, input().split())
S = []
ans = ''

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

for i in range(N):
    ans += min(S)
    del S[S.index(min(S))]

print(ans)
# Judge status: Accepted
def rec(L):
    return sum([d for a, b, c, d in X if L[b] - L[a] == c]) if len(L) > N else max([rec(L + [i]) for i in range(L[-1], M)])

N, M, Q = map(int, input().split())
X = []
for _ in range(Q):
    a, b, c, d = map(int, input().split())
    X.append((a, b, c, d))
print(rec([0]))
# Judge status: Accepted
import sys
input = sys.stdin.readline
from collections import *

N = int(input())
A = list(map(int, input().split()))
cnt = Counter(A)
l = []

for k, v in cnt.items():
    if v>=2:
        l.append(k)

l.sort(reverse=True)

if len(l)==0:
    print(0)
elif len(l)==1:
    if cnt[l[0]]>=4:
        print(l[0]*l[0])
    else:
        print(0)
else:
    if cnt[l[0]]>=4:
        print(l[0]*l[0])
    else:
        print(l[0]*l[1])
# Judge status: Accepted
import sys
c=list(map(int,input().split()))
diffa=c[1]-c[0]
diffb=c[2]-c[1]

c=list(map(int,input().split()))
if(diffa!=(c[1]-c[0]) or diffb!=(c[2]-c[1])):
    print("No")
    sys.exit()

c=list(map(int,input().split()))
if(diffa!=(c[1]-c[0]) or diffb!=(c[2]-c[1])):
    print("No")
    sys.exit()

print("Yes")
# Judge status: Accepted
n,k = map(int, raw_input().split())
s = raw_input()
cd = 0
d = None
for l in s:
	if d != l:
		cd +=1
		d = l
score = 0
for u,v in zip(s,s[1:]):
	if u == v:
		score +=1

while(k and cd > 1):

	if cd > 2:
		score += 2 
		cd -= 2
	elif cd == 2:
		score +=1
		cd -= 1
	k -=1
print score
# Judge status: Accepted
r = int(input())
pi = 3.14159265358979
 
print(r*2*pi)
# Judge status: Accepted
s = list(input())
c = 0
for i in range(1,len(s)):
    if(s[i] == s[i-1]):
        s[i] = str(int(s[i])^1)
        c += 1
print(c)
# Judge status: Accepted
a, b, c = map(int, input().split())

if a + b + c >= 22:
    print("bust")
else:
    print('win')
# Judge status: Wrong Answer
N = int(input())
if N == 1:
    print(0)
else:
    print(pow(pow(9,N) - pow(8,N) - pow(8,N) + pow(7,N), 1, 1000000007))
# Judge status: Accepted
n,m,x,y=map(int,input().split())
x=list(map(int,input().split()))+[x]
y=list(map(int,input().split()))+[y]
if max(x)<min(y):print("No War")
else:print("War")
# Judge status: Accepted
N,x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
res = 0
for i in range(N):
    x -= a[i]
    if x < 0:
        break
    res += 1
if x > 0:
    res -= 1
print(res)
# Judge status: Accepted
N = int(input())
bricks = [int(x) for x in input().split()]

next_number = 1
num_broken = 0

for brick in bricks:
  if brick == next_number:
    next_number += 1
  else:
    num_broken += 1
    
if next_number == 1:
  print(-1)
else:
  print(num_broken)
# Judge status: Accepted
N=int(input())
print(len(set([input() for _ in range(N)])))
# Judge status: Accepted
N,D=map(int, input().split())
d=D**2
ans=0
for maimelkm in range(N):
	x,y=map(int, input().split())
	if x**2+y**2<=d:
		ans+=1


print(ans)


# 2darray [[0] * 4 for i in range(3)]
# import itertools