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:
n = input()
ans = 0
if len(n) % 2 == 0:
    length = len(n) - 1
    for i in range(length, -1, -2):
        if i == 1:
            ans += 9
        else:
            plus = '9' * i
            minus = '9' * (i - 1)
            ans += (int(plus) - int(minus))
    print(ans)
else:
    if int(n) <= 9:
        print(int(n))
    else:
        length = len(n)
        b = '9' * (length-1)
        c = int(n) - int(b)
        ans += c
        for i in range(length-2, -1, -2):
            if i == 1:
                ans += 9
            else:
                plus = '9' * i
                minus = '9' * (i-1)
                ans += (int(plus) - int(minus))
        print(ans)

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
# ABC136B - Uneven Numbers
def main():
    n = int(input())
    d = len(str(n))
    if d == 6:
        ans = 90909
    elif d in (4, 5):
        ans = 909 + max(0, n - 9999)
    elif d in (2, 3):
        ans = 9 + max(0, n - 99)
    else:
        ans = n
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

num = [1,10,100,1000,10000, 100000]
num2 = {1:9, 100:900, 10000:90000}
num3 = {1:1,2:10,3:100,4:1000,5:10000, 6:100000}
count = 0

for n in num:
    if len(str(n)) % 2 == 0: continue
    if len(str(N)) > len(str(n)):
#        print('unk')
#        print(N,n, num2[n])
        count += num2[n]
#print(count)
if len(str(N)) % 2 != 0:
#    count += num3[len(str(N))]*10-N
    count += N-num3[len(str(N))]+1

print(count)

Submission status: Accepted

Solution code:
N = input()

l = len(N)

_sum = 0
if l % 2 == 0:
    for i in range(l):
        _sum += 9*10**(i) if i % 2 == 0 else 0
else:
    for i in range(l-1):
        _sum += 9*10**(i) if i % 2 == 0 else 0
    _sum += int(N) - 10**(l-1) + 1

print(int(_sum))

Submission status: Accepted

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

N -= 1 if len(str(N)) == 6 else 0

count += N - 10000 + 1 if len(str(N)) == 5 else 0
count += min(900, N - 100 + 1) if len(str(N)) >= 3 else 0
count += min(9, N) if len(str(N)) >= 1 else 0

print(count)

Submission status: Accepted

Solution code:
N = int(input()) 
count = 0
#num = len(str(N))

while N > 0:
    num = len(str(N))
    #print(num)
    if num%2 == 0:
        N -=1
    else:
        count +=1
        N -=1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

