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())
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())
   
count = 0
for n in range(0, N+1):
    if 1 <= n <= 9:
        count = count + 1
    if 100 <= n <= 999:
        count = count + 1
    if 10000 <= n <= 99999:
        count = count + 1
print(count)

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 != 0:
    cnt += 1
    
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
s=str(n)

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

Submission status: Accepted

Solution code:
n = int(input())

def d(k):
    s = 0
    while k > 0:
        k //= 10
        s += 1
    return s

dn = d(n)
a = 0
for i in range(1, dn + 1):
    if i % 2 == 1:
        if n < 10 ** i:
            a += n - 10**(i- 1) + 1
        else:
            a += 10 ** i - 10 ** (i - 1)
print(a)

Submission status: Accepted

Solution code:
#create date: 2020-07-04 09:52

import sys
stdin = sys.stdin

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

def main():
    n = ni()
    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(9 + (999 - 99))
    elif keta == 5:
        print(9 + (999 - 99)  + n - 9999)
    else:
        print(9 + (999 - 99) + (99999 - 9999))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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())
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())
 
res = 0
for i in range(1, n+1):
    if len(str(i)) % 2 != 0:
        res += 1
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
print(sum(len(str(n))%2==1 for n in range(1,1+N)))

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(count)

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())
c = 0
for i in range(1,n+1):
    if len(str(i)) % 2 == 1 :
        c += 1

print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

for i in range(N):
  n_size = int(math.log10(N-i)+1)
  if n_size%2==1:
    count += 1
  else:
    count += 0
  i += 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
import sys
# from collections import Counter, deque
# from collections import defaultdict
# from itertools import combinations, permutations, accumulate, groupby, product
# from bisect import bisect_left,bisect_right
# from heapq import heapify, heappop, heappush
# from math import floor, ceil,pi,factorial
# from operator import itemgetter
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
inf = 10**17
mod = 10**9 + 7

n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
print(sum(len(str(-~i))%2>0 for i in range(int(input()))))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n=int(input())
a=0
for i in range(1,n+1):
    if len(str(i))%2>0:
        a+=1
print(a)

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())
sum = 0
for i in range(1, n+1):
    if len(str(i)) % 2 == 1:
        sum += 1
print(sum)

Submission status: Accepted

Solution code:
N=int(input())
count=0
for i in range(1,N+1):
    for j in range(0,6):
        if 10**j <=i <10**(j+1):
            ans=j+1
            if (j+1)%2!=0:
                count+=1
                
print(count)

Submission status: Accepted

