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



Sample input:
11


Sample output:
9

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
if N == 100000:
  x = 90909
elif N >= 10000:
  x = 909 + N - 10000 + 1
elif N >= 100:
  if N >= 1000:
    x = 909
  else:
    x = 9 + N - 100 + 1
elif N >= 1:
  if N >= 10:
    x = 9
  else:
    x = N
    
print(x)

Submission status: Accepted

Solution code:
N = int(input())						# 5


ans = 0

#1:1-9
if 1<=N<=9:
	ans += N

#2:10-99
if 10<=N:
	ans += 9

#3:100-999
if 100<=N<=999:
	ans += N-99

#4:1000-9999
if 1000<=N:
	ans += 900

#5:10000-99999
if 10000<=N<=99999:
	ans += N-9999


#6:100000-999999
if 100000<=N:
	ans += 90000


print(ans)

Submission status: Accepted

Solution code:
n = int(input())

cnt = 0
i = 1
while i <= n:
    j = i * 10
    if j > n + 1:
        j = n + 1
    cnt += j - i
    i = j * 10
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
count=0
if n<10:
    print(n)
else:
    count +=9
    if n<100:print(count)
    elif 100<=n<1000:
        count +=n-100+1
        print(count)
    else:
        count +=900
        if n<10000:print(count)
        elif 10000<=n<100000:
            count +=n-10000+1
            print(count)
        else:
            count +=90000
            print(count)

Submission status: Accepted

Solution code:
n=int(input())
ans=0

if n<10:
    ans=n
elif n<100:
    ans=9
elif n<1000:
    ans=n-90
elif n<10000:
    ans=909
elif n<100000:
    ans=n-9090
else:
    ans=90909

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ct = 0
for i in range(N):
  k = i+1
  order = 0
  while(k>0):
  	order += 1
  	k //= 10
  if(order % 2 != 0):
    ct += 1
print(ct)

Submission status: Accepted

Solution code:
N = int(input())
a = 0

if N < 10:
    a = N
elif 10 <= N <100:
    a = 9
elif 100 <= N < 1000:
    a = N - 90
elif 1000 <= N < 10000:
    a = 909
elif 10000 <= N < 100000:
    a = N - 9090
else :
    a = 90909

print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input().strip()
nLen = len(n)
n = int(n)
ans = 0
if nLen == 1:
    ans = n
elif nLen == 2:
    ans = 9
elif nLen == 3:
    ans = n - 99 + 9
elif nLen == 4:
    ans = 9 + 900
elif nLen == 5:
    ans = n - 9999 + 900 + 9
elif nLen == 6:
    ans = 90909
print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
n=int(input())
if n==100000:print(90909)
elif 9999<n and n<100000:print(n-9090)
elif 999<n and n<10000:print(909)
elif 99<n and n<1000:print(n-90)
elif 9<n and n<100:print(9)
else:print(n)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0

if n <= 9:
    ans = n

elif 10 <= n <= 99:
    ans = 9

elif 100 <= n <= 999:
    ans = n - 90

elif 1000 <= n <= 9999:
    ans = 909

elif 10000 <= n <= 99999:
    ans = n - 9090

elif 100000 <= n <= 999999:
    ans = 90909

print(ans)

Submission status: Accepted

Solution code:
n = input()
l = len(n)

if l == 1:
  print(n)
elif l%2==1:
  tmp = sum([(10**(i-1))*9 for i in range(1, l, 2)])
  ans = tmp+ (int(n)-10**(l-1)+1)
  print(ans)
else:
  ans = sum([(10**(i-1))*9 for i in range(1, l, 2)])
  print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

s=len(str(N))

ret=0
for i in range(1,s+1):
    if i%2==0:
        continue
    if(i==s):
        ret+=N-10**(i-1)+1
    else:
        ret+=9*10**(i-1)

print(ret)

Submission status: Accepted

Solution code:
N = int(input())
N_keta = len(str(N))
ans = 0
if N_keta % 2 == 1:
  ans += N-10**(N_keta-1)+1
  for keta in range(N_keta-1,0,-1):
    if keta % 2 == 1:
      ans += (10**keta-1)-(10**(keta-1))+1