if digit%2==0:
    for i in range(digit//2):
        ans*=100
        ans+=9
else:
    for i in range(digit//2):
        ans*=100
        ans+=9
    ans+=n-10**(digit-1)+1

print(ans)

Submission status: Accepted

Solution code:
import math
import numpy as np
a=int(input())
l=(np.arange(a)+1).tolist()
#print(l)
l_odd = [i for i in l if int(math.log10(i)) % 2 == 0]
#print(l_odd)
print(len(l_odd))

Submission status: Accepted

Solution code:
N = int(input())
def count(start, end):
  return end - start + 1
keta = 1
while True:
  if 10**keta > N:
    break
  else:
    keta += 1
num = 0
for k in range(1, keta+1):
  if k % 2 == 1:
    num += count(10**(k-1), min(N, 10**k-1))
print(num)

Submission status: Accepted

Solution code:
import math
n = int(input())
k = int(math.log10(n))
ans = 0
if k % 2 == 1:
    for i in range(k):
        if i % 2 == 0:
            ans += 10 ** (i+1) - 10 ** i
    print(ans)
else:
    for i in range(k-1):
        if i % 2 == 0:
            ans += 10 ** (i+1) - 10 ** i
    ans += n - 10 ** k + 1
    print(ans)

Submission status: Accepted

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
n = input()
cnt = 0
for i in range(1, int(n) + 1):
    if len(str(i)) % 2 == 1:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(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 - 9090)
else:
    print(90909)

Submission status: Accepted

Solution code:
N=int(input())
tmp=0
if N<10:
  print(N)  
elif N<1000:
  if 9+N-99<0:
    print(9)
  else:
    print(9+N-99)
elif N<100000:
  if 9+900+N-9999<0:
    print(909)
  else:
    print(9+900+N-9999)
elif N==100000:
  print(90909)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
sum = 0

for i in range(10000):
  q, mod =divmod(N, 10**(i+1))
  if i == 0:
    if q > 0:
      sum += 9
    else:
      sum += N
      break
  elif i % 2 == 0:
    if q > 0:
      sum += 9*(10**i)
    else:
      mod2 = N - 10**i
      sum += mod2 + 1
      break
  else:
    if q == 0:
      break
      
print(sum)

Submission status: Accepted

Solution code:
n = input().rstrip()
n_sp = list(map(int, list(n)))
dig  = len(n_sp)
odd = 0
 
if dig == 1:
    print(n_sp[0])

else:
    for i in range(1, dig, 2):
        odd += int("9" * i) - 10 ** (i-1) + 1
 
    if dig%2 == 1:
        odd += int(n) - 10 ** (dig-1) +1
 
    print(odd)

Submission status: Accepted

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

if getDigit%2 == 0: digit = getDigit - 1
else : digit = getDigit
x = '9'
x = int(x.rjust(digit,'9'))

n = int(n)
diff = max(x - n,0)
ans = 9

for i in range(1,int(digit/2)+1):
    ans += 100 ** i * 9
    
ans -= diff

print(ans)

Submission status: Accepted

Solution code:
ns = input().rstrip()
n = int(ns)
k = len(ns)
if k == 1:
    ans = n
else:
    ans = 0
    for i in range(0, k - 1, 2):
        ans += 9 * (10 ** i)
    if k % 2 == 1 and k > 2:
        ans += n - (10 ** (k - 1)) + 1
print(ans)

Submission status: Accepted

Solution code:
N=int(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-9090)
else:
  print(90909)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N = inputInt()
 
	ans = 0
	for i in range(1, N+1):
		tmp = str(i)
		tmp = len(tmp)
		if tmp % 2 == 1:
			ans += 1
 
	print(ans)


if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
import math

N = int(input())

dig = int(math.log10(N))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for i in range(1,N+1):
  istr = str(i)
  if len(istr) % 2 == 1:
  	count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())

N_length = len(str(N))
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
def calcNum(l):
    if(l == 1):
        return 9
    return 10**l - 10**(l-1)

def getdigit(num):
    digit=0
    while(num != 0):
        num //= 10
        digit+=1
    return digit

# 100 -> 3
digit = getdigit(n)
ans = 0
if(digit % 2 == 0):
    amari = 0
else:
    amari = n - 10**(digit-1)+1
# print(digit, amari)
# 100 -> 0, 1, 2
for i in range(0, digit):
    if i % 2 != 0:
        # print("level",i)
        ans += calcNum(i)
# print(ans)
print(ans+amari)

Submission status: Accepted

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

Submission status: Accepted

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

for x in range(1, n+1):
    if x < 10 or 100 <= x < 1000 or 10000 <= x < 100000:
        cnt += 1

print(cnt)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N = input()
ans = 0
for n in range(1, len(N), 2):
    ans += 9 * 10 ** (n-1)

if len(N) == 1:
    ans = int(N)


elif len(N) % 2 != 0:
    ans += (10 ** (len(N)-1)) * (int(N[0])-1)
    ans += int(N[min(1, len(N)-1):]) + 1


print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n = str(input()) 
keta = (len(n))
max = int(keta/2)+1

count = 0
t = int(n)
if(keta%2==0):
    for i in range(1,max):
        count += 9*10**((2*(i-1)))
else:
    for i in range(1,max):
        count += 9*10**((2*(i-1)))
    t = t - 10**(keta-1)
    count += t
    count +=1
print(count)

Submission status: Accepted

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

NumDig = len(str(cc[0]))

# if odd, print 1. if even print 0
counter = 0

if (NumDig % 2 == 0):
  for idx in range(1, NumDig, 2):
    if idx == 1:
      counter = counter + 10**(idx)-1
    else:
      counter = counter + 10**(idx) - 10**(idx-1)
  #counter = counter + cc[0] - 10**(NumDig-1) + 1
      
if (NumDig % 2 != 0 ):
  for idx in range(1, NumDig, 2):
    if idx == 1:
      counter = counter + 10**(idx)-1
    else:
      counter = counter + 10**(idx)- 10**(idx-1)  
  counter = counter + cc[0] - 10**(NumDig-1) + 1
  
print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i = int(input())
100000
i1 = len(str(i))
sum1 = 0
for j in range(1, i1+1):
 if j % 2 == 0:
  sum1 = sum1
 elif j < i1:
  sum1 = sum1 + len(range(10**(j -1), 10**(j)))
 else:
  sum1 = sum1 + len(range(10**(j -1), i + 1 ))


print(sum1)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for x in range(1,10):
    if N >= x:
        ans = ans + 1
for g in range(100,1000):
    if N >= g:
        ans = ans + 1
for m in range(10000,100000):
    if N >= m:
        ans = ans + 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
n = int(input())
keta = int(len(str(n)))
c = 0



if keta ==1:
    print(n)
elif keta ==2:
    print(9)
elif keta ==3:
    print(9+n-10**2+1)
elif keta == 4:
    print(900+9)
elif keta == 5:
    print(9+900+n-10**4+1)
elif keta == 6:
    print(9+900+90000)

Submission status: Accepted

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

for x in range(1, N+1):
    if int(len(str(x))) % 2 != 0:
        count += 1
    else:
        count += 0
        
print(count)

Submission status: Accepted

Solution code:
A = int(input())
cnt = 0
for i in range(1, A+1):
    if (i < 10) or ((100 <= i) and (i < 1000)) or ((10000 <= i) and (i < 100000)):
        cnt = cnt + 1
print(cnt)

Submission status: Accepted

Solution code:
N=input()
n=len(N)
n=int(n)
num=0
num1=1
num2=1
for i in range(n-1):
    if(i%2==0):
        if(i>1):
            for k in range(i):
                num1=num1*10
                num2=num1
        num1=1
        num+=9*num2

if(int(N)>9):
    if(n%2==1):
        num+=int(N)-num2*100+1
else:
    if(n%2==1):
        num+=int(N)%(num2*100)

print(num)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
number_of_digits = len(str(n))
if number_of_digits == 6:
    print(90909)
elif number_of_digits == 5:
    print(90909 - (99999 - n))
elif number_of_digits == 4:
    print(909)
elif number_of_digits == 3:
    print(909 - (999 - n))
elif number_of_digits == 2:
    print(9)
elif number_of_digits == 1:
    print(9 - (9 - n))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = input()
    l = len(N)

    sum = 0
    for i in range(l):
        if i % 2 == 1:
            continue
        elif i == l - 1:
            sum += int(N) - 10 ** (l - 1) + 1
        else:
            sum += 9 * (10 ** i)

    print(sum)

Submission status: Accepted

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

import sys
input = sys.stdin.readline


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

    l = [str(i) for i in range(1, n + 1)]
    count = 0
    for i in l:
        if len(i) % 2 == 1:
            count += 1

    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n = list(map(int, input()))
if len(n) == 6:
        print(90909)
elif len(n) == 5:
        num = n[0] * 10000 + n[1] * 1000 + n[2] * 100 + n[3] * 10 + n[4]
        print((num - 10000) + 1 + 900 + 9)
elif len(n) == 4:
        print(909)
elif len(n) == 3:
        num = n[0] * 100 + n[1] * 10 + n[2] * 1
        print((num - 100) + 1 + 9)
elif len(n) == 2:
        print(9)
else:
        num=n[0]*1
        print(num)

Submission status: Accepted

Solution code:
n= input()
count = 0
if len(n)%2 == 0:
  for i in range(1,len(n),2):
    count += (9 * (10**(i-1)))
else:
  for i in range(1, len(n)-1,2):
    count += (9 * (10**(i-1)))
  count += (int(n)-(10**(len(n)-1))+1)

print(count)

Submission status: Accepted

Solution code:
n = int(raw_input())
if n < 10:
    print(n)
elif n >= 10 and n < 100:
    print(9)
elif n >=100 and n < 1000:
    print((n-100) + 10)#n-90
elif n >=1000 and n < 10000:
    print(909)
elif n >= 10000 and n < 100000:
    print((n-10000) + 910)
elif n == 100000:
    print(90909)

Submission status: Accepted

Solution code:
import  numpy   as  np

i_N =   int(input())

counter = 0

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

Submission status: Accepted

Solution code:

import sys
sys.setrecursionlimit(4100000)
a = str(input())
a = a
length = len(a)
b = len(a)
ans = 0
if b == 1:
    print(a)
else:
    for i in reversed(range(1,b+1)):
        if i%2 == 1 and i == b:
            temp = ""
            for k in range(i-1):
                temp += "9"
            ans += int(a[b-i:]) - int(temp)

        elif i%2 == 1:
            temp = 9*10**(i)//10

            ans += temp
    print(ans)

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
A = int(input())

if 1 <= A < 10:
  ans = len(range(1, A + 1))
elif 10 <= A < 100:
  ans = 9
elif 100 <= A < 1000:
  ans = 9 + len(range(100, A + 1)) 
elif 1000 <= A < 10000:
  ans = 9 + 900
elif 10000 <= A < 100000:
  ans = 9 + 900 + len(range(10000, A + 1))
else:
  ans = 9 + 900 + 90000

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

tmp = len(N)

if tmp == 1:
    print(int(N))
else:
    ans = 0
    for i in range(tmp):
        if i&1 == 1:
            ans += 10**(i) - 10**(i-1)
        elif i == tmp-1:
            ans += int(N) - int("9"*i)

    # if N[0] == "1" and N[1:]
    print(ans)

Submission status: Accepted

Solution code:
N=int(input())
cnt=0
for i in range(N+1):
  if len(str(i))%2==0:
    cnt+=0
  else:
    cnt+=1
print(cnt-1)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
i = input()
j = len(i)
k = int(i)
if j==1:
    print(k)
elif j ==2:
    print(9)
elif j==3:
    print(k-90)
elif j==4:
    print(909)
elif j==5:
    print(k-9999 + 909)
elif j ==6:
    print(90909)

Submission status: Accepted

Solution code:
n = input()
i = list(n)

r = 0
t = 0
c = 0
for a in i:
    c += 1
    r += t
    t = 0
    if c % 2 == 1:
        # 10 ** c -1 ~(10 ** c) - 1
        s = 10 ** (c - 1)
        e = 10 ** c
        t = len(range(s, e))
if c % 2 == 1:
  s = 10 ** (c - 1)
  e = int(n) + 1
  r += len(range(s, e))


print(r)

Submission status: Accepted

Solution code:
N = input().strip()
d = len(N)
N = int(N)

v = N

for i in range(2, d + 1, 2):
  a = min(10 ** i, N + 1)
  b = 10 ** (i - 1)
  v -= (a - b)

print(v)

Submission status: Accepted

Solution code:
a = int(input())

ans_cnt = 0

for idx in range(a):
	idx_unit = list(str(idx + 1))
	idx_count = 0
	for item in idx_unit:
		idx_count += len(item)
	
	if idx_count % 2 == 1:
#		print(idx_count)
		ans_cnt += 1

print(ans_cnt)

Submission status: Accepted

Solution code:
N = int(input())
N_base = N
i = 1
while True:
    mod = N%10
    N = N//10
    if N == 0 and mod != 0:
        break
    elif N == 0 and mod == 0:
        i += 1
        break
    else:
        i += 1
if i == 1:
    print(N_base)
else:
    num = 0
    for j in range(1,i+1,2):
        if j == i:
            num += N_base - 10**(i-1) + 1
        else:
            num += 10**(j) - 10**(j-1)
    print(num)

Submission status: Accepted

Solution code:

N = int(input())
if N < 10 :
    L = []
    for i in range(1, N + 1):
        L.append(i)
    print(len(L))

elif 10 <= N < 100:
    L = []
    for i in range(1, 10):
        L.append(i)
    print(len(L))

elif 100 <= N < 1000:
    L = []
    for i in range(1, 10):
        L.append(i)
    for i in range(100, N + 1):
        L.append(i)
    print(len(L))

elif 1000 <= N < 10000 :
    L = []
    for i in range(1, 10):
        L.append(i)
    for i in range(100, 1000):
        L.append(i)
    print(len(L))

elif 10000 <= N < 100000 :
    L = []
    for i in range(1, 10):
        L.append(i)
    for i in range(100, 1000):
        L.append(i)
    for i in range(10000, N + 1):
        L.append(i)
    print(len(L))

elif N == 100000 :
    L = []
    for i in range(1, 10):
        L.append(i)
    for i in range(100, 1000):
        L.append(i)
    for i in range(10000, 100000):
        L.append(i)
    print(len(L))

Submission status: Accepted

Solution code:
n = int(input())
count = 0
if n == 100000:
  count=90909
elif 10 ** 4 <= n and n < 10 ** 5:
  count = 9 + 900 + n - 10**4 + 1
elif 10**3 <= n and n < 10 **4:
  count = 909
elif 10 ** 2 <= n and n < 10 **3:
  count = 9 + n - 10**2 +1
elif 10 ** 1 <= n and n <10**2:
  count = 9
else:
  count = n
print(count)

Submission status: Accepted

Solution code:
n = input()
int_n = int(n)
n_len = len(n)

ans = 0
tmp = 0

if n_len == 1:
    ans = int_n
else:
    for i in range(1,n_len):
        if i % 2 == 1:
            ans += (10 ** i) - (10 ** (i-1))
    if (n_len % 2) == 1:
        tmp = int_n - (10**(n_len-1)) + 1
        ans += tmp
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
if n<=9:
  ans=n
elif n<=99:
  ans=9
elif n<=999:
  ans=9+n-99
elif n<=9999:
  ans=909
elif n<=99999:
  ans=909+n-9999
else:#n==10000
  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(9+900+N-9999)
elif N==100000:
  print(90909)

Submission status: Accepted

Solution code:
n=int(input())
x=sum=0
while True:
    r1 = 10**x
    r2 = 10**(x+1)
    if n < r1:
        break
    if r1 <= n < r2:
        sum += n - r1 + 1
        break
    else:
        sum += r2 - r1
    x += 2
print(sum)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
array = np.array([n+1 for n in range(N)])
log_array = np.log10(array).astype(np.int) + 1
infer = (log_array % 2 == 1).sum()
print(infer)

Submission status: Accepted

Solution code:
import math

n = int(input())

c = 0

k = int(math.log10(n)) 

for i in range(k+1):
    if i % 2 == 0 :
        if n < (10 ** (i+1)) :
            c = c + (n - 10 ** i) + 1
        else :
            c = c + (10 ** (i+1) - 10 ** i)

print(c)

Submission status: Accepted

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

# スペース区切りの整数の入力
a = input()

if len(str(a)) == 1:#1~9
    print("{}".format(a))
elif len(str(a)) == 2:  #10~99
    print("9")
elif len(str(a)) == 3: #100~999
    print("{}".format(int(str(a)) - 90))
elif len(str(a)) == 4:  #1000~9999
    print("909")
elif len(str(a)) == 5:  # 10000~99999
    print("{}".format(int(str(a)) - 9090))
else:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
number = int(input())

count = 0

if number >=0 and number < 10:  
    count+=number

elif number >=10 and number < 100:  
    count+=9

elif number >= 100 and number < 1000:
    count+=((number - 100) + 1)
    count+=9

elif number >= 1000 and number < 10000:
    count+=(9 + 900)

elif number >= 10000 and number < 100000:
    count=+((number - 10000) + 1)
    count+=(9 + 900)

elif number == 100000:
    count+=9+900+90000 

print(count)

Submission status: Accepted

Solution code:
import queue

"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""
N = int(input())
ans = 0
for i in range(1,N+1):
	if i > 0 and i < 10:
		ans += 1
	elif i >= 100 and i < 1000:
		ans += 1
	elif i >= 10000 and i < 100000:
		ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N < 10**1:
    print(N)
elif N < 10**2:
    print(9)
elif N < 10**3:
    print(N-99+9)
elif N < 10**4:
    print(909)
elif N < 10**5:
    print(N-9999+909)
else:
    print(90909)

Submission status: Accepted

Solution code:
#2桁までなら9個
#4桁までなら9＋数-99
#6桁までなら9＋数-99+数-9999
n=int(input())
c = len(str(n))
#print(c)

if c == 1:
  print(n)
elif c == 2:
  print(9)
elif c == 3:
  print(9+n-99)
elif c == 4:
  print(9+900)
elif c == 5:
  print(9+900+n-9999)
else:
  print(9+900+90000)

Submission status: Accepted

Solution code:
num = int(input())
 
arr = [(i + 1) for i in range(num) if len(str(i + 1)) % 2 != 0]
print(len(arr))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
a = int(len(s))
if a == 1:
  print(int(s[0]))
elif a == 2:
  print(9)
elif a == 3:
  print(10+int(s)-100)
elif a == 4:
  print(909)
elif a == 5:
  print(910+int(s)-10000)
elif a == 6:
  print(90909)

Submission status: Accepted

Solution code:
num = int(input())

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

Submission status: Accepted

Solution code:
# coding:utf-8

n = int(input())

keta = len(str(n))

count = 0

for i in range(keta):
    # 面倒なので0はとばす
    # 1 ~ 桁数-1まで考える
    if i == 0:
        continue
    elif i == 1:
        count += 9
    else:
        if i % 2:
            # 最上位桁は9パターン，それ以下は10パターン
            count += 10 ** (i-1) * 9

# 最上位桁のカウント
if keta % 2:
    count += n - 10 ** (keta - 1) + 1

print(count)

Submission status: Accepted

Solution code:
n=int(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-9090)
else:
  print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = len(str(n))
 
i = 0
c = 0
while i < l:
  if i == 0:
    if n < 10:
      c = n
      break
    else:
      c = 9
      i = i + 1
  elif i%2 == 1:
    i = i + 1
    continue
  elif i == (l-1):
    c = c + (n-((10**i)-1))
    i = i + 1
  else:
    c = c + ((10**(i+1))-(10**i))
    i = i + 1
 
print(c)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    n = input().strip()
    int_n = int(n)
    keta = len(n)
    # 桁ごとにマックスの数が決っている
    # あとは、指定された数から規定数を引けばいいはず
    # 1 -> 9 -> 9
    # 100 -> 999 -> 899
    # full - 100 -> x
    cnt = 0
    for i in range(1, keta + 1, 2):
        max_num = 10 ** (i) - 1
        min_num = 10 ** (i - 1) - 1
        cnt += max_num - min_num
        if keta == i:
            cnt -= max_num - int_n
    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
m = n
a = 0

i = len(str(n))

if i == 2:
    print(9)
elif i == 4:
    print(909)
elif i == 1:
    print(m)
elif i == 3:
    print(9 + n-99)
elif i == 5:
    print(909 + n-9999)
elif i == 6:
    print(90909)

Submission status: Accepted

Solution code:
import math

N = int(input())

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

num = 0
if num_digits % 2 != 0:
    num += (N - (10**(num_digits-1)) + 1)

for i in range(num_digits-1):
    if (i + 1) % 2 != 0: #奇数
        num += 9*10**i
    else:
        pass

print(num)

Submission status: Accepted

Solution code:
N=input()
n=len(N)
ans=0
if n%2==0:
    for i in range(1,n):
        if i%2==0:
            pass
        else:
            ans+=10**i-10**(i-1)
else:
    for i in range(1,n):
        if i%2==0:
            pass
        else:
            ans+=10**i-10**(i-1)
    ans+=int(N)-10**(n-1)+1      
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
if N >= 1 and N <= 9:
    ans = N
    print(ans)
    exit()

ans += 9
if N >= 10 and N <= 99:
    print(ans)
    exit()

if N >= 100 and N <= 999:
    ans += N - 99
    print(ans)
    exit()

ans += 999 - 99
if N >= 1000 and N <= 9999:
    print(ans)
    exit()


if N >= 10000 and N <= 99999:
    ans += N - 9999
    print(ans)
    exit()

ans += 99999 - 9999
if N == 100000:
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N < 10:
  print(N)
elif N > 9 and N < 100:
  print(9)
elif N > 99 and N < 1000:
  print(9 + N - 99)
elif N > 999 and N < 10000:
  print(909)
elif N > 9999 and N < 100000:
  print(909 + N -9999)
else:
  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 - 90)
