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:
a = int(input())
l=[]
for i in range(1,a+1):
    l.append(str(i))
o=len(l)
rl=[]
for j in range(o):
    if len(l[j])%2!=0:
        rl.append(l[j])

print(len(rl))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = raw_input()

digit_num = len(str(N))
digit_counter = 2
minus_val = 0

while True:
  if digit_counter >= digit_num:
    if digit_num % 2 == 0:
      minus_val += (int(N) - pow(10, digit_num - 1) + 1)
    break
  minus_val += 9 * pow(10, digit_counter - 1)
  digit_counter += 2

print int(N) - minus_val

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

N = int(input())
len_N = len(str(N))

ans = 0

if len_N == 6:
    ans = ((10**5 -1) - (10**4) +1) + ( (10**3 -1) -(10**2) +1) + 9
if len_N == 5:
    ans = (N - (10**4) +1) + ( (10**3 -1) -(10**2) +1) + 9 
if len_N == 4:
    ans = ( (10**3 -1) -(10**2) +1) + 9 
if len_N == 3:
    ans = ( N -(10**2) +1 ) + 9 
if len_N == 2:
    ans =  9
if len_N == 1:
    ans = N

print(ans)

Submission status: Accepted

Solution code:
ans=0
for i in range(int(input())+1):
	keta=0
	n=i
	while(n):
		keta+=1
		n//=10
	if keta%2:
		ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
l = len(str(N))-1
count = 0
for digit in range(l//2+1):
    count += len(range(10**(digit*2), min(10**(digit*2+1), N+1)))
print(count)

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:
def main(): 
    n = input()
    digit = len(n)

    ans = 0

    if digit == 1:
        ans+= int(n)
    elif digit == 2:
        ans+= 9
    elif digit == 3:
        ans+= 9 + int(n) - 99
    elif digit == 4:
        ans+= 9 + 900
    elif digit == 5:
        ans+= 9 + 900 + int(n) - 9999
    elif digit == 6:
        ans+= 9 + 900 + 90000

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

    
import sys

if sys.platform =='ios':
	sys.stdin=open('input_file.txt')
	
n=int(input())

a=n//10000
b=(n-10000*a)//1000
c=(n-10000*a-1000*b)//100
d=(n-10000*a-1000*b-100*c)//10
e=(n-10000*a-1000*b-100*c-10*d)


if n==100000:
	print(90909)

elif a==0:
	if b==0:
		if c==0:
			if d==0:
				print(n)
			else:
				print(9)
		else:
		  print(n-90)
	else:
		print(909)
else:
	print(n-9090)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int):
    ans = 100000
    if(0  <= N <= 99):
        ans = min(9,N)
    elif(100 <= N <= 9999):
        ans = min(N, 999)-99+9
    elif(10000 <= N <= 100000):
        ans = min(N, 99999) - 9999 + 999 - 99 + 9

    print(ans)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=input()
N=int(n)
n=list(n)
n=[int(i) for i in n]
s=len(n)
if(s==6):
    print(90909)
elif(s==5):
    print(9+900+N-9999)
elif(s==4):
    print(909)
elif(s==3):
    print(9+N-99)
elif(s==2):
    print(9)
else:
    print(N)

Submission status: Accepted

Solution code:
def main():
  n = int(input())
  l = [0 for i in range(n+1)]
  for i in range(1,n+1):
    if i < 10:
      l[i] = l[i-1] + 1
    elif i < 100:
      l[i] = l[i-1]
    elif i < 1000:
      l[i] = l[i-1] + 1
    elif i < 10000:
      l[i] = l[i-1]
    elif i < 100000:
      l[i] = l[i-1] + 1
    elif i == 100000:
      l[i] = l[i-1]
    else:
      break
  print(l[n])

if __name__ == "__main__":
  main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

l = len(str(n))

if l == 1:
    ans = n - 10**(l-1) + 1
    print(ans)