else:
  for keta in range(N_keta-1,0,-1):
    if keta % 2 == 1:
      ans += (10**keta-1)-(10**(keta-1))+1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
c = 0
for i in range(1,n + 1):
    if i < 10:
        c += 1
        continue
    elif 100 <= i and i < 1000:
        c += 1
        continue
    elif 10000 <= i and i< 100000:
        c += 1
        continue
print(c)

Submission status: Accepted

Solution code:
def func(len_a):
    ans = ""
    for i in range(1, len_a):
        if i & 1 == 0:
            ans += "0"
        elif i & 1 == 1:
            ans += "9"
    return ans

def main():
    a = input()
    len_a = len(a)
    if len_a & 1 == 0:
        ans = func(len_a)
        print(ans)
    else:
        if len_a == 1:
            print(a)
        else:
            ans = int(func(len_a-1))
            ans = ans + ( int(a) - 10 ** (len_a-1) ) + 1
            print(ans)


main()

Submission status: Accepted

Solution code:
n=int(input())
s=str(n)
l=len(s)
total=0
for i in range(1,l,2):
    total+=pow(10,i-1)*9
if l%2==1:
    total+=n-pow(10,l-1)+1
print(total)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

if n < 9:
    ans = n
elif n >= 9 and n < 100:
    ans = 9
elif n >= 100 and n < 999:
    ans = 9 + (n - 100 + 1)
elif n >= 999 and n < 10000:
    ans = 9 + 900
elif n >= 10000 and n < 99999:
    ans = 9 + 900 + (n - 10000 + 1)
else:
    ans = 9 + 900 + 90000

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for k in range(1,n+1):
    if k >= 1 and k <= 9:
        cnt += 1
    elif k >= 100 and k <= 999:
        cnt += 1
    elif k >= 10000 and k <= 99999:
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

ans = 0

while True:
    if len(n) == 0:
        break
    if len(n) == 1:
        ans = ans + int(n)
    elif len(n) % 2 != 0:
        ans = ans + int(n) - int((len(n) - 1) * '9')
    n = (len(n) - 1) * '9'

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())

n = N

count = 0

num = 0

while n >= 10:
    n = n / 10
    count = count + 1

if(int(n) != 0):
	n = N - (10 ** count) + 1

for i in range(count + 1):
    if(i % 2 == 1):
        num = num + (0.9 * (10 ** i))

if(count % 2 == 0):
    num = num + n

print(int(num))

Submission status: Accepted

Solution code:
N=int(input())
import math
if 0<=math.log10(N)<1:
  print(N)
elif 1<=math.log10(N)<2:
  print(9)
elif 2<=math.log10(N)<3:
  print(N-90)
elif 3<=math.log10(N)<4:
  print(909)
elif 4<=math.log10(N)<5:
  print(N-9090)
elif 5<=math.log10(N):
  print(90909)

Submission status: Accepted

Solution code:
import numpy as np

def main():
    n = int(input())
    count = 0
    for num in range(1, n+1):
        keta = int(np.log10(num))+1
        if keta % 2 != 0:
            count += 1

    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N = input()

sum = 0
for i in range(1, len(N) + 1, 2):

    if int(N) >= 10 ** i:
        sum += (10**i - 1) - (10**(i - 1) - 1)
    else:
        sum += int(N) - (10**(i - 1) - 1)

print(sum)

Submission status: Accepted

Solution code:
n = int(input())
if n <= 9:
  print(n)
else:
  if n <= 99:
    print(9)
  else:
    if n <= 999:
      print(n - 90)
    else:
      if n <= 9999:
        print(909)
      else:
        if n <= 99999:
          print(n - 9090)
        else:
          print(90909)

Submission status: Accepted

Solution code:
N = int(input())
if N < 10:
    ans = N
elif N < 100:
    ans = 9
elif N < 1000:
    tmp = N - 100 + 1
    ans = tmp + 9
