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 = int(input())
#N,A,B = map(int,input().split())
#X_list = list(map(int,input().split()))
#X1_list = [int(input()) for i in range(N)]
#X2_list = [list(map(int,input().split())) for i in range(N)]

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

Submission status: Accepted

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

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())

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

Submission status: Accepted

Solution code:
N = int(input())

digit = len(str(N))

#print(digit)

is_even = digit % 2 == 1
#print("is_even", is_even)

count = 0

for i in range(digit//2):
    count += 9 * 10**(2*i)
    #print("for", count)

if is_even:
    count += N - 10**(digit-1) + 1
    #print("if", count)

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N=int(input())

c=0
for i in range (1, N+1):
    i_list=list(str(i))
    digit=len(i_list)
    if digit%2==1:
        c+=1
    else: continue
        
print(c)

Submission status: Accepted

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

def answer(N):
    ans=0
    if N<10:
        return N
    ans += 9
    if N<100:
        return ans
    if N<1000:
        return ans + N-99
    ans += 900

    if N<10000:
        return ans
    ans += N-9999
    if N==100000:
        ans -=1
        
    return ans



print(answer(N))

Submission status: Accepted

Solution code:
sN = input()
N = int(sN)

ans = 0
for i in range(1, len(sN), 2):
    ans += (10 ** i - 10 ** (i - 1))

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

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
ans=-1
for i in range(a+1):
  if len(str(i))%2 == 1:
    ans+=1

print(ans)

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 = input()

N = int(N)

cnt = 0
for i in range(1, N + 1):
    keta = len(str(i))

    if keta % 2 == 0:
        continue
    else:
        cnt += 1


print(cnt)

Submission status: Accepted

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

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

num = [9, 0, 900, 0, 90000]

def main():
    n = ri()
    ans = 0
    for d in range(6):
        m = pow(10, d+1)
        if n < m:
            if d % 2 == 0:
                ans += n%m - (m//10-1)
            break
        else:
            ans += num[d]
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

print(sum(len(str(i)) % 2 for i in range(1, n + 1)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

n = int(input())

ans = 0
for i in range(n):
    if 1 <= i + 1 <= 9:
        ans += 1
    elif 100 <= i + 1 <= 999:
        ans += 1
    elif 10000 <= i + 1 <= 99999:
        ans += 1
    elif 1000000 <= i + 1 <= 9999999:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input()) # 数字を変数に格納

count = 0

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

print(count)

Submission status: Accepted

Solution code:
n1 = int(input())

if n1 < 10:
    print(n1)
elif n1 <= 99:
    print(9)
elif n1 < 1000:
    print(9 + (n1 - 99))
elif n1 <= 9999:
    print(909)
elif n1 < 100000:
    print(909 + (n1 - 9999))
else:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = str(input())

l = len(N)

if l <= 1:
	print(int(N))
elif l == 2:
	print(9)
elif l == 3:
	print(int(N[0]) * 100 + int(N[1]) * 10 + int(N[2]) - 90)
elif l == 4:
	print(999 - 90)
elif l == 5:
	print(int(N[0]) * 10000 + int(N[1]) * 1000 + int(N[2]) * 100 + int(N[3]) * 10 + int(N[4]) - 90 - 9000)
else:
	print(90909)

Submission status: Accepted

Solution code:
A = int(input())

if A<10:
    kotae=A
elif 10<=A<100:
    kotae=9
elif 100<=A<1000:
    kotae=A-90
elif 1000<=A<10000:
    kotae=909
elif 10000<=A<100000:
    kotae=A-9090
elif A==100000:
    kotae=90909
print(kotae)

Submission status: Accepted

Solution code:
N = int(input())

count = 0

for i in range(1,N+1):
    if 1 <= i <=9 or 100 <= i <= 999 or 10000 <= i <= 99999:
        count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
s=len(n)
n=int(n)
k=9
ans=0
if s==2: print(9)
elif s==4: print(909)
elif s==6: print(90909)
else:
  if s==1: print(n)
  elif s==3: print(9+n-99)
  elif s==5: print(909+n-9999)

Submission status: Accepted

Solution code:
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)

def main():
    N = int(input())
    num = 0
    if 1 <= N and N <= 9:
        num = N
    elif 10 <= N and N <= 99:
        num = 9
    elif 100 <= N and N <= 999:
        num = N - 90
    elif 1000 <= N and N <= 9999:
        num = 909
    elif 10000 <= N and N <= 99999:
        num = N - 9090
    else:
        num = 90909
    print(num)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

N = input()
d = len(N)
num = int(N)
e = d//2
if d%2 == 0:
    if e == 1:
        ans = 9
    elif e == 2:
        ans = 9 + 999-99
    else:
        ans = 9 + 999-99 + 99999-9999
else:
    if e == 0:
        ans = num
    elif e == 1:
        ans = 9 + num-99
    else:
        ans = 9 + 999-99 + num-9999

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

N = int(input())

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

print(res)

Submission status: Accepted

Solution code:
n = int(input())
s = len(str(n))
if s == 1:
    print(n)
elif s == 2:
    print(9)
elif s == 3:
    print(9 + (n-100) + 1)
elif s == 4:
    print(9 + 900)
elif s == 5:
    print(9 + 900 + (n-10000) + 1)
else:
    print(9 + 900 + 90000)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 20 20:47:47 2019

@author: Owner
"""

import numpy as np
import sys
import collections
import scipy.misc
import math
from operator import itemgetter
import itertools
import copy
import bisect
import heapq

#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

def find_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)

    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]
    

"""
N, X = map(int, input().split())

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

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())

# 多次元配列の宣言（あとでintにすること。）（タプルにすること。）
dp = np.zeros((N+1, 4,4,4))
    
all(nstr.count(c) for c in '753')

# 複数配列を並び替え
ABT = zip(A, B, totAB)
result = 0
# itemgetterには何番目の配列をキーにしたいか渡します
sorted(ABT,key=itemgetter(2))
A, B, totAB = zip(*ABT)
A.sort(reverse=True)

# 2進数のbit判定
(x >> i) & 1

# dp最小化問題
dp = [np.inf]*N
for n in range(N):
    if n == 0:
        dp[n] = 0
    else:
        for k in range(1,K+1):
            if n-k >= 0:
                dp[n] = min(dp[n], dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break
# 累積和
add = 1 # 問題によって決まる
res = 0
sums = [0]*(len(nums)+1)
for i in range(len(nums)):
    sums[i+1] = sums[i] + nums[i]
for i in range(0, len(nums), 2):
    left = i
    right = min(i+add, len(nums))
    tmp = sums[right] - sums[left]
    res = max(tmp, res)

#２分探索
li, ri = bisect.bisect_left(p_ac, l[i]-1), bisect.bisect_right(p_ac, r[i]-1)    

#ソート関数
org_list = [3, 1, 4, 5, 2]
new_list = sorted(org_list)
print(org_list)
print(new_list)
# [3, 1, 4, 5, 2]
# [1, 2, 3, 4, 5]

#Distance Transformation
    for h in range(0,H):
        for w in range(0,W):
            if h == 0 and w == 0:
                pass
            elif h == 0:
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h-1][W-w]+1)
            elif w == 0:   
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h][W-w-1]+1)
            else:
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h][W-w-1]+1, D[H-h-1][W-w]+1, D[H-h][W-w]+2)
            d_max = max(D[H-h-1][W-w-1], d_max)

