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())
count = 0
i = 1
while i <= n:
    if i < 10:
        count+=1
    elif 10**2 <= i and i < 10**3:
        count+=1
    elif 10**4 <= i and i < 10**5:
        count+=1
    i = i+1
print(count)

Submission status: Accepted

Solution code:
N=int(input())
if 1<=N and 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)
elif N==100000:
	print(90909)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(t)

Submission status: Accepted

Solution code:
maxN = int(input())

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

Submission status: Accepted

Solution code:
n=int(input())
ans = 0
for i in range(1, n+1):
    tmp = str(i)
    if len(tmp) % 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=int(input())
digit=1
count=0
while(10**digit<=n):
  if(digit%2==1):
    count=count+9*10**(digit-1)
  digit=digit+1
if(digit%2==1):
  count=count+n-10**(digit-1)+1
print(count)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    ans = 0
    if N >= 10:
        ans += 9
    else:
        ans += N
    if N >= 1000:
        ans += 900
    else:
        ans += max(N-99, 0)
    if N >= 100000:
        ans += 90000
    else:
        ans += max(N-9999, 0)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

count = 0

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

print(count)

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    N = int(stdin.readline().rstrip())
    count = 0
    for i in range(1, N + 1):
        if len(str(i)) % 2 == 1:
            count += 1
    print(count)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

res = 0
for n in range(1,N+1):
    n = str(n)
    flag = 0
    for s in n:
        flag += 1
    if flag%2 == 1:
        res += 1
print(res)

Submission status: Accepted

Solution code:
n = int(input())

s = len(str(n))


ans = n - (10 ** (s - 1) - 1) if s % 2 == 1 else 0
for i in range(1, s, 2):
    ans += 10 ** i - 10 ** (i - 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-100+1+9)
elif N < 10000:
  print(909)
elif N < 100000:
  print(N-10000+1+909)
elif N == 100000:
  print(90909)

Submission status: Accepted

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

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 = 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 != 0:
        C += 1

print(C)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def solve(N: int):
    if 1 <= N <= 9:
        return N
    if 10 <= N <= 99:
        return 9
    if 100 <= N <= 999:
        return 9 + N - 99
    if 1000 <= N <= 9999:
        return 9 + 900
    if 10000 <= N <= 99999:
        return 9 + 900 + N - 9999
    else:
        return 9 + 900 + 90000



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    ans = solve(N)
    if ans is not None:
        print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

c=0

for i in range(N):
    if i+1>=0 and i+1<10 or i+1>=100 and i+1<1000 or i+1>=10000 and i+1<100000:
        c+=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):
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
def digit(n):
    tmp=n//10
    c=1
    while(tmp!=0):
        c+=1
        tmp=tmp//10
    return c
x=int(input())
# print(digit(x))
cnt=0
for i in range(1,x+1):
    if(digit(i)%2==1):
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
l=len(str(n))
s=0
if l%2==1:
    s+=n-10**(l-1)+1
    l-=2
else:
    l-=1
while(l>0):
    s+=10**l-10**(l-1)
    l-=2
print(s)

Submission status: Accepted

Solution code:
N=int(input())
#a,b,c=map(int, input().split())
import numpy as np
a=np.arange(1,N+1)
cnt=0
for n in a:
    if len(str(n))%2==1:
        cnt+=1
    else:
        pass
print(cnt)

Submission status: Accepted

Solution code:
import sys
def main():
    input = sys.stdin.readline
    n = int(input())

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

    print(res)
if __name__ == '__main__':
    main()

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 i<=9 or (i>=100 and i<=999) or (i>=10000 and i<=99999):
        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 i<10:
    cnt += 1
  elif i<100:
    cnt += 0
  elif i<1000:
    cnt += 1
  elif i<10000:
    cnt +=0
  elif i<100000:
    cnt+=1
    
print(cnt)

Submission status: Accepted

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

ans = 0