Solution code:
N = int(input())
l = len(str(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-9090)
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 = input()
Num = sum(pow(10,x)-pow(10,x-1) for x in range(0,len(N)) if x%2)
if len(N)%2:
    print(Num+int(N)-pow(10,len(N)-1)+1)
else:
    print(Num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
count=0
if N//100000==1:
    count=90909
elif N//10000>0:
    count=N%10000+910+((N//10000)-1)*10000
elif N//1000>0:
    count=909
elif N//100>0:
    count=N%100+10+((N//100)-1)*100
elif N//10>0:
    count=9
else:
    count=N//1
print(count)

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:
import sys    #インタプリタや実行環境に関する情報を扱うためのライブラリ
import os     #フォルダやファイルを操作
import math

N=int(input())
count=0

for i in range(N+1):
    if i==0:
        continue
    if i<10:
        count +=1
    if i<100:
        continue
    elif i<1000:
        count +=1
    elif i<10000:
        continue
    elif i<100000:
        count+=1

print(count)

Submission status: Accepted

Solution code:
import sys


def rec(length):
    if length == 1:
        return 9
    else:
        return 9 * 10**(length - 1) + rec(length - 2)


n = input()
length = len(n)

if length == 1:
    print(n)
    sys.exit()

if length % 2 == 0:
    ans = rec(length - 1)
else:
    ans = rec(length - 2) + int(n) - int("1" + "0" * (length - 1)) + 1

print(ans)

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

Submission status: Accepted

Solution code:
N = int(input())
count = 0
for i in range(1,6):
    if N >= 10**i:
        if i%2==1:
            count+=9*(10**(i-1))
    else:
        if i%2==1:
            count+=N-10**(i-1)+1
        break 
print(count)

Submission status: Accepted

Solution code:
N=int(input())
count=0
for i in range(1,6):
  if N >= 10**(i):
    if i%2==1:#1,3,5 (10,1000,100000)
      count+=9*10**(i-1)
  else:
    if i%2==1:#1,3,5 (10,1000,100000)
      count+=N-10**(i-1)+1
    break
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(1,n+1):
  if len(str(i)) in [1,3,5]:
    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-90)
elif 1000 <= n < 10000:
  print(909)
elif n == 100000:
  print(90909)
else:
  print(n-9090)

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

l = [9, 909, 90909]
ans = 0
if len(n) == 1:
    ans = int(n)
elif len(n) != 1 and len(n) % 2 == 1:
    ans = int(n) - 10 ** (len(n) - 1) + 1 + l[len(n) // 2 - 1]
else:
    ans =  l[len(n) // 2 - 1]

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
ans=0
for i in range(1,N+1):
  if len(str(i)) in [1,3,5]:
    ans+=1
print(ans)

Submission status: Accepted

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

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

print(m)

Submission status: Accepted

Solution code:
n=input()
lenn=len(n)
n=int(n)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
lst = [i for i in range(1, N + 1)]
cnt = 0
for i in range(N):
    if len(str(lst[i])) % 2 != 0:
        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:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
from math import log10

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    
    ans = 0
    for n in range(1, N+1):
        if int(log10(n)) % 2 == 0:
            ans += 1
    
    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    ret = 0
    for n in range(1, N + 1):
        if len(str(n)) % 2 != 0: ret += 1
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

def digit(k):
    ret=0
    while k!=0:
        k//=10
        ret+=1
    return ret
    
for i in range(n):
    if digit(i+1)%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:
a = int(input())
ans = 0
for i in range(1, a + 1):
  if len(str(i)) % 2 ==1: ans+=1   
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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:
print(len([i for i in range(1, int(input())+1) if len(str(i))%2==1]))

Submission status: Accepted

Solution code:
inpstr=input()
inpint=int(inpstr)
count=0
while inpint !=0:
    if len(str(inpint))%2==1:
        count+=1
    inpint-=1
print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
# 136 B

s = int(input())
sum = 0

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

print(sum)

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 = input()
l = len(N)
N_i = int(N)
ans = 0
 
p = int(l/2)
for i in range(p):
    q = i*2
    ans += 9 * (10**q)
 
if l%2 != 0:
    bottom = 10**(l-1)
    ans += N_i - bottom + 1
 
print(ans)

Submission status: Accepted

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

p = int(l/2)
for i in range(p):
    q = i*2
    ans += 9 * (10**q)

if l%2 != 0:
    bottom = 10**(l-1)
    ans += N_i - bottom + 1

print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = 0
for i in range(1,n+1):
    if int(math.log10(i)) % 2 == 0:
        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:
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())
count=0
for n in range(1,N+1):
    if len(str(n))%2!=0:
        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())
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())
res=9 if n >=9 else n
for i in range(3,len(str(n))+1):
  if i%2==0:
    continue
  res+=min(n+1,10**i)-10**(i-1)
print(res)

Submission status: Accepted

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

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

[N] = [int(x) for x in sys.stdin.readline().strip().split(" ")]

result = 0

base = 1  # 1, 100, 10000, ...
upper = 10  # 10, 1000, 100000, ...

while base <= N:
    _upper = min(upper, N + 1)
    result += _upper - base
    base *= 100
    upper *= 100

print(result)

Submission status: Accepted

Solution code:

def fn(i):
    return (1 <= i and i <= 9) or (100 <= i and i <= 999) or (10000 <= i and i <= 99999)


def main():
    n = int(input())
    x = range(n + 1)[1:]
    x = tuple(filter(fn, x))

    print(len(x))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

    c = 0
    for i in range(n + 1)[1:]:
        if (1 <= i and i <= 9) or (100 <= i and i <= 999) or (10000 <= i and i <= 99999):
            c += 1

    print(c)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

    print(c)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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)
elif n==100000:
    print("90909")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    if 0 <= 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)
    else:
        print(90909)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = input()

"""max(n) = 100000"""
if len(n) == 6:
  res = 9 + 900 + 90000
  print(res)
elif len(n) == 5:
  res = 9 + 900 + (int(n) -9999)
  print(res)
elif len(n) == 4:
  res = 9 + 900
  print(res)
elif len(n) == 3:
  res = 9 + (int(n) - 99)
  print(res)
elif len(n) == 2:
  res = 9
  print(res)
else:
  res = int(n)
  print(res)

Submission status: Accepted

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

print(c)

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:
# -*- coding: utf-8 -*-
import sys
from sys import stdin

strN = stdin.readline().rstrip()
N = int(strN)
strLen = len(strN)

odd_count1 = 0
for i in range(1, strLen + 1):
    if i % 2 == 0:
        if i == strLen:
            print(odd_count1)
            sys.exit(0)
    else:
        if i == strLen:
            t1 = '1'
            t1 += '0' * (i - 1)
            t3 = N - int(t1) + 1
            odd_count1 += t3
            print(odd_count1)
            sys.exit(0)
        else:
            t1 = '1' + '0' * (i - 1)
            t2 = '9' * i
            odd_count1 += (int(t2) - int(t1)+1)

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:
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


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


def LS(): return list(sys.stdin.readline().rstrip().split())


N = I()
ans = 0
for i in range(1, N+1):
    temp = str(i)
    if len(temp) % 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 != 0:
        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))==1 or len(str(i))==3 or len(str(i))==5:
        cnt += 1
print(cnt)

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 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if len(str(N)) <= 1:
    answer = N
elif len(str(N)) <=2:
    answer = 9
elif len(str(N)) <=3:
    answer = 9 + N - 10**2 + 1
elif len(str(N)) <=4:
    answer = 9 + 9*10**2
