Problem:
 Score : 200 points    Problem Statement Given is an integer N . Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).      Constraints  1 \leq N \leq 10^5         Input Input is given from Standard Input in the following format:  N       Output Print the number of positive integers less than or equal to N that have an odd number of digits.        Sample Input 1 11      Sample Output 1 9  Among the positive integers less than or equal to 11 , nine integers have an odd number of digits: 1, 2, \ldots, 9 .       Sample Input 2 136      Sample Output 2 46  In addition to 1, 2, \ldots, 9 , another 37 integers also have an odd number of digits: 100, 101, \ldots, 136 .       Sample Input 3 100000      Sample Output 3 90909

Solution (Python):
a = int(input())
b = [9, 1000-100, 100000-10000]
c = 0
d = len(str(a))
if d%2==1:
    c = a-10**(d-1)+1
    d -= 1
d -= 1
i=0
while d>0:
    c += b[i]
    i += 1
    d -= 2
print(c)

Solution (Python):
N = str(input())
n = int(N)
l = len(N)
 
ans = 0
for i in range(0, (l//2)*2, 2):
  ans += 9*(10**i)
  
if l%2 != 0:
  ans += n - (10**(l-1)) + 1

print(ans)

Solution (Python):
def kei(x):
    S=0
    for i in range(1,x):
        if i%2==1:
            S=S+9*(10**(i-1))
        else:
            S=S
    return S
    
N = int(input())
ketasu=int(len(str(N)))
if ketasu%2==1:
    k=ketasu
    count=N-10**(k-1)+1+kei(k)
    print(count)
else:
    k=ketasu
    count=kei(k)
    print(count)

Solution (Python):
def main():
    N = int(input())

    if 1 <= N < 10 ** 1:
        print(N)
    elif 10 ** 1 <= N < 10 ** 2:
        print(9)
    elif 10 ** 2 <= N < 10 ** 3:
        print(9 + (N - 10 ** 2 + 1))
    elif 10 ** 3 <= N < 10 ** 4:
        print(9 + 900)
    elif 10 ** 4 <= N < 10 ** 5:
        print(9 + 900 + (N - 10 ** 4 + 1))
    elif N == 10 ** 5:
        print(9 + 900 + 90000)

    return


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
if N == 100000:
    print(90909)
elif N >= 10000:
    print(9+900+(N-10000+1))
elif N >= 1000:
    print(909)
elif N >=100:
    print(9+(N-100+1))
elif N < 10:
    print(N)
else:
    print(9)

Solution (Python):
n = int(input())
n_len = len(str(n))
ans = 0

if n_len == 1:
  ans += n
elif n_len > 1:
  ans += 9

if n_len == 3:
  ans += n - 99
elif n_len > 3:
  ans += 999 - 99

if n_len == 5:
  ans += n - 9999
elif n_len > 5:
  ans += 99999 - 9999

print(ans)

Solution (Python):
N = int(input())
print(min(N,9) + max((min(N,999) - 99),0) + max((min(N,99999) - 9999),0))

Solution (Python):

A = int(input())

count = 0
for i in range(1, A+1):
    A2 = str(i)
    if len(A2) % 2 == 0 :
        pass
    else:
        count = count + 1
print(count)

Solution (Python):
N=input()
n=list(N)
l=int(len(n))
L=[9,900,90000]
if l%2==0:
    if l==6:
        print(sum(L))
    elif l==4:
        print(9+900)
    else:
        print(9)
else:
    if l==5:
        print(int(N)-9999+909)
    elif l==3:
        print(int(N)-99+9)
    else:
        print(int(N))

Solution (Python):
n = int(input())

if n == 10 ** 5:
    print(90909)
elif n >= 10 ** 4:
    print(n - 10 ** 4 + 909 + 1)
elif n >= 10 ** 3:
    print(909)
elif n >= 10 ** 2:
    print(n - 10 ** 2 + 9 + 1)
elif n >= 10:
    print(9)
else:
    print(n)

Solution (Python):
N = int(input())

if 1<= N < 10:
  print(N)
elif 10 <= N < 100:
  print(9)
elif 100 <= N < 1000:
  s = N - 99 + 9
  print(s)
elif 1000 <= N < 10000:
  print(909)
elif 10000 <= N < 100000:
  s = N - 9999 + 9 + 900
  print(s)
else:
  print(90909)

Solution (Python):
n = int(input())

result = 0
for i in range(n):
  i = i+1
  if i < 10:
    result += 1
  if 100 <= i and i < 1000:
    result += 1
  if 10000 <= i and i < 100000:
    result += 1
  if 1000000 <= i and i < 10000000:
    result += 1
print(result)

Solution (Python):
def calc(x):
    for i in range(10):
        if 10 ** i > x:
            return i

N = int(input())
tmp = calc(N)
result = 0
for i in range(tmp):
    if i % 2 == 0:
        if 10 ** (i+1) > N:
            result = result + N - (10 ** i) + 1
            break
        result += 9 * (10 ** i)
print(result)

Solution (Python):
N = int(input())
if N<=9:
    print(N)
elif N<=99:
    print(9)
elif N<=999:
    print(9+(N-99))
elif N<=9999:
    print(909)
elif N<=99999:
    print(909+(N-9999))
elif N<=999999:
    print(90909)

Solution (Python):
N = int(input())
if N<10:
    print(N)
elif N<100:
    print(9)
elif N<1000:
    print(N-100+10)
elif N<10000:
    print(909)
elif N<100000:
    print(N-10000+910)
else:
    print(90909)

Solution (Python):
N = int(input())
ans = 0

if N >= 100000:
    N = 99999
if N >= 10000:
    ans = N - 9999
    N = 999
if N >= 1000:
    N = 999
if N >= 100:
    ans += N - 99
    N = 9
if N >= 10:
    N = 9
ans += N
print(ans)

Solution (Python):

from collections import defaultdict, deque
import math
from math import factorial
import fractions
import re

BIGNUM = 10 ** 9 + 7

def main():
    
    N = int(input())

    num = 0
    for i in [1, 3, 5]:
        base = 10 ** i
        if N >= base:
            num += 9 * 10 ** (i - 1)

        if N >= 10 ** (i - 1)\
            and N < 10 ** i:
            remain = N - 10 ** (i - 1) + 1
            num += remain

    print(num)

if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
if N <= 9:
  print(N)
elif N <= 99:
  print(9)
elif N <= 999:
  print(N - 99 + 9)
elif N <= 9999:
  print(909)
elif N <= 99999:
  print(N - 9999 + 909)
else:
  print(90909)

Solution (Python):
n=int(input())

ans = 0
for i in range(1,n+1):
      if len(str(i))%2!=0:
            ans+=1
print(ans)

Solution (Python):
n = int(input())
def f(x):
  return ((x-2)//2)*"90"+"9"
if n < 10:
  print(n)
elif len(str(n)) % 2 == 0:
  print(f(len(str(n))))
else:
  print(int(f(len(str(n))-1))+n-10**(len(str(n))-1)+1)

Solution (Python):
num = input()
goukei = 0
for i in range(1,6,2):
    if i < len(num):
        goukei += 9*(10**(i-1))
    elif i == len(num):
        goukei += int(num) - (10**(i-1)) +1
        break
    else:
        break
print(goukei)

Solution (Python):
import math

N = int(input())

myo = int(math.log10(N) + 1)

if myo == 1:
    print(N)
elif myo == 2:
    print(9)
elif myo == 3:
    print(9+N-100 +1)
elif myo == 4:
    print(9 + 900)
elif myo == 5:
    print(9+900+N-10000+1)
elif myo == 6:
    print(9+900+90000)

Solution (Python):
N = int(input())

ans = 0
for i in range(1, N + 1):
    k = 0
    while i != 0:
        i //= 10
        k += 1
    if k % 2 == 1:
        ans += 1
print(ans)

Solution (Python):
n=int(input())
keta=len(list(str(n)))

if keta%2==0:
    keta-=1
    new_n=0
    for i in range(1,keta+1):
        new_n+=9*(10**(i-1))
    n=new_n

ans=0
for i in range(1,keta+1,2):
    c=n if i==keta else 10**i-1
    cc=10**(i-1) if i!=1 else 1
    ans+=c-cc+1
print(ans)

Solution (Python):
from fractions import gcd
import math

mod = 998244353

def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft

def S(x1, y1, x2, y2, x3, y3):
    return heron(math.sqrt((x1 - x2)**2 + (y1 - y2)**2), math.sqrt((x1 - x3)**2 + (y1 - y3)**2), math.sqrt((x3 - x2)**2 + (y3 - y2)**2))

def heron(a, b, c):
    try:
        d = (a + b + c) / 2
        return round(math.sqrt(d * (d - a) * (d - b) * (d - c)) * 2)
    except Exception as e:
        return 0

def main():
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        if len(str(i)) % 2 == 1:
            ans += 1
    print(ans)
main()

Solution (Python):
n = input()
t = len(n)
ans = 0
for i in range(1,t+1):
    if i%2 == 1:
        str1 = ''
        if(t == i):
            ans += int(n) -  10**(i-1) +1
            continue
        else:
            ans += 9 * (10**(i-1))
print(ans)

Solution (Python):
import sys

N = int(input())
l_N = len(str(N))

if l_N == 1:
    print(N)
    sys.exit()

ans = int("".join(["9", "0"] * (l_N // 2 - 1) + ["9"]))

if l_N % 2 != 0:
    ans += N - 10 ** (l_N - 1) + 1

print(ans)

Solution (Python):


def main(N):
    ans = 0
    for i in range(1, N+1):
        if len(str(i)) % 2 == 1:
            ans += 1
    return(ans)
    
if __name__ == '__main__':
    N = int(input()) 
    print(main(N))

Solution (Python):
N = int(input())

def calc_order(n):
    o = 0
    while 1<=n:
        n //= 10
        o+=1
    return o

N_order = calc_order(N)

num_list = []
for n in range(N_order-1):
    num_list.append(9 * (10**n))
num_list.append(N - (10**(N_order-1)-1))

odd_part = num_list[0::2]
print(sum(odd_part))

Solution (Python):

sN = (input())

nLen = len(sN)
nN = int(sN)
nAns = 0

for i in range(nLen):
  nChk = i
  nChk &= 1
  if nChk == 1:
    continue
    
  nTmp = 10 **(i)
  if  nLen== 1:
    nAns = nN
    break
  else:
  
    if i==(nLen-1):    
      nAns += nN - nTmp + 1
    else:
      nTmp2 = 10 **(i+1)
      nAns += nTmp2 - nTmp 
    
print(nAns)

Solution (Python):
n = int(input())
count = 0
for i in range(1,n + 1):
    if len(str(i)) % 2 == 1:
        count += 1
print(count)

Solution (Python):
nmax = int(input())
c = 0
for i in range(1, nmax+1):
    if len(str(i)) % 2 != 0:
        c += 1
print(c)

Solution (Python):
N = int(input())

keta = len(str(N))

ans = 0

if keta == 1:
    ans = N

elif keta % 2 == 0:
    ans = 9
    k = 3
    while k < keta:
        ans += 10**k - 10**(k-1)
        k += 2

else:
    ans = 9
    k = 3
    while k < keta:
        ans += 10**k - 10**(k-1)
        k += 2
    ans += N - 10**(keta-1) + 1

print(ans)

Solution (Python):
N = int(input())
result = 0

if N < 10:
  result = N
elif 10 <= N and N < 100:
  result = 9
elif 100 <= N and N < 1000:
  result = 9 + (N - 100 + 1)
elif 1000 <= N and N < 10000:
  result = 9 + 900
elif 10000 <= N and N < 100000:
  result = 9 + 900 + (N - 10000 + 1)
elif N == 100000:
  result = 9 + 900 + 90000
  
print(result)

Solution (Python):
import math

N = int(input())
log = int(math.log(N, 10))

ans = 0
for i in range(log):
    if i % 2 == 0:
        ans += 10 ** (i + 1) - 10 ** i

if log % 2 == 0:
    ans += N + 1 - (10 ** log)

print(ans)

Solution (Python):
N=input()
ans=0
if len(N)%2==0:
    for i in range(len(N)//2):
        ans+=9*100**i
    print(ans)
else:
    for j in range(len(N)//2):
        ans+=9*100**j
    ans+=int(N)-10**(len(N)-1)+1
    print(ans)

Solution (Python):
n=int(input())
ns = range(1,n+1)
ans = len([n for n in ns if len(str(n))%2==1])
print(ans)

Solution (Python):
a = int(input())
countodd = 0

for n in range(a + 1):
  
  
  if( len(str(n)) % 2 == 1 ):
    
    countodd += 1

print(str(countodd-1))

Solution (Python):
n = int(input())
cnt = 0
if n >= 10:
    cnt = cnt + 9
else:
    cnt = cnt + n
if n >= 1000:
    cnt = cnt + 900
elif n >= 100:
    cnt = cnt + (n - 99)
if n >= 100000:
    cnt = cnt + 90000
elif n >= 10000:
    cnt = cnt + (n - 9999)
print(cnt)

Solution (Python):
n = int(input())

if len(str(n))==1:
  print(n)
elif len(str(n))==2:
  print(9)
elif len(str(n))==3:
  print(n - 90)
elif len(str(n))==4:
  print(909)
elif len(str(n))==5:
  print(n - 9090)
else:
  print(90909)

Solution (Python):
A = int(input())

count =  0

if A<10:
    count= A
elif A <100:
    count = 9 
elif A < 1000:
    count = 9 + A - 99
elif A < 10000:
    count = 9 + 900
elif A < 100000:
    count = 9 + 900 + (A-9999)
else:
    count = 90909
    

print(count)

Solution (Python):
N = input()

if len(N) == 1:
    print(N)
if len(N) == 2:
    print(9)
if len(N) == 3:
    print(9 + int(N) - 100 + 1)
if len(N) == 4:
    print(909)
if len(N) == 5:
    print(9 + 900 + int(N) - 10000 + 1)
if len(N) == 6:
    print(90909)

Solution (Python):

def main():
    N = int(input())
    count = 0
    for i in range(N):
        L = []
        L = [int(i+1) for c in str(i+1)]
        if len(L)%2 != 0:
            count += 1
    print(count)
if __name__ == '__main__':
    main()

Solution (Python):
n=input()
nn=int(n)
cnt=nn-int('9'+(len(n)-2)*'0')
if len(n)==1:
    ans=nn
elif len(n)==2:
    ans=9
elif len(n)==3:
    ans=cnt
elif len(n)==4:
    ans=909
elif len(n)==5:
    ans=cnt-90
else:
    ans=90909
print(ans)

Solution (Python):
n = int(input())

if n < 10:
  print(n)
elif n < 100:
  print(9)
elif n < 1000:
  print(9 + n - 100 + 1)
elif n < 10000:
  print(9 + 900)
elif n < 100000:
  print(9 + 900 + n - 10000 + 1)
elif n < 1000000:
  print(9 + 900 + 90000)

Solution (Python):
N = int(input())
len_N = len(str(N))
count = 0
for i in range(1, N+1):
    if len(str(i))%2 == 0:
        continue
    else:
        count += 1
print(count)

Solution (Python):
a = list(map(int, input().split()))

print(len([i for i in range(1, a[0]+1) if len(str(i)) % 2 != 0]))

Solution (Python):
N = int(input())
if N < 10:
  print(N)
elif N < 100:
  print(9)
elif N < 1000:
  print( 9 + N - 99 )
elif N < 10000:
  print( 909 )
elif N < 100000:
  print(909 + N - 9999)
else:
  print( 90909 )

Solution (Python):
n = input()

ans = 0

for i in range(int(n)):
    if len(str(i+1)) % 2 == 1:
        ans += 1

print(ans)

Solution (Python):
N=int(input())
C=0
 
for i in range(1,N+1):
  if len(str(i))%2!=0:
    C+=1
    
print(C)

Solution (Python):






N = int(input())





ans = 0
if N > 9:
    ans += 9
    if N > 999:
        ans += 900
        if N > 99999:
            ans += 90000
        elif N > 9999:
            ans += N - 9999
    elif N > 99:
        ans += N - 99
else:
    ans = N





print(ans)

Solution (Python):

N = int(input())

ans = 0
if 1<=N and N<10:
    ans = 0+N
elif 10<=N and N<100:
    ans = 9
elif 100<=N and N<1000:
    ans += 9+N-99
elif 1000<=N and N<10000:
    ans = 909
elif 10000<=N and N<100000:
    ans += 909+N-9999
else:
    ans = 90909
print(ans)

Solution (Python):
N = int(input())
n = N
cnt = 0
while n>0:
  n = n//10
  cnt += 1

if cnt==1:
  print(N)
else:
  tmp = "90"*(cnt//2)
  tmp = int(tmp[:-1])

  if cnt%2!=0:
    tmp += N-int("9"*(cnt-1))

  print(tmp)

Solution (Python):
n = int(input())
if 1 <= n < 1e1:
  print(n)
elif 1e1 <= n < 1e2:
  print(9)
elif 1e2 <= n < 1e3:
  print(9+(n-99))
elif 1e3 <= n < 1e4:
  print(9+900)
elif 1e4 <= n < 1e5:
  print(9+900+(n-9999))
else:
  print(9+900+90000)

Solution (Python):
N = input()
N_list = list(N)
N_num = int(N)

if len(N_list)==6:
    print(90909)

elif len(N_list)==5:
    print(9 + 900 + (N_num-9999))


elif len(N_list)==4:
    print(909)

elif len(N_list)==3:
    print(9 + (N_num-99))

elif len(N_list)==2:
    print(9)

elif len(N_list)==1:
    print(N_num)

Solution (Python):
n=int(input())
cnt=0
if(n<10):
    cnt=n
elif(n<100):
    cnt=9
elif(n<1000):
    cnt=(n-99)+9
elif(n<10000):
    cnt=909
elif(n<100000):
    cnt=(n-9999)+909
else:
    cnt=90909
print(cnt)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math


n = getN()
ans = 0
for i in range(n):

    if len(str(i+1)) % 2 == 1:
        ans += 1

print(ans)

Solution (Python):
n = int(input())

k = len(str(n))
if k%2 == 0:
  count = 0
  for i in range(1,k,2):
    count += 10**i - 10**(i-1)
else:
  count = 0
  for i in range(1,k+1,2):
    count += 10**i - 10**(i-1)
  count -= 10**k-1-n
print(count)

Solution (Python):
N = int(input())

if N<10:
    print(N)
elif N<10**2:
    print(9)
elif N<10**3:
    print(N-90)
elif N<10**4:
    print(909)
elif N<10**5: 
    print(N-9090)
else:
    print(90909)

Solution (Python):
n = int(input())

if len(str(n)) == 6:
    print(90909)
elif len(str(n)) == 4:
    print(909)
elif len(str(n)) == 2:
    print(9)
elif len(str(n)) == 1:
    print(n)
elif len(str(n)) == 3:
    print(9 + (n - 100) + 1)
elif len(str(n)) == 5:
    print(9 + 900 + (n - 10000) + 1)

Solution (Python):
N = int(input())
count = 0
for i in range(N):
  i += 1
  i = str(i)
  if len(i) ==1:
    count += 1
  elif len(i) == 3:
    count += 1
  elif len(i) == 5:
    count += 1
print(count)

Solution (Python):
n=int(input())
s=0
for i in range(1,n+1):
  if(len(str(i))%2!=0):
    s+=1
print(s)

Solution (Python):
N = int(input())

keta = len(str(N))

n = N
ans = 0
while True:
    if keta == 0:
        break
    if keta % 2 == 0:
        keta = keta -1
        n = 10**keta - 1
    keta = keta - 1
    ans = ans + (n - 10**keta + 1)
    n = 10**keta - 1

print(ans)

Solution (Python):
import math

N = int(input())

a = int(math.log10(N)) + 1

sum = 0
i = 1
while (i <= a):
    
    if  i != a:
        sum += 9 * (10 ** (i-1))
    else:
        sum += N - (10 ** (i-1)) + 1

    i += 2
    

print(sum)

Solution (Python):
n=int(input())
if n < 10:
    print(n)
elif n < 100:
    print(9)
elif n < 1000:
    print(n - 99 + 9)
elif n < 10000:
    print(909)
elif n < 100000:
    print(n - 9999 + 909)
elif n < 1000000:
    print(90909)

Solution (Python):
n = input()
keta = len(n)
n=int(n)
if keta==1:
  print(n)
else:
  count=0
  odd_keta = [k for k in range(1,keta) if k%2==1]
  counts = [9*10**(o-1) for o in odd_keta]
  count +=sum(counts) 

  if keta%2==1: 
    count += (n-10**(keta-1))+1

  print(count)

Solution (Python):
n = int(input())
cnt = 0
if n < 10:
  for i in range(1,n+1):
    cnt += 1
elif 10 <= n < 100:
  cnt += 9
elif 100 <= n < 1000:
  cnt += 9
  for i in range(100,n+1):
    cnt += 1
elif 1000 <= n < 10000:
  cnt += 909
elif 10000 <= n < 100000:
  cnt += 909
  for i in range(10000, n+1):
    cnt +=1
elif n == 100000:
  cnt = 90909
print(cnt)

Solution (Python):
N = int(input())
ans = 0

if N < 10:
    print(N)
elif N < 100:
    print(9)
elif N < 1000:
    print(9 + N - 99)
elif N < 10000:
    print(909)
elif N < 100000:
    print(909 + N - 9999)
else:
    print(90909)

Solution (Python):
import math

n = int(input())
k = math.log10(n)
if k < 1:
    ans = n
elif k < 2:
    ans = 9
elif k < 3:
    ans = n - 90
elif k < 4:
    ans = 900 + 9
elif k < 5:
    ans = 900 + 9 + n - 9999
else:
    ans = 90909
print(ans)

Solution (Python):
def main():
    n = int(input())
    print(solve(n))

def solve(n):
    c = 0
    for p in (10, 1000, 100000):
        if n >= p:
            c += p * 9 // 10
        elif n * 10 >= p:
            c += n - p // 10 + 1
    return c

main()

Solution (Python):
N = int(input())
if (N < 10):
    print(N)
elif (N < 99):
    print(9)
elif (N < 999):
    print(9 + N - 99)
elif (N < 9999):
    print(9 + 900)
elif (N < 99999):
    print(9 + 900 + N - 9999)
else:
    print(9 + 900 + 90000)

Solution (Python):
N = input()
n = len(N)
num = int(N)
cnt = 0
for i in range(1,n+1,2):
  if i!=n:
    cnt += 10**i-10**(i-1)
  else:
    cnt += (num-10**(i-1))+1

print(cnt)

Solution (Python):
N=int(input())
if 1<=N<=9:
  print(N)
elif 1<=N<=99:
  print(9)
elif 100<=N<=999:
  print(9+N-100+1)
elif 1000<=N<=9999:
  print(909)
elif 10000<=N<=99999:
  print(909+N-10000+1)
elif N==100000:
  print(90909)

Solution (Python):
import math

N = int(input())
k = int(math.log10(N))
s = 0
for i in range(1, k + 1):
    if i % 2 == 0:
        continue
    s += 10 ** i - 10 ** (i - 1)
if k % 2 == 0:
    s += N - 10**k + 1
print(s)

Solution (Python):
N = int(input())

c = 0
while N>0:
    if N<10 or (N>99 and N<1000) or (N>9999 and N<100000):
        c = c + 1
    N = N - 1

print(c)

Solution (Python):
N = input()
l = len(N)



ans = 0

if l % 2 == 0:  

    for i in range(1, l, 2):
        ans += 9*(10**(i-1))
        
    print(ans)

else:
    for i in range(1, l, 2):
        ans += 9*(10**(i-1))
        
    ans += int(N) - 10**(l-1) + 1
    print(ans)

Solution (Python):
N = input()
length = len(N)

count = 0
last = 0
for i in range(length-1):
    last = i
    if i % 2 == 0:
        count += 9*(10**i)

number = int(N)
if length == 1:
    count = number
elif last%2 == 1:
    count += number + 1 - 10**(last+1)
print(count)

Solution (Python):
import numpy as np

def main():
    N = int(input())

    i = 1
    ans = 0
    while N >= 10**i:
        if i % 2 == 1:
            ans += 9 * 10**(i-1)
        i += 1

    if i % 2 == 1:
        ans += N - 10**(i-1)+ 1

    print(ans)





if __name__ == "__main__": 
    main()

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    count = 0
    if n < 10:
        print(n)
    elif n < 100:
        print(9)
    elif n < 1000:
        print(9 + n - 99)
    elif n < 10000:
        print(909)
    elif n < 100000:
        print(909 + n - 9999)
    elif n == 100000:
        print(90909)

Solution (Python):
N = input()
k = len(N)
if k == 1:
    print(int(N))
elif k == 2:
    print(9)
elif k == 3:
    print(int(N)-90)
elif k == 4:
    print(909)
elif k == 5:
    print(int(N)-9090)
else:
    print(90909)

Solution (Python):
n = int(input())
d1 = 9 - 1 + 1
d3 = 999 - 100 + 1
d5 = 99999 - 10000 + 1

n_len = 1
n_copy = n
while n_copy >= 10:
    n_copy = n_copy // 10
    n_len += 1

if n_len == 6:
    print(d1 + d3 + d5)
elif n_len == 5:
    print(d1 + d3 + (n-10000+1))
elif n_len == 4:
    print(d1 + d3)
elif n_len == 3:
    print(d1 + (n-100+1))
elif n_len == 2:
    print(d1)
elif n_len ==1:
    print(n)

Solution (Python):


import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    token = lines[0].split()
    n = int(token[0])

    return (n, )


def solve(n):

    count = 0
    for i in range(1, n+1):

        if 1 <= i and i <= 9:
            count = count + 1

        if 100 <= i and i <= 999:
            count = count + 1

        if 10000 <= i and i <= 99999:
            count = count + 1

    return count


def main():
    

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

Solution (Python):
N=input()

if len(N)==1:
    print(int(N))
elif len(N)==2:
    print(9)
elif len(N)==3:
    print(9+int(N)-99)
elif len(N)==4:
    print(909)
elif len(N)==5:
    print(909+int(N)-9999)
else:
    print(90909)

Solution (Python):
n = input()

if len(n) == 1:
    print(n)
elif len(n) == 2:
    print(9)
elif len(n) == 3:
    print(9+(int(n)-100+1))
elif len(n) == 4:
    print(909)
elif len(n) == 5:
    print(9+900+(int(n)-10000+1))
elif len(n) == 6:
    print(90909)

Solution (Python):
N = int(input())
answer = 0

for i in range(3):
    tmp_N = min(N,10**(1+2*i)-1)
    answer += max(0, tmp_N-10**(2*i)+1)
    
print(answer)

Solution (Python):
N = input()
s = len(N)
i = 0
count = 0
while i < s - 1:
    count += 9 * (10 ** i)
    i += 2
n = int(N)
if s % 2 == 1:
    count += n - (10 ** (s - 1)) + 1
print(count)

Solution (Python):
N = int(input())
if N == 10**5:
  ans = 90909
elif N >= 10**4:
  ans = 9+900+(N-10**4+1)
elif N >= 10**3:
  ans = 909
elif N >= 10**2:
  ans = 9+(N-10**2+1)
elif N>=10:
  ans = 9
else:
  ans = N

print(ans)

Solution (Python):

N=int(input())
Nstr=str(N)
ans=0
if len(Nstr)%2==0:
    for i in range(1,len(Nstr),2):
        if i==1:
            ans=ans+9
        else:
            ans=ans+10**(i)-10**(i-1)
else:
    for i in range(1,len(Nstr),2):
        if i==1:
            ans=ans+9
        else:
            ans=ans+10**(i)-10**(i-1)
    ans=ans+N-10**(len(Nstr)-1)+1
print(ans)

Solution (Python):
n = int(input())

if n < 9:
    print(n)
elif n < 100:
    print(9)
elif n < 1000:
    print(n-90)
elif n < 10000:
    print(909)
elif n < 100000:
    print(n-9090)
else:
    print(90909)

Solution (Python):
import math

N = int(input())

ans = 0
for i in range(1,N+1):
    if (int(math.log10(i))+1)%2 == 1:
        ans += 1
print(ans)

Solution (Python):
a=input()
c=int(a)
b=len(a)
ans=0
if b==1:
    print(c)
elif b==2:
    print(9)
elif b==3:
    print(9+c-99)
elif b==4:
    print(9+900)
elif b==5:
    print(9+900+c-9999)
elif b==6:
    print(9+900+90000)

Solution (Python):
n = int( input() )

ans = n

if n < 10:
    ans = n
elif n < 100:
    ans = 9
elif n < 1000:
    ans = n - 90
elif n < 10000:
    ans = 9 + 900
elif n < 100000:
    ans = n - 9000 - 90
else:
    ans = 9 + 900 + 90000

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(2**31-1)
input = sys.stdin.readline
write = sys.stdout.write
LMIIS = lambda : list(map(int,input().split()))
II = lambda : int(input())
dbg = lambda *something : print(*something) if DEBUG is True else 0
DEBUG = True

def main():

    N = input()

    l = len(N) - 1
    N = int(N)
    count = 0
    if l % 2 == 1:
        count += N - 10**(l-1) + 1
    i = 1
    while i < l:
        count += 10**i - 10**(i-1)
        i += 2
    print(count)




    pass
if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())

if (N // 10) < 1:
    print(N)
elif (N // 100) < 1:
    print(9)
elif (N // 1000) < 1:
    print(N- 90)
elif (N // 10000) < 1:
    print(909)
elif (N // 100000) < 1:
    print(N - 9090)
else:
    print(90909)

Solution (Python):
n = int(input())
if n <= 9:
  print(n)
elif n <= 99:
  print(9)
elif n <= 999:
  print(9+n-100+1)
elif n <= 9999:
  print(909)
elif n <= 99999:
  print(909+n-10000+1)
else:
  print(90909)

Solution (Python):
n = input()
keta = len(n)
n = int(n)

if keta == 1:
    print(n)
elif keta == 2:
    print(9)
elif keta == 3:
    print(n - 90)
elif keta == 4:
    print(909)
elif keta == 5:
    print(n - 9000  - 90 )
else:
    print(90909)

Solution (Python):
n = int(input())
a = len(str(n))
if a==1:
    print(n)
elif a==2:
    print(9)
elif a==3:
    print(n-99+9)
elif a==4:
    print(999-99+9)
elif a==5:
    print(n-9999+999-99+9)
elif a==6:
    print(90909)

Solution (Python):
n = int(input())
count = 0
for i in range(1,n+1):
    if len(str(i)) % 2 == 1:
        count += 1
print(count)

Solution (Python):


n = int(input())

if n < 10:
    print(n)
elif 10 <= n and n < 10**2:
    print(9)
elif 10**2 <= n and n < 10**3:
    print(9+n-99)
elif 10**3 <= n and n < 10**4:
    print(9+900)
elif 10**4 <= n and n < 10**5:
    print(9+900+n-9999)
elif n == 10 ** 5:
    print(9+900+90000)

Solution (Python):
a=int(input())
b = 0
if(a >= 10):
    b += 9
    if(a >= 1000):
        b += 900
        if(a >= 100000):
            b += 90000
        elif(a >= 10000):
            b += (a - 10000 + 1)
    elif(a >= 100):
        b += (a - 100 + 1)    
else:
    b += a 
print(b)

Solution (Python):

N=int(input())
a=len(str(N))
if(a==1):
    ans=N
elif(a==2):
    ans=9
elif(a==3):
    ans=(N-99)+9
elif(a==4):
    ans=909
elif(a==5):
    ans=(N-9999)+909
elif(a==6):
    ans=90909
print(ans)

Solution (Python):
N = int(input())

if N < 10:
    ret = N

elif N < 100:
    ret = 9

elif N < 1000:
    ret = N - 90

elif N < 10000:
    ret = 909

elif N < 100000:
    ret = N - 9090

elif N == 100000:
    ret = 90909

print(ret)

Solution (Python):
N = input()
a = int(len(N))
n = int(N)
ans = 0
if (a//2)*2 != a:
    for j in range(0,a-1,2):
        ans += 9 * (10**j)
    ans += n - 10**(a-1) + 1
else:
    for j in range(0,a,2):
        ans += 9 * (10**j)
print(ans)

Solution (Python):
N = int(input())
count = 0
for i in range(1,N + 1):
    if len(str(i)) % 2 != 0:
        count += 1
print(count)

Solution (Python):
N = int(input())

num_list_s=[1,100,10000]
num_list_e=[10,1000,100000]

cnt=0
for n in range(N+1):
    for l in range(3):
        if n >= num_list_s[l] and n < num_list_e[l] :
            cnt+=1
print(cnt)

Solution (Python):
N = int(input())

if N < 10:
    print(N)
elif N < 100:
    print(9)
elif N < 1000:
    print(N - 99 + 9)
elif N < 10000:
    print(900 + 9)
elif N < 100000:
    print(N - 9999 + 909)
else:
    print(90909)

Solution (Python):
n = int(input())
 
k = len(str(n))
 
if k == 1:
	print(n)
elif k == 6:
	print(90909)
elif k == 2:
	print(9)
elif k == 3:
	print(9 + n - 100 + 1)
elif k == 4:
	print(9 + 999 - 100 + 1)
else:
	print(909 + n - 10000 + 1)

Solution (Python):
N = int(input())

i = 1
ans = 0
while i<len(str(N)):
	ans += 9* (10**(i-1))
	i += 2

if i==len(str(N)):
	ans += (N - 10**(i-1)+1)

print(ans)

Solution (Python):
N = int(input())

def check(num):
    
    if num//100000 != 0:
        return False
    elif num//10000 != 0:
        
        return True
    elif num//1000 != 0:
        
        return False
    elif num//100 != 0:
        
        return True
    elif num//10 != 0:
        
        return False
    else:
        
        return True

print(sum(check(i) for i in range(1,N+1)))

Solution (Python):
n=int(input())
x=0
for i in range(1,n+1):
    if i<10 or (i>=100 and i<1000) or (i>=10000 and i<100000):
        x+=1
print(x)

Solution (Python):
import sys

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

if __name__ == "__main__":
    n = int(input())
    digits = len(str(n))

    ans = 0
    for i in range(1, digits+1):
        if i % 2 == 0:
            continue

        limit = n+1 if i == digits else 10**i
        for j in range(10**(i-1), limit):
            ans += 1

    print(ans)

Solution (Python):
N = int(input())

num = 0

if N == 100000:
    num = 90909
elif 9999 < N < 100000:
    num = 909 + N -9999
elif 999 < N  <= 9999:
    num = 909
elif 99 < N <= 999:
    num = 9 + N -99
elif 9 < N <= 99:
    num = 9
else:
    num = N

print(num)

Solution (Python):


N=int(input())

if int(N/(10**5))>=1:
    print((10-1)+(10**3-10**2)+(10**5-10**4))
elif int(N/(10**4))>=1:
    print((10-1)+(10**3-10**2)+(N+1-10**4))
elif int(N/(10**3))>=1:
    print((10-1)+(10**3-10**2))
elif int(N/(10**2))>=1:
    print((10-1)+(N+1-10**2))
elif int(N/10)>=1:
    print(10-1)
else:
    print(N+1-1)

Solution (Python):
num = int(input())
if num < 10:
  print(num)
elif num < 100:
  print(9)
elif num < 1000:
  print(num -90)
elif num < 10000:
  print(909)
elif num < 100000:
  print(num - 9090)
elif num == 100000:
  print(90909)

Solution (Python):
n = int(input())
result = 0
for i in range(n):
    k = len(str(i+1))
    if k % 2 == 1:
        result += 1
print("{}".format(result))

Solution (Python):
N = int(input())

ans = 0
if int(N/10) >= 1:
  ans += 9
  if int(N/1000) >= 1:
    ans += 900
    if int(N/100000) >= 1:
      ans += 90000
    else:
      ans += max(N - 9999, 0)
  else:
    ans += max(N - 99, 0)
else:
  ans += N

print(ans)

Solution (Python):
s=int(input())
d=len(str(s))
ans=0
for i in range(d-1):
    if i%2==0:
        ans+=9*(10**i)
for i in range(10**(d-1),s+1):
    if len(str(s))%2!=0:
        ans+=1
print(ans)

Solution (Python):
n = int(input())
if 1 <= n <= 9:
    print(n)
if 10 <= n <= 99:
    print(9)
if 100 <= n <= 999:
    print(n-99+9)
if 1000 <= n <= 9999:
    print(900+9)
if 10000 <= n <= 99999:
    print(n-9999+900+9)
if 100000 <= n <= 999999:
    print(90000+900+9)

Solution (Python):
N = int(input())
ans = 0
if N >= 9:
  ans += 9
else:
  ans += N
if N >= 999:
  ans += 900
elif N >= 100:
  ans += N - 99
if N >= 99999:
  ans += 90000
elif N >= 10000:
  ans += N - 9999
print(ans)

Solution (Python):



N = int(input())


ans = 0
for i in range(1, N + 1):
    if len(str(i)) % 2 != 0:
        ans += 1


print(ans)

Solution (Python):
N = input()
length = len(N)
n = int(N)
dic = {1:9,3:900,5:90000}
if length == 1:
    ans = n
elif length == 2:
    ans = 9
elif length == 3:
    ans = n - 90
elif length == 4:
    ans = 909
elif length == 5:
    ans = n - 9090
elif length == 6:
    ans = 90909
print(ans)

Solution (Python):
N=input()
n = int(N)
nketa =len(N)
ans = 0
if nketa%2==1:
    ans += n - 10**(nketa-1) +1

if nketa > 1:
    for i in range(1,nketa):
        if i%2 == 1:
            ans += 10**i - 10**(i-1)
print(ans)

Solution (Python):
n=int(input())

res=0
if n < 10:
    res=n
elif 10 <= n and n < 10**2:
    res=9
elif 10**2 <= n and n < 10**3:
    res=9+(n-10**2)+1
elif 10**3 <= n and n < 10**4:
    res=9+900
elif 10**4 <= n and n < 10**5:
    res=9+900+(n-10**4)+1
elif n == 10**5:
    res = 9 + 900 + 90000
else:
    pass
print(res)