for i in range(len(n)):
    if i%2==1:
        continue

    if i == len(n)-1:
        ans += (x - 10**(len(n)-1) +1)
    elif i%2==0:
        ans += 9 * (10**i)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

for i in range(1,n+1):
        u = i
        c = 0
        while u>=1:
                c += 1
                u /= 10
        if c % 2 == 1:
                co += 1
print(co)

Submission status: Accepted

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

count = 0
n = readi()

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

Submission status: Accepted

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

def keta(n):
    a = 0
    while (n > 0):
        a += 1
        n = n//10
    return a

n = int(input())

ans=0
for x in range(1,n+1):
    if keta(x) % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
#!venv/bin/python
#from collections import defaultdict 
from itertools import combinations
from collections import defaultdict
from pprint import pprint
import math
import datetime
import sys
import fcntl
import time

#N = [int(x) for x in input().split()]
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(output)

Submission status: Accepted

Solution code:
a=int(input())

if a<=9:
  print(a)
elif 9<a<100:
  print(9)
elif 100<=a<=999:
  print(9+a-99)
elif 999<a<10000:
  print(9+900)
elif 10000<=a<=99999:
  print(9+900+a-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(9 + (N-99))
elif N < 10000:
  print(909)
elif N < 100000:
  print(909 + (N-9999))
else:
  print(90909)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
if(N < 10):
    ans = N
elif(N < 1000):
    ans = 9 + max(N - 100 + 1, 0)
elif(N < 100000):
    ans = 9 + 900 + max(N - 10000 + 1, 0)
else:
    ans = 90909
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):
    digits = 0
    while i > 0:
        i = i // 10
        digits += 1
    if digits % 2 == 1:
        count += 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())
count = 0
digit = 1
digit_10 = 10
for i in range(1, n+1):
    if(i >= digit_10):
        digit += 1
        digit_10 = 10 ** (digit)
    if(digit % 2 == 1):
        count += 1
print(count)

Submission status: Accepted

Solution code:
N=int(input())
K=len(str(N))
ANS=0

for i in range(K):
    if i%2==1:
        ANS+=10**i-10**(i-1)

if K%2==1:
    ANS+=N+1-10**(K-1)

print(ANS)

Submission status: Accepted

Solution code:
n = int(input())
res = 0
def keta(x):
    y = 0
    while x >0:
        y+=1
        x= x //10
    return y
for i in range(1,n+1):
    if keta(i)%2==1:
        res+=1
print(res)

Submission status: Accepted

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

res = 0
for i in range(1, len(S)):
    if i % 2 == 1:
       res += 10 ** i - 10 ** (i - 1)

if len(S) % 2 == 1:
    res += N - 10 ** (len(S) - 1) + 1

print(res)

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 len(str(N)) == 1:
    print(N)
elif len(str(N)) == 2:
    print(9)
elif len(str(N)) == 3:
    print(N-99+9)
elif len(str(N)) == 4:
    print(909)
elif len(str(N)) == 5:
    print(N-9999+909)
elif len(str(N)) == 6:
    print(90909)

Submission status: Accepted

Solution code:
N = int(input())

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

print(a)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

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

print(an)

Submission status: Accepted

Solution code:
import math

n=int(input())
k=math.floor(math.log10(n))+1
#print(k)

much=0

if k%2==0:
    for i in range(int(k/2)):
        much+=9*(10**(i*2))
else:
    for i in range(int((k-1)/2)):
        much+=9*(10**(i*2))
    much+=n-(10**(k-1))+1

print(much)

Submission status: Accepted

Solution code:
def main():
    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(9+900)
    elif 10000<=n<=99999:
        print(9+900+n-9999)
    else:
        print(90909)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

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) - 99)
  
elif len(n) == 4:
  print(9 + 900)
  
elif len(n) == 5:
  print(9 + 900 + int(n) - 9999)