elif len(str(N)) <= 5:
    answer = 9 + 9*10**2 + N - 10**4 + 1
else:
    answer = 9 + 9*10**2 + 9*10**4

print(answer)

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 1 <= 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(N - 9999 + 909)
elif N == 100000:
  print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B
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())
count = 0
for i in range(1,N+1):
    ar = list(map(int,str(i)))
    if len(ar) % 2 != 0:
        count += 1

print(count)

Submission status: Accepted

Solution code:
n = int(input())
N = str(n)
num = len(N)
ans = 0
if num == 1:
    ans += n
elif num == 2:
    ans += 9
elif num == 3:
    ans += 9
    ans += (n-100+1)
elif num == 4:
    ans += 9
    ans += 900
elif num == 5:
    ans += 909
    ans += (n-10000+1)
elif num == 6:
    ans += 90909
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
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())

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())
l = len(str(n))

if l == 1:
    print(n)
    exit()
ans = 9
if l % 2 == 1:
    ans += n + 1 - 10 ** (l - 1)

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

Submission status: Accepted

Solution code:
N=int(input())
if 1<=N and N<=9:
  print(N)
elif 10<=N and N<=99:
  print(9)
elif 100<=N and N<=999:
  print(N-90)
elif 1000<=N and N<=9999:
  print(909)
elif 10000<=N and N<=99999:
  print(N-90-9000)
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 = input()
N = list(n)
m = int(n)
if len(N) <= 2:
  if m >= 10:
    print(9)
  else:
    print(m)
    
elif 3 <= len(N) <= 4:
  if m >= 1000:
    print(9 + 900)
  else:
    print(9+m-99)
elif 5 <= len(N) <= 6:
  if m >= 100000:
    print(9 + 900 + 90000)
  else:
    print(9+ 900 + m - 9999)

Submission status: Accepted

Solution code:
def readinput():
    n=int(input())
    return n

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

if __name__=='__main__':
    n=readinput()
    ans=main(n)
    print(ans)

Submission status: Accepted

Solution code:
def readinput():
    n=int(input())
    return n

def main(n):
    if 1<=n and n<=9:
        return n
    elif 10<=n and n<=99:
        return 9
    elif 100<=n and n<=999:
        return 9+(n-99)
    elif 1000<=n and n<=9999:
        return 9+900
    elif 10000<=n and n<=99999:
        return 9+900+(n-9999)
    elif 100000==n:
        return 9+900+90000
    return 0

if __name__=='__main__':
    n=readinput()
    ans=main(n)
    print(ans)

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:
  N = N - 90
  print(N)
elif len(str(N)) == 4:
  print(909)
elif len(str(N)) == 5:
  N = N - 9090
  print(N)
else:
  print(90909)

Submission status: Accepted

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

if len(n) == 1:
    ans = n
elif len(n) == 2:
    ans = 9
elif len(n) == 3:
    n = int(n)
    ans = ((n-100)+1)+9
elif len(n) == 4:
    ans = 9+900
elif len(n) == 5:
    n = int(n)
    ans = ((n-10000)+1)+900+9
else:
    ans = 90000+900+9

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())
count = 0

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

print(count)

Submission status: Accepted

Solution code:
n = int(input())
# 100000
# 1-9 9 100-999 900 10000-99999 90000
if n <= 9:
    print(n)
    exit()
if n > 9 and n <= 999:
    print(9 + max(n-99,0))
    exit()
if n > 999 and n <= 99999:
    print(9 + 900 + max(n-9999,0))
    exit()
if n > 99999 :
    print(9 + 900 + 90000)
    exit()

Submission status: Accepted

Solution code:
N = int(input())

count = 0
num = 1
while N//num > 0:
    if num*10 <= N:
        count += num*9
    else:
        count += N%(num*10) - num + 1
    num *= 100

print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

print(res)

Submission status: Accepted

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

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())
for i in range(5,-1,-1):
  if n//10**i: break
if i:
  s=int('90'*((i-1)//2)+'9')
else: s=0
if i%2==0:
  s+=n-10**i+1
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)

n = int(input())
#b = list(map(int, input().split()))
#n, m = map(int, input().split())
#s = input()
#s,t = input().split()
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

l = [i for i in range(1,10)] + [i for i in range(100,1000)] + [i for i in range(10000,100000)] 

n = [i for i in range(1,n+1)]

ans = len(set(l) & set(n))

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for i in range(n+1):
    hoge = i
    cnt = 0
    while hoge > 0:
        hoge //= 10
        cnt += 1
    if cnt % 2 != 0:
        count += 1
print(count)

Submission status: Accepted

Solution code:
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():

    N = int(input())

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

    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

if N <= 9:
    ans=N
elif N<=99:
    ans=9
elif N<=999:
     ans=N-100+1+9
elif N<=9999:
    ans=999-100+1+9
elif N<=99999:
    ans=N-10000+1+999-100+1+9
else:
    ans=99999-10000+1+999-100+1+9

print(ans)

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-9000-90
else:
    ans=90909
    
print(ans)