elif n < 10000:
    print(909)
elif n < 100000:
    print(n - 9090)
else:
    print(90909)

Submission status: Accepted

Solution code:
N=int(input())
a=0
for i in range(N):
  if (i+1)//10==0:
    a+=1
  elif (i+1)//100==0:
    a+=0
  elif (i+1)//1000==0:
    a+=1
  elif (i+1)//10000==0:
    a+=0
  elif (i+1)//100000==0:
    a+=1
  else:
    a+=0
print(a)

Submission status: Accepted

Solution code:
n = input()
 
num = len(n)
 
if num == 1:
  print(n)
elif num == 2:
  print(9)
elif num == 3:
  result = (int(n)-100+1) + 9
  print(result)
elif num == 4:
  print(909)
elif num == 5:
  result = (int(n)-10000+1) + 900 + 9
  print(result)
else:
  print(90909)

Submission status: Accepted

Solution code:
N = int(input())

if 1<=N<10:
    print(N)

elif 10<=N<100:
    print(9)

elif 100<=N<1000:
    x = 9 + N -100 + 1
    print(x)

elif 1000<=N<10000:
    print(909)

elif 10000<=N<100000:
    x = 909 + N -10000 + 1
    print(x)

else:
    print(90909)

Submission status: Accepted

Solution code:
n=int(input())
d=len(str(n))

if d==1:
    print(n)
elif d==2 or d==3:
    c=9
    if d%2==0:
        print(c)
    else:
        print(c+n-10**(d-1)+1)
elif d==4 or d==5:
    c=909
    if d%2==0:
        print(c)
    else:
        print(c+n-10**(d-1)+1)
elif d==6:
    print("90909")

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

for i in range(N+1):
    if ( 1 <= i and i < 10) or (100 <= i and i < 1000) or (10000 <= i and i < 100000):
        ans = ans + 1

print(ans)