else:
  print(9 + 900 + 90000)

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())
num = 0
for i in range(1,N+1):
    if i // 10 < 1:
        num += 1
    elif i//100 < 1:
        continue
    elif i//1000 < 1:
        num += 1
    elif i//10000 < 1:
        continue
    elif i//100000 < 1:
        num += 1
    else:
        continue
print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def isodd(i):
  return len(str(i)) % 2 == 1


n = int(input())

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python

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

Submission status: Accepted

Solution code:
def main():
     n=input()
     k=len(n)
     n=int(n)
     ans=0
     for i in range(1,k):
          if i%2==1:
               ans+=10**i-10**(i-1)
     if k%2==1:
          ans+=n+1-10**(k-1)
     print(ans)
     
if __name__ == '__main__':
     main()

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
input = sys.stdin.readline
import math

N = int(input())

count = 0
for i in range(1, N + 1):
    if (int(math.log10(i)) + 1) % 2 == 1:
        count += 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(9 + N - 99)
elif N < 10000:
	print(9 + 900)
elif N < 100000:
	print(9 + 900 + N - 9999)
else:
	print(90909)

Submission status: Accepted

Solution code:


N = int(input())

print(len([i for i in range(1, N+1) if len(str(i))%2]))

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:
import sys
def input(): return sys.stdin.readline().strip()
n=int(input())
print(sum(1 for i in range(n) if len(str(i+1))%2==1))

Submission status: Accepted

Solution code:
words = lambda t : list(map(t, input().split()))
n = int(input())
ans = 0
for i in range(1,n+1):
    k = i
    d = 0
    while k != 0:
        d += 1
        k = k // 10
    if d % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


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


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


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

Submission status: Accepted

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

Submission status: Accepted

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

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(909 + int(n) - 10000 + 1)
elif len(n) == 6:
    print(909 + 90000)

Submission status: Accepted

Solution code:
import sys

N = int(input())

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

print(cnt)

Submission status: Accepted

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


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

  if n < 100:
    print(min(9, n))
  elif n < 10000:
    print(min(909, n - 99 + 9))
  else:
    print(min(90909, n - 9999 + 909))


if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
N = int(input())

count_ans = 0

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

print(count_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 += 1
print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

input = sys.stdin.readline

# N個整数
# a, b, c = list(map(int, input().split()))

# 1整数
n = int(input())

ret = 0

for i in range(n):

    j = i + 1
    if 0 < j < 10:
        ret = ret + 1
    if 99 < j < 1000:
        ret = ret + 1
    if 9999 < j < 100000:
        ret = ret + 1

print(ret)

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

N = int(S)

D = len(S)

if D == 1:
    print(N)
elif D == 2:
    print(9)
elif D == 3:
    print(N-90)
elif D == 4:
    print(909)
elif D == 5:
    print(N-9090)
elif D == 6:
    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:
import sys
input=sys.stdin.readline
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(9+900)
elif 10000<=n<100000:
    print(9+900+n-9999)
elif n==100000:
    print(9+900+90000)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#!/usr/bin/env pypy3

from math import *

def main():
    import sys
    sys.dont_write_bytecode = True
    sys.setrecursionlimit(10000000)

    input = sys.stdin.readline

    #import numpy as np
    #import scipy as sp

    # Python 3 modules: https://docs.python.org/3/library/

    import os
    import math, itertools, operator
    from math import factorial as fact
    from operator import itemgetter, attrgetter
    from itertools import permutations, combinations
    from functools import reduce, lru_cache
    # Use scipy for stats: https://docs.scipy.org/doc/scipy/reference/stats.html
    # Before Python 3.5.  Import from math after it.
    from fractions import gcd
    from fractions import Fraction as Frac

    inf = float('inf')
    pow = __builtins__.pow

    def lcm(a, b):
        return a * b // gcd(a,b)

    def perm(a, b):
        import scipy.special
        return scipy.special.perm(a, b, exact = True)

    def comb(a, b):
        import scipy.special
        return scipy.special.comb(a, b, exact = True)

    def dfact(n):
        import scipy.special
        return scipy.special.factorial2(n, exact = True)

    def prod(l):
        return reduce(operator.mul, l)

    def input_ints(func = input, sep = None, conv = int):
        return list(map(conv, func().split(sep = sep)))

    if os.environ.get('GOROOT') is None:
        def dprint(*args, **kwargs):
            kwargs['file'] = sys.stderr
            import inspect
            frame = inspect.currentframe().f_back
            print('[' + os.path.basename(frame.f_code.co_filename)
                    + ':' + str(frame.f_lineno) + ']', *args, **kwargs)
    else:
        def dprint(*args, **kwargs):
            pass


    ############################################################################


    N, = list(map(int, input().split()))
    c = 0
    if N > 9:
        c += 9 - 1 + 1
        if N > 999:
            c += 999 - 100 + 1
            if N > 99999:
                c += 99999 - 10000 + 1
            else:
                if N < 10000:
                    pass
                else:
                    c += N - 10000 + 1
        else:
            if N < 100:
                pass
            else:
                c += N - 100 + 1
    else:
        c += N
    print(c)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())