elif N < 10**4:
    ans = 909
elif N < 10**5:
    tmp = N - 10**4 + 1
    ans = tmp + 909
else:
    ans = 90909
print(ans)

Submission status: Accepted

Solution code:
n=int(raw_input())
if n < 10:
    print n
elif n < 100:
    print 9
elif n < 1000:
    print (n - 90)
elif n < 10000:
    print 909
elif n < 100000:
    print (n-90-9000)
else:
    print 90909

Submission status: Accepted

Solution code:
N = int(input())

if N <= 9:
  print(N)
elif N <= 99:
  print('9')
elif N <= 999:
  print(N - 90)
elif N <= 9999:
  print('909')
elif N <= 99999:
  print(N - 9090)
else:
  print('90909')

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    ans = 0
    if n >= 10000:
        max_n = 99999 if n >= 100000 else n
        ans += max_n - 9999
    if n >= 100:
        max_n = 999 if n >= 1000 else n
        ans += max_n - 99
    if n >= 1:
        max_n = 9 if n >= 10 else n
        ans += max_n
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
if N <= 99:
  num = min(N, 9)
elif N <= 9999:
  num = 9 + min(N-99, 999-99)
elif N <= 999999:
  num = 909 + min(N-9999, 99999-9999)
print(num)

Submission status: Accepted

Solution code:
n = int(input())
s = 0
if n < 10:
  s = n
if (n >= 10) & (n < 100):
  s = 9
if (n >= 100) & (n < 1000):
  s = 9 + n - 100 + 1
if (n >= 1000) & (n < 10000):
  s = 909
if (n >= 10000) & (n < 100000):
  s = 909 + n - 10000 + 1
if n == 100000:
  s = 90909
print(s)

Submission status: Accepted

Solution code:
n = int(input())

if n <= 9:
    print(n)
elif 9 < n <= 99:
    print(9)
elif 99 < n <= 999:
    print(n - 90)
elif 999 < n <= 9999:
    print(909)
elif 9999 < n <= 99999:
    print(n - 9090)
else:
    print(90909)

Submission status: Accepted

Solution code:
# coding: utf8

import math

def read_int():
    return int(input())

 
def read_int_n():
    return list(map(int, input().split()))
 
 
def read_str():
    return input()
 
 
def read_str_n():
    return list(map(int, input().split()))

def main():
    n = read_int()
    keta = math.floor(math.log10(n)) + 1
    ans = 0
    for i in range(1, keta):
        if i % 2 == 0:
            continue
        else:
            plus = ( 10 ** i ) - (10 ** (i-1))
            ans += plus
    if keta % 2 == 1:
        ans += n - (10 ** (keta - 1)) + 1
    print(ans)

main()

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for i in range(1, n+1):
    if 10 <= i <= 99 or 1000 <= i <= 9999 or i == 100000:
        continue
    count += 1
print(count)

Submission status: Accepted

Solution code:
n=int(input())
keta=len(str(n))
count=0
i=1
# if keta%2==0:
# 	while keta-i>=0:
# 		10**i-10**(i-1)
# 		i+=2
# else:
# 	count+=n-10**(keta-1)+1

if keta%2!=0:
	count+=n-10**(keta-1)+1
	keta-=1
while keta-i>=0:
		count+=10**i-10**(i-1)
		i+=2
print(count)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Uneven Numbers
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from collections import defaultdict, deque
import math
from math import factorial
import fractions
import re

BIGNUM = 10 ** 9 + 7

def main():
    #A, B, C = map(int, input().split())
    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()

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
#!/usr/bin/env 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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:

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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(str(countodd-1))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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()

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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 )

Submission status: Accepted

Solution code:
n = input()

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[24]:


N = int(input())


# In[25]:


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


# In[26]:


print(ans)


# In[ ]:

Submission status: Accepted

Solution code:

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)

#9 #1 2 3 4 5 6 7 8 9
#0 #    10
#900 #100 101 102 ... 999
#0 #    1000
#90000 #10000 10001 ... 99999
#0 #    100000

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)