elif l == 2:
    print(9)
elif l == 3:
    ans = n - 10**(l-1) + 1 + 9
    print(ans)
elif l == 4:
    print(9+999-100+1)
elif l == 5:
    ans = n - 10**(l-1) + 1
    print(ans + 9+999-100+1)
elif l == 6:
    print(9+999-100+1 + 99999 - 10000 + 1)

Submission status: Accepted

Solution code:
n = int(input())

counter = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))
from collections import deque  # 双方向キュー
from collections import defaultdict  # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー
from bisect import bisect_left, bisect_right  # 二分探索
sys.setrecursionlimit(int(1e+6))
MOD = int(1e+9) + 7
#import numpy as np  # 1.8.2
#import scipy  # 0.13.3

def main():
    S = i2s()
    N = int(S)
    if len(S) == 1:
        n = N
    elif len(S) == 2:
        n = 9
    elif len(S) == 3:
        n = N - 90
    elif len(S) == 4:
        n = 909
    elif len(S) == 5:
        n = N - 9090
    else:
        n = 90909
    print(n)

main()

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

sum = 0

if t % 2 ==0:
    for i in range(t//2):
        sum += 9*(100**(i))
    print(sum)
else:
    for i in range((t-1)//2):
            sum += 9*(100**(i))
    sum += N - 10**(t-1) + 1
    print(sum)

Submission status: Accepted

Solution code:
a = int(input())

ans = 0

if a >= 1 and a <= 99:
    ans = min(a, 9)
elif a>=100 and a<=999:
    ans = a-90
elif a>=1000 and a<=9999:
    ans = 909
elif a>=10000 and a<=99999:
    ans = a-9090
else:
    ans = 90909

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for i in range(1, N+1):
    if 10**0 <= i < 10**1:
        count += 1
    elif 10**2 <= i < 10**3:
        count += 1
    elif 10**4 <= i < 10**5:
        count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding:utf8 -*-

n = int(input())
ans = len([i for i in range(1,n+1) if len(str(i)) % 2 == 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(9 + n-100+1)
elif n < 10000:
    print(9+999-100+1)
elif n < 100000:
    print(9+999-100+1 +n-10000+1)
elif n == 100000:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

while True:
    try:
        N = int(input())
        m = int(math.log(N, 10))

        ans = 0
        for exp in range(0, m, 2):
            ans += 9 * 10 ** exp
        
        if (m%2 == 0):
            ans += min(N, 10**(m+1)-1) - 10**m + 1
        print(ans)
            
    except:
        break

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())
    li = [x for x in range(1, N + 1)]
    print(len(list(filter(lambda x: len(str(x)) % 2 == 1, li))))

Submission status: Accepted

Solution code:
def count_digits(N):
        N_temp = N
        digits = 0
        while N_temp != 0:
                digits += 1
                N_temp = int(N_temp/10)
        
        return digits

N = int(input())
ans = 0
for i in range(1,N+1):
        x = count_digits(i)
        if x%2 == 1:
                ans += 1
        else:
                pass

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
i = 1
while N // (10**i) > 0: 
    i += 1
 
ans = 0    
if i % 2 == 0:
    for j in range(i//2):
        ans += 9*(10**(2*j))
else:
    for j in range(i//2):
        ans += 9*(10**(2*j))
    ans += (N-10**(2*(i//2))+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
for i in range(N):
    num = str(i + 1)
    if len(num) % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n = int(input())
cnt = 0
for i in range(1,n+1):
    cnt += 1 if math.log10(i)//1%2 == 0 else 0
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
 
ans = 0
 
if n >= 10:
  ans += 10 - 1
  if n >= 10**2:
    if n >= 10**3:
      ans += 10**3 - 10**2
      if n >= 10**4:
        if n == 10**5:
          ans += 10**5 - 10**4
        else:
          ans += n - 10**4 + 1
    else:
      ans += n - 10**2 + 1
else:
  ans += 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())
count = 0
for i in range(1, N + 1):
    if 1<=i <=9 or 100<=i <= 999 or 10000<= i <= 99999:
        count += 1
    else:
    
        count +=0
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:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    t = 0
    for i in range(1, n + 1):
        if len(str(i)) % 2 != 0:
            t += 1
    print(t)


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数を一旦文字列として受け取り
n = input()
int_n = int(n)
result = int_n

# 超愚直にやって見る
for i in range(1, int_n+1):
    if len(str(i))%2 == 0:
        result -= 1

print(result)

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
	else:
		pass

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

if N < 100:
    print(min(N, 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:
n = int(input())
count = 0
for i in range(1,n+1):
    if len(str(i)) % 2 == 0:
        continue
    else:
        count += 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())

def cl(n):
	nl = 1
	while n // 10 > 0:
		nl += 1
		n = n // 10
	return nl
	
print(sum([1 for i in range(n) if cl(i + 1) % 2 == 1]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

counter = 0

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

print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
i = 1
while(i <= n):
    ans += 1 if (len(str(i)) % 2 == 1) else 0
    i += 1
print(ans)

Submission status: Accepted

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

for i in range(1,a+1):
  if len(list(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))+1) % 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:
# ABC136B
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)
elif N < 1000000:
    print(90909)
else:
    print(90910)

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
count = 0
for i in range(1, n+1):
    if int(np.log10(i)) % 2 == 0:
        count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
import math
N_keta = int(math.log10(N))+1

count = 0
for i in range(N_keta-1):
#  print('i' + str(i))
  if i % 2 == 0:
    count += 9 * (10 ** i)  
#  print(count)

if N_keta % 2 != 0:
  count +=  N - (10 ** (N_keta - 1) -1)
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()



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

print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
l = len(str(N))
s = 0
for i in range((l + 1) // 2):
    s += 9 * 100 ** i
if l % 2:
    s -= int('9' * l) - N
print(s)

Submission status: Accepted

Solution code:
N = int(input())

result = 0
if N >= 10:
    result += 9
else:
    result += N

if N >= 1000:
    result += 900
elif N >= 100:
    result += N - 99


if N >= 100000:
    result += 90000
elif N >= 10000:
    result += N - 9999

print(result)

Submission status: Accepted

Solution code:
a =  int(input())
count = 0
for i in range(a):
    result = str(i + 1)
    if len(result) % 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(n-90)
elif n<10000:
  print(909)
elif n<100000:
  print(n-9999+909)
else:
  print(90909)

Submission status: Accepted

Solution code:
n = int(input())
rank = len(str(n))
first = int(str(n)[0])

ans = 0

for i in range( rank ):
    if i % 2 != 0:
        ans += 9 * 10 ** (i-1)
if rank % 2 != 0:
    ans += ( first - 1 ) * (10 ** (rank-1))
    ans += n - first * ( 10 ** (rank-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:
a = input()
b = len(list(a))
c = int(a)
d = ''

if b % 2 == 0:
    d = '9' * (b // 2)
    print('0'.join(d))

else:
    if b == 1:
        print(a)
    else:
        d = '9' * (b // 2)
        d = '0'.join(d)
        d = int(d + '0')
        print(c - d)

Submission status: Accepted

Solution code:
n = int(input())

digit = 1
count = 0

for i in range(1, n +1):
	if i // ( 10**digit ) > 0:
		digit += 1
	if digit % 2 == 1:
		count += 1

print(count)

Submission status: Accepted

Solution code:
N=int(input())
ans=0
if N//(10**1)>=1:
  ans+=9
else:
  ans+=N
  print(ans)
  exit()
if N//(10**3)>=1:
  ans+=900
else:
  if N>=100:
    ans+=N-99
    print(ans)
    exit()
  else:
    print(ans)
    exit()
if N//(10**5)==1:
  ans+=90000
  print(ans)
else:
  if N>=10000:
    ans+=N-9999
    print(ans)
  else:
    print(ans)

Submission status: Accepted

Solution code:
a = int(input())
count = 0
if a == 10**5:
    count += 90909
elif a >= 10000:
    count += a - 9999 +909
elif a > 999:
    count += 909
elif a >= 100:
    count += a - 99 + 9
elif a > 9:
    count += 9
else:
    count += a
print(count)

Submission status: Accepted

Solution code:
N = int(input())

print(sum(1 if len(str(n))%2!=0 else 0 for n in range(1, N+1, 1)))

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

Submission status: Accepted

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

if n >= 9: res += 9
else: res += n

if n >= 100:
    if n <= 999:
        res += n - 100 + 1
    else: res += 900

if n >= 10000:
    if n <= 99999:
        res += n - 10000 + 1
    else: res += 90000

print(res)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
if n >= 10:
    ans += 9
if n >= 1000:
    ans += 900
if n >= 100000:
    ans += 90000

if n < 10:
    ans += n 

if n < 1000 and n >= 100:
    ans += n - 100 + 1

if n < 100000 and n >= 10000:
    ans += n - 10000 + 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())
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())

if 100000 <= N:
  print(9+(999-100)+1+(99999-10000)+1)
elif 10000<=N<=99999:
  print(9+(999-100)+1+(N-10000)+1)
elif 1000<=N<=9999:
  print(9+(999-100)+1)
elif 100<=N<=999:
  print(9+(N-100)+1)
elif 10<=N<=99:
  print(9)
else:
  print(N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
S=set([])
for i in range(1,N+1):
  if i<10 or 99<i<1000 or 9999<i<100000 :
    S.add(i)
print(len(S))

Submission status: Accepted

Solution code:
# ABC136.py

SELECT = "ABC"[1]

if SELECT == "A":  # Transfer

    a, b, c = map(int, input().split())
    ans = c - (a - b)
    if ans < 0:
        print(0)
    else:
        print(ans)

if SELECT == "B":  # UnevenNumbers

    n = int(input())

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

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

if SELECT == "C":  # BuildStairs

    n = int(input())
    s = list(map(int, input().split()))
    bar = 0
    for i in range(n):
        if bar < s[i]:
            bar = s[i]
        elif s[i] + 1 < bar:
            print("No")
            exit()

    print("Yes")

Submission status: Accepted

Solution code:
N = int(input())
print(len(list(filter(lambda x: len(str(x)) % 2 == 1, range(1, N + 1)))))

Submission status: Accepted

Solution code:
N = int(input())
k = len(str(N))
sum = 0
if k%2==1:
    sum += N-10**(k-1)+1
    k -= 2
else:
    k -= 1
while k>0:
    sum += 9*10**(k-1)
    k -= 2
print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
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 i in range(1, n + 1):
    if i < 10 or 0 < i // 100 < 10 or 0 < i // 10000 < 10:
        count += 1
print(count)

Submission status: Accepted

Solution code:
N=int(input())

if N>=10:
    result=9
elif N<10:
    result=N

if N>=1000:
    result+=900
elif 100<=N and N<1000:
    result+=N-100+1

if N>=100000:
    result+=90000
elif 10000<=N and N<100000:
    result+=N-10000+1

print(result)

Submission status: Accepted

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

if digit == 1:
    print(n)
elif digit == 2:
    print(9)
elif digit == 3:
    print(9 + (n - 100 + 1))
elif digit == 4:
    print(909)
elif digit == 5:
    print(909 + (n - 10000 + 1))
else:
    print(90909)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# input
n = int(input())
# calc
if n < 10:
    print(n)
elif n < 100:
    print(9)
elif n < 1000:
    print(9+(n-100+1))
elif n < 10000:
    print(909)
elif n < 100000:
    print(909+(n-10000+1))
elif n == 100000:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

order=0
num=0

while True:
  if N // 10**order >=1:
    order += 1
  else:
    break
    
if order%2==1:
  order-=1
  num += N-(10**order)+1

while True:
  if order<=0: break
  if order%2==1:
    num += 9*(10**(order-1))
  order-=1
  
print(num)

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

ans=0
start=1
while(start<=n):
    same_dig_end=min(start*10-1,n)
    ans+=same_dig_end-start+1
    start*=100
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

keta = len(str(n))
ans = 0
for i in range(keta):
    if i+1 != keta and (i+1) % 2 == 1:
        ans += (10 ** i) * 9
    elif i+1 == keta and (i+1) % 2 == 1:
        ans += n - (10 ** i) + 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

print(cnt)

Submission status: Accepted

Solution code:
import math
N=int(input())
n=int(math.log(N,10)+1)
sum=0
for i in range(1,n,2):
    sum+=9*math.pow(10,i-1)
if n%2!=0:
    sum+=N-math.pow(10,n-1)+1
print(int(sum))

Submission status: Accepted

Solution code:
import math

# input an integer N
N = int(input())

n = math.log(N,10) + 1
int_n = int(n)

sum = 0
for i in range(1, int_n, 2):
    sum += 9 * math.pow(10, i-1)

if int_n % 2 != 0:
    sum += N - math.pow(10,int_n-1)+1

print(int(sum))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
M = len(s)
N = int(s)

l1 = 9
l3 = 999-99
l5 = 99999-9999

ans = 0

if M == 1:
    ans = N
elif M == 2:
    ans = l1
elif M == 3:
    ans = l1 + N - 99
elif M == 4:
    ans = l1 + l3
elif M == 5:
    ans = l1 + l3 + N - 9999
elif M == 6:
    ans = l1 + l3 + l5

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())
s = 0 # 奇数の個数
for n in range(1, N+1):
  if len(str(n)) % 2 == 1: # 奇数の場合
    s += 1
print(s)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

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

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

print(ans)

Submission status: Accepted

Solution code:
import math

dp = [0, 9, 0, 0, 0, 0]
for i in range(2, 6):
	 if i&1:
	 	dp[i] = dp[i-1] + pow(10, i-1)*9
	 else:
	 	dp[i] = dp[i-1]

n = int(input())
max_pow = int(math.log10(n))

if max_pow&1:
	ans = dp[max_pow]
else:
	ans = n - pow(10, max_pow) + dp[max_pow] + 1
print(ans)

Submission status: Accepted

Solution code:
def digitCount(num):
  digits = 0
  while num > 0:
    digits += 1
    num = num // 10
  return digits

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

if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
n=int(input())
# n = n[0] n[1] ... n[5]
j=0
j += min(9, n)
if n >= 100:
    j += min(900, n-99)
if n>= 10000:
    j += min(90000, n-9999)


print(j)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
import sys
from collections import deque
sys.setrecursionlimit(20000000)
input = sys.stdin.readline


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

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

    print(a)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
count = 0

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
ans=0
if n>=9:
  ans+=9
else:
  ans+=n
if n>=999:
  ans+=900
else:
  ans+=max(0,n-99)
if n>=99999:
  ans+=90000
else:
  ans+=max(0,n-9999)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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())
digits=len(str(n))
cnt=0
for i in range(int(digits/2)):
  cnt+=9*(10**(i*2))
if digits%2==1:
  cnt+=n-10**(digits-1)+1
print(cnt)

Submission status: Accepted

Solution code:
N = input()

length = len(N)

n = int(N)

ans = 0

for i in range(1,length):
    if i % 2 == 1:
        ans += 9*(10**(i-1))


# print(ans)
if length % 2 == 1:
    ans += n-10**(length-1)+1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
ans=min(n,9)
if n>99: ans=min(n-90,909)
if n>9999: ans=n-9000-90
if n>99999: ans=90909
print(ans)