ans=0

for i in range(1,n+1):
    if i>=1 and i<10:
        ans+=1
    if i>=100 and i<1000:
        ans+=1
    if i>=10000 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 len(str(i)) % 2 == 1:
        cnt += 1

print(cnt)

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:
def main():
    N = int(input())
    count = 0
    for n in range(1, N+1):
        if len(str(n)) % 2 == 1:
            count += 1

    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
ans = 0
K = int(input())
keta = math.floor(math.log10(K)) + 1
for i in range(1,keta+1):
    if i!= keta:
        if i%2:#桁数が奇数
            ans += 10**i - 10**(i-1)
    if i==keta:
        if i%2:
            ans += K - 10**(keta-1) + 1
print(ans)

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

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()
ans = 0
for x in xrange(1, n + 1):
    sz = len(str(x))
    if sz & 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:
if __name__ == '__main__':
    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:
N = input()

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

print(ans)

Submission status: Accepted

Solution code:
#import sys
#input = sys.stdin.readline
def main():
    N = int( input())
    ans = 0
    if N < 10:
        ans = N
    elif N < 100:
        ans = 9
    elif N < 1000:
        ans = 9 + N - 99
    elif N < 10000:
        ans = 909
    elif N < 100000:
        ans = 909 + N - 9999
    else:
        ans = 90909
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for i in range(1, min(10, N + 1)):
    count += 1
for i in range(100, min(1000, N + 1)):
    count += 1
for i in range(10000, min(100000, N + 1)):
    count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input()) + 1
ans = 0
x = 1
k = 1
while x < N:
    if k % 2 != 0:
        ans += min(N, 10 * x) - x
    x *= 10
    k += 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())
keta = len(str(n))
ans = 0
for i in range(1, keta + 1, 2):
    if i == keta:
        ans += n - (10 ** (i - 1)) + 1
    else:
        ans += 9 * (10 ** (i - 1))
print(ans)

Submission status: Accepted

Solution code:
# B

n = int(input())

ans = 0

if n >= 10000:
    ans += min(n,99999) - 10000 + 1
if n >= 100:
    ans += min(n,999) - 100 + 1
if n >= 1:
    ans += min(n,9) - 1 + 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:

N = int(input())

ans = 0

if N < 10:
    ans = N

elif N < 100:
    ans = 9

elif N < 1000:
    ans += 9
    ans += N - 99

elif N < 10000:
    ans += 9
    ans += 900

elif N < 100000:

    ans += 9
    ans += 900

    ans += N - 9999

else:

    ans += 9
    ans += 900
    ans += 90000

print (ans)

Submission status: Accepted

Solution code:
N = int(input())

count = 0

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

print(count)

Submission status: Accepted

Solution code:
A = int(input())
answer=0

for i in range(1,A+1):
    if(len(str(i))%2==1):
        answer+=1;

print(answer);

Submission status: Accepted

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

Submission status: Accepted

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