"""


N = int(input())
    
def main():
    cnt = 0
    for n in range(1,N+1):
        if len(digit(n))%2 ==1:
            cnt+=1
    print(cnt)
        
                
                
                
            
            
                

    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=input()
N=int(n)

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

Submission status: Accepted

Solution code:
n = input()

s = len(n)

ans = 0


if s == 1:
    print(int(n))
    exit()

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

if s %2 != 0:
    ans += int(n) - (10**(s-1))+1

print(ans)

Submission status: Accepted

Solution code:
# 2019/08/04
# AtCoder Beginner Contest 136 - B

# Input
n = int(input())

# Calc
ans = 0
for i in range(1, n+1):
    if i < 10 or (i > 99 and i < 1000) or (i > 9999 and i < 100000):
        ans = ans + 1

# Output
print(ans)

Submission status: Accepted

Solution code:
def resolve():

    n = int(input())

    ans = 0

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

    print(ans)
    
resolve()

Submission status: Accepted

Solution code:
#coding : utf-8

import os
import sys

N = int(input())

if N < 10:
	print(N)

elif N < 100:
	print(9)

elif N < 1000:
	print(9 + N - 99)

elif N < 10000:
	print(9 + 999 - 99)

elif N < 100000:
	print(9 + 900 + N - 9999)

elif N == 100000:
	print(9 + 900 + 90000)

Submission status: Accepted

Solution code:
N = input()

if len(N) == 1:
    print(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)
elif len(N) == 6:
    print(90909)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(1,N+1):
    if i<10 or (i>99 and i<1000) or (i>9999 and i<100000):
        ans += 1
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0
for i in range(1, N + 1):
    if N // 10**5:
        cnt = 90909
    elif N // 10**4:
        cnt = (N - 10**4 + 1) + 900 + 9
    elif N // 10**3:
        cnt = 900 + 9
    elif N // 10**2:
        cnt = (N - 10**2 + 1) + 9
    elif N // 10:
        cnt = 9
    else:
        cnt = N
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def INT(): return int(input())


def main():
    N = INT()
    count = 0

    for i in range(N):
        if len(str(i+1)) == 1 or len(str(i+1)) == 3 or len(str(i+1)) == 5:
            count += 1

    print(count)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())

if N==100000:
  print(90000+900+9)
elif N>=10000:
  print(N-10000+1+900+9)
elif N>=1000:
  print(909)
elif N>=100:
  print(N-100+1+9)
elif N>=10:
  print(9)
else:
  print(N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def uneven_numbers(N: int)->int:
    if N < 10:
        return N
    elif N < 100:
        return 9
    elif N < 1000:
        return N-90
    elif N < 10000:
        return 909
    elif N < 100000:
        return N - 9090
    else:
        return 90909


if __name__ == "__main__":
    N = int(input())

    ans = uneven_numbers(N)
    print(ans)

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 = 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:
N = int(input())

sum = 0
for n in range(1, N+1):
    s = str(n)
    c = len(s)
    if c % 2 == 0:
        continue
    sum +=1

print(sum)

Submission status: Accepted

Solution code:
N = int(input())
a = list(range(1, 10)) + list(range(100, 1000)) + list(range(10000, 100000))
for index, value in enumerate(a):
  if value > N:
    print(index)
    exit()

print(len(a))

Submission status: Accepted

Solution code:
N = int(input())
def f(i):
    for j in range(1, 7):
        if 10**j > i:
            return j
ans = 0
for i in range(1, N+1):
    if f(i) % 2 != 0:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
def numOfDigits(num):
    return len(str(num))
ans = 0
while n > 0:
    if numOfDigits(n)%2 == 1:
        ans += 1
    n -= 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N+1):
	if 1<=i and i<=9:
		count += 1
	elif 100<=i and i<=999:
		count += 1
	elif 10000<=i and i<=99999:
		count += 1

print(count)

Submission status: Accepted

Solution code:
N = int(input())
digit = len(str(N))
one = 9
three = 900
five = 90000

if digit == 6:
    print(str(five+three+one))
elif digit == 5:
    print(str(three+one+(N-9999)))
elif digit == 4:
    print(str(three+one))
elif digit == 3:
    print(str(one+N-99))
elif digit == 2:
    print(str(one))
else:
    print(str(N))

Submission status: Accepted

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

for i in range(1, n + 1):
    if i < 10:
        count += 1
    elif i >= 10 ** 2 and i < 10 ** 3:
        count += 1
    elif i >= 10 ** 4 and i < 10 ** 5:
        count += 1
print(count)

Submission status: Accepted

Solution code:
from sys import stdin

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

    ans = 0
    for i in range(1, N + 1):
        if any((1 <= i <= 9,
                100 <= i <= 999,
                10000 <= i <= 99999)):
            ans += 1
    print(ans)

input = lambda: stdin.readline()
main()

Submission status: Accepted

Solution code:
n=input()
l=len(n)
n=int(n)
if l==1:
    print(n)
elif l==2:
    print(9)
elif l==3:
    print(n-90)
elif l==4:
    print(909)
elif l==5:
    print(n-90-9000)
else:
    print(90909)

Submission status: Accepted

Solution code:
import math
N=int(input())
L=math.log10(N)

if L<1.:
    print(N)
elif 1.<= L < 2.:
    print(9)
elif 2.<= L < 3.:
    print(N-100+1+9)
elif 3.<= L < 4.:
    print(909)
elif 4.<= L < 5.:
    print(N-10000+1+909)
elif L==5.:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(N):
    if ( 0 < i+1  and i +1 <10 ) :
        ans = ans +1
    elif ( 99 < i+1  and i +1 <1000 ) :
        ans = ans +1
    elif (  9999 <i+1 and i + 1  <100000 ) :
        ans = ans +1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
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())

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

print(count)

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())
ans = 0
i = 1
while i <= n:
    ans += 1 
    i += 1
    if len(str(i)) % 2 == 0:
        i *= 10
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
l = len(str(N))
ans = 0

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

print(ans)
#print(l)

Submission status: Accepted

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


def main():
    n = int(input().strip())
    if n >= 100000:
        r = (99999 - 10000 + 1) + (999 - 100 + 1) + (9 - 1 + 1)
    elif n >= 10000:
        r = (n - 10000 + 1) + (999 - 100 + 1) + (9 - 1 + 1)
    elif n >= 1000:
        r = (999 - 100 + 1) + (9 - 1 + 1)
    elif n >= 100:
        r = (n - 100 + 1) + (9 - 1 + 1)
    elif n >= 10:
        r = (9 - 1 + 1)
    else:
        r = n - 1 + 1
    print('%d' % r)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

if 1<=n<=9:
        print(n)
elif 10<=n<=99:
        print(9)
elif 100<=n<=999:
        print(9+n-99)
elif 1000<=n<=9999:
        print(909)

elif 10000<=n<=99999:
        print(9+900+n-9999)

elif n==100000:
        print(9+900+n-9999-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())

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

print(cnt)

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:
import sys

fin = sys.stdin.readline
num = str(fin()).split()[0]

sum = 0
for i in range(len(num) // 2):
    sum += 9 * (10 ** (i*2))

if len(num) % 2 == 0:
    # 桁数が偶数の場合
    print(sum)
else:
    print(sum + int(num) - 10 ** (len(num) - 1) + 1)

Submission status: Accepted

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

def solve():
    res = len(tuple(0 for i in range(int(input())) if len(str(i+1))%2))
    
    return str(res)

if __name__ == '__main__':
    print(solve())

Submission status: Accepted

Solution code:
import math


def main(n):
    # keta = int(math.log10(n)) + 1
    count = 0
    for i in range(1, n + 1):
        keta = int(math.log10(i) + 1)
        if (keta % 2) == 1:
            count += 1
    return count


if __name__ == '__main__':
    n = int(input())
    print(main(n))

Submission status: Accepted

Solution code:
N = int(input())
L = len(str(N))

ans = 0

for l in range(1, L, 2):
    if l != L:
        ans += 9 * 10 ** (l-1)

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
N_uneven = 0
for i in range(1,N+1):
   if i>0 and i<10:
       N_uneven+=1
   elif i>99 and i<1000:
       N_uneven+=1
   elif i>9999 and i <100000:
       N_uneven+=1
   else:
       pass
print(N_uneven)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a  = input()

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]

N = int(input())
if N<10:
    print(N)
elif 10<=N<100:
    print(9)
elif 100<=N<1000:
    print(9 + (N - 99))
elif 1000<=N<10000:
    print(9 + 900)
elif 10000<=N<100000:
    print(9 + 900 + (N - 9999))
else:
    print(9 + 900 + 90000)

Submission status: Accepted

Solution code:
N = input()

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

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)
else:
    print(90909)

Submission status: Accepted

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

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

print(count)

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:
N = int(input())

hitoketa = min(max(N - 0,0), 9)
sanketa = min(max(N - 99,0), 900)
goketa = min(max(N - 9999, 0), 90000)


print(hitoketa + sanketa + goketa)

Submission status: Accepted

Solution code:
inpl = lambda: list(map(int,input().split()))
N = int(input())
ans = 0
for i in range(1,N+1):
    if len(str(i)) % 2:
        ans += 1
print(ans)

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())

ans=0
if n<=9:
  ans=n
elif n<=99:
  ans = 9
elif n<=999:
  ans = 9 + n-100+1
elif n<=9999:
  ans = 9+ 999-100+1
elif n<=99999:
  ans = 9+ 999-100+1 +n-10000 +1
elif n<=999999:
  ans = 9+ 999-100+1 +99999-10000 +1
elif n==100000:
  ans = 9+ 999-100+1 +99999-10000 +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:
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 <= 9:
  print(N)
elif N >= 10 and N <= 99:
  print(9)
elif N >= 100 and N <= 999:
  print(9+N-100+1)
elif N >= 1000 and N <= 9999:
  print(909)
elif N >= 10000 and N <= 99999:
  print(909+N-10000+1)
elif N == 100000:
  print(90909)

Submission status: Accepted

Solution code:
def int_multiple():
    return  [int(c) for c in input().split()]

def int_single():
    return int(input())

def str_multiple():
    return [c for c in input().split()]

def str_single():
    return input()

# start

n = int_single()

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

print(r)

Submission status: Accepted

Solution code:
N = int(input())
nums = len(str(N))

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

Submission status: Accepted

Solution code:
n = int(input())
if n >= 10**5:
  print(90909)
elif n >= 10**4:
  print(n - 10000 + 910)
elif n >= 10**3:
  print(909)
elif n >= 10**2:
  print(n - 100 + 10)
elif n >= 10**1:
  print(9)
elif n >= 10**0:
  print(n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def main():
    n = int(sys.stdin.readline().strip())

    def digit(num):
        if num < 10:
            return 1
        return digit(num // 10) + 1

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


main()

Submission status: Accepted

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

def digits(n):
    dig = 1
    n //= 10
    while n:
        dig += 1
        n //= 10
    return dig

for i in range(1, N+1):
    if digits(i) % 2 == 1:
        count += 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())

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

print(odd_count)

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())

keta = len(str(N))
if keta == 1:
    ans = N
elif keta == 2:
    ans = 9
elif keta == 3:
    ans = N-90
elif keta == 4:
    ans = 909
elif keta == 5:
    ans = N-90-9000
else:
    ans = 90909

print(ans)

Submission status: Accepted

Solution code:
import math
 
N = int(input())
 
count = 0
for i in range(1, N+1):
  if math.floor(math.log10(i)) % 2 == 0:
    count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
#debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    N = II()

    # 5桁以上
    if N == 10**5:
        print(90909)
        return
    # 5桁
    if N > 9999:
        print(N-10000+1+909)
        return

    # 4桁
    if N > 999:
        print(900+9)
        return

    # 3桁
    if N > 99:
        print(N-100+1 + 9)
        return

    # 2桁
    if N > 9:
        print(9)
        return

    # 1桁
    print(N)


solve()

Submission status: Accepted

Solution code:
import math


def get_num():
    return int(input())


n = get_num()
max_digit = math.floor(math.log10(n))
cnt = 0
for i in range(0, max_digit, 2):
    cnt += (10 ** (i + 1) - 10 ** i)

if max_digit % 2 == 0:
    cnt += (n - 10 ** max_digit + 1)

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

counter = 0

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

print(counter)