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:
def q2():
    """ B - Uneven Numbers """
    N = int(input())
    keta = 1
    d = N
    while True:
        d, _ = divmod(d, 10)
        if d > 0:
            keta += 1
        else:
            break

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


if __name__ == '__main__':
    q2()

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(n+1):
    lst =[]
    while i >0:
        lst.append(i%10)
        i //=10
    lst.reverse()
    if len(lst)%2 ==1:
        count += 1

print(count)

Submission status: Accepted

Solution code:
import numpy as np
a = len([n for n in range(1,int(input())+1) if ((np.log10(n)+1)//1)%2!=0])
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

import math
n = int(readline())
count = 0
for i in range(1, n + 1):
    if int(math.log10(i)) % 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 != 0:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

answer = 0
number_of_digits = len(str(N))

total = 0
for nth in range(1, number_of_digits + 1):
    is_odd = nth % 2 is 1
    if not is_odd: continue
    number_of_intergers = (10 ** ((nth - 1))) * 9
    total += number_of_intergers

    if 10 ** nth -1 >= N:
        total -= 10 ** number_of_digits - 1 - N

print(total)

Submission status: Accepted

Solution code:
n = int(input())

cnt = 0

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

Submission status: Accepted

Solution code:
s = input()
N = int(s)
ans = 0
for i in range(1,N+1):
  if len(str(i)) == 1 or len(str(i)) == 3 or len(str(i)) == 5:
    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())
length=len(str(N))
if(length == 1):
    print(N)
elif(length == 2):
    print(9)
elif(length == 3):
    print(9 + len(range(100,N+1)))
elif(length == 4):
    print(909)
elif(length == 5):
    print(909 + len(range(10000,N+1)))
else:
    print(90909)

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-90)
elif 1000<=N<=9999:
    print(909)
elif 10000<=N<=99999:
    print(N-9090)
else:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a= int(input())
result = 0
for i in range(10):
    if a >= 10 ** (i-1) and a < 10 ** i :
        rank = i 
        break

for i in range(rank+1):
    
    if i == 1 and rank is not i:
        result += 10 ** i -1
    elif i == 3 and rank is not i:
        result += 10 ** i  - 10** (i-1)
    elif i == 5 and rank is not i:
        result += 10 ** i  - 10** (i-1)
    elif i == rank and i %2 is not 0:
        result += a - 10 ** (i-1) + 1
    
        
        
print(result)

Submission status: Accepted

Solution code:

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



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




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

Submission status: Accepted

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

Submission status: Accepted

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

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:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
  
def main():
  N = input()
  ans = 0
  if len(N) == 6:
    ans += 10**5 - 10**4
    ans += 10**3 - 10**2
    ans += 10**1 - 10**0
  elif len(N) == 5:
    ans += int(N) - 10**4 + 1
    ans += 10**3 - 10**2
    ans += 10**1 - 10**0
  elif len(N) == 4:
    ans += 10**3 - 10**2
    ans += 10**1 - 10**0
  elif len(N) == 3:
    ans += int(N) - 10**2 + 1
    ans += 10**1 - 10**0
  elif len(N) == 2:
    ans += 10**1 - 10**0
  elif len(N) == 1:
    ans += int(N)
  print(ans)
if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N):
    S = list(str(i + 1))
    if len(S) % 2 == 1:
        count += 1
    else:
        continue

print(count)

Submission status: Accepted

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

keta = int(math.log10(N)+1)
count = 0
for i in range(1,keta+1):
    if i % 2 == 1:
        if i == 1:
            if keta == 1:
                count += N
            else:
                count += 9
        elif i != keta:
            count += int('8'+'9'*(i-1)) + 1
        else:
            count += N - 10 ** (keta-1) + 1
print(count)

Submission status: Accepted

Solution code:
print(sum(bool(num + 1) for num in range(int(input())) if len(str(num + 1)) % 2 == 1))

Submission status: Accepted

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    n =input()
    sum = 0
    for i in range(1,len(n)+1):
        if i %2 >0:
            if i ==len(n):
                sum +=  int(n)- 10**(i-1)+1
            else:
                sum += 9 * (10**(i-1))

    print(sum)

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

if u % 2 == 0:
    print((100**(u//2)-1)//11)
elif u % 2 == 1:
    print((100**((u-1)//2)-1)//11 + n - 10**(u-1) + 1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())

i=0
num=0

#桁数
while 10**i <= N:
  i=i+1
    


if i==1:
  num=N
elif i==2:
  num=9
elif i==3:
  num=9+N-99
elif i==4:  
  num=9+999-99
elif i==5:  
  num=9+900+N-9999
elif i==6:  
  num=9+900+99999-9999
  
print(num)

Submission status: Accepted

Solution code:
N = input()
Nlist = list(N)
NN = int(N)
count = 0
for a in Nlist:
  count += 1




if count == 1:
  print(int(NN))
if count == 2:
  print(9)
if count == 3:
  print(int(NN) - 90)
if count == 4:
  print(909)
if count == 5:
  print(int(NN) -9090)
if count == 6:
  print(90909)

Submission status: Accepted

Solution code:
n = int(input())

x = 0

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

print(x)

Submission status: Accepted

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

Submission status: Accepted

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

for n in range(1, len(Ns)):
    if n % 2 == 0:
        continue
    count += 10 ** n - 10 ** (n - 1)

if len(Ns) % 2 == 1:
    count += N - 10 ** (len(Ns) - 1) + 1

print(count)

Submission status: Accepted

Solution code:
n = int(input())
idx = 1
total = 0
tmp = n
while (tmp > 0): 
	if idx == len(str(n)):
		if idx % 2 == 1:
			total += (tmp - 1) * 10 ** (idx - 1)
			total += n % (10 ** (idx - 1)) + 1
	else:
		if idx % 2 == 1:
			total += 9 * 10 ** (idx - 1)
	tmp = int(tmp / 10)
	idx += 1
print (total)

Submission status: Accepted

Solution code:
s = input()
N = int(s)
odd_num = 0
for i in range(1,N+1):
    cnt = 1
    num = i
    while (num // 10) > 0:
        cnt += 1
        num = num//10
    if cnt % 2:
        odd_num += 1
print(odd_num)

Submission status: Accepted

Solution code:
import os, sys, re, math

N = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    ct=0
    for i in range(1,n+1):
        if len(str(i))%2==1:
            ct+=1
    print(ct)
if __name__ == '__main__':
    do()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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(n):
    if len(str(i+1)) % 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:
N=input()
l=len(N)
ans=0
if l%2==1:
    for i in range(1,l,2):
        ans+=9*10**(i-1)
    print(ans+1+int(N)-10**(l-1))
else:
    for i in range(1,l,2):
        ans+=9*(10**(i-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
ans+=9 if n>=10 else n
ans+=900 if n>=1000 else max(n-99,0)
ans+=90000 if n>=100000 else max(n-9999,0)
print(ans)

Submission status: Accepted

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

ans = 0
for i in range(1,digit+1):
    if i%2 == 1:
        if i == digit:
            if  i == 1:
                ans += n
            else:
                ans += n-int('9'*(i-1))
        else:
            ans += 9*10**(i-1)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


def solve(N: int):
    return sum(1 for i in range(1, N+1) if len(str(i)) % 2 == 1)


# Generated by 1.1.6 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
    print(solve(N))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# デバッグ用
GBN_DEBUG = False
def dprn(s, i):
    if GBN_DEBUG: print(", " + s + " = " + str(i), end = "")
def dprns(s):
    if GBN_DEBUG: print(", " + s, end = "")
def dprni(i):
    if GBN_DEBUG: print(i, end=" ")
def endl(): 
    if GBN_DEBUG: print('')
def puts(s): print(s)

#本体ここから

#S = input()
N = int(input())
#S, T = input().split()
#A, B, C = map(int, input().split())
#W = [input() for _ in range(N)]
#A = list(map(int, input().split()))

#GBN_DEBUG = True

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
m = n
x = 1

while m >= 10: #nの桁数を求める
  m = m / 10
  x = x + 1

for i in range(1,x+1):
  if i == x and i%2 == 1: #最後の奇数桁だったら
    ans = ans + n - 10**(i-1) + 1
  elif i%2 == 0: #偶数桁だったら
      continue
  else: #最後の桁意外の奇数だったら
    ans = ans + 9 * 10**(i-1)

print(ans)

Submission status: Accepted

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n < 10:
    print(n)
elif n < 100:
    print(9)
elif n < 1000:
    print(n-90)
elif n < 10000:
    print(909)
elif n < 100000:
    print(n-9999+909)
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==1:
    cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
import math

def dig(n):
    return math.floor(math.log10(n))+1

ans = 0
for i in range(int(input())):
    ans += (dig(i+1) % 2 == 1)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
a=0
cnt = 0
num = N
while 10<=num:
  num/=10;a+=1
if a%2==0:
  for i in range(10**a,N+1):
    cnt += 1
if 4 < a:
  print(cnt + 90909)
elif 2 < a:
  print(cnt + 909)
elif 0 < a:
  print(cnt + 9)
else:
  print(cnt)

Submission status: Accepted

Solution code:
N=int(input())
import math
x=math.floor(math.log10(N))+1
ans=0
for i in range(1,x,2):
  ans+=9*10**(i-1)
if x%2==1:
  ans+=N-10**(x-1)+1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
count=0
def check():
    global count
    if N>=9:
        count+=9
    else:
        count+=N
        return None

    if N>=999:
        count+=999-100+1
    elif N>=100:
        count+=N-100+1
        return None

    if N>=99999:
        count+=99999-10000+1
    elif N>=10000:
        count+=N-10000+1
        return None
check()
print(count)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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:
N = int(input())
if N <= 9:
  print(N)
elif 10 <= N <= 99:
  print(9)
elif 100 <= N <= 999:
  print(N-90)
elif 1000 <= N <= 9999:
  print(909)
elif 10000 <= N <= 99999:
  print(N-9090)
else:
  print(90909)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

N = i_i()

l = len(str(N))

if l == 1 or l == 2:
    print(min(9, N))
elif l == 3 or l == 4:
    print(min(9 + N - 100 + 1, 909))
else:
    print(min(9 + 900 + N - 10000 + 1, 90909))

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

if d % 2 == 1:
  ans = (100 ** ((d-1)//2) - 1) // 11 + (n - 10**(d-1) + 1)
else:
  ans = (100**(d//2) - 1) // 11
  
print(ans)

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if n == 100000:
    ans = 90000 + 900 + 9
elif n >= 10000:
    ans = n - 9999 + 900 + 9
elif n >= 1000:
    ans = 900 + 9
elif n >= 100:
    ans = n - 99 + 9
elif n >= 10:
    ans = 9
else:
    ans = n

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
for i in range(1, N + 1):
	if len(str(i)) & 1 == 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())
l = len(str(n))
res = 0
if l%2 != 0 :
    res = n+1-10**(l-1)
    while l >= 1:
        l -= 2
        res += 10**(l-1)*9
if l%2 == 0:
    l -= 1
    while l >= 1:
        res += 10**(l-1)*9
        l -= 2
print(int(res))

Submission status: Accepted

Solution code:
import math
import os
import random
import re
import sys

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

    res = math.ceil(math.log(n, 10))
    s = 1 if math.log(n, 10) % 2 == 0 else 0

    for i in range(0, res, 2):
        k = 10**(i + 1) - 1
        if n > k:
            s = s + 9 * (10 ** i)
        else:
            s = s + n - 10**i + 1
    
    print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
k=len(str(n))
if k==1 or k==2:
    print(min(9,n))
elif k==3 or k==4:
    print(min(9+n-99,909))
else:
    print(min(909+n-9999,90909))

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:
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 len(list(str(i))) % 2 != 0:
    count += 1

print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

print(res)

Submission status: Accepted

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()

def F(x):
    return (len(str(x)) % 2) == 1
answer = 0
for i in range(1, N+1):
    if F(i):
        answer += 1

print(answer)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = len(str(n))
sum = 0
#print(l)
if l%2 ==0:
  for i in range(int(l/2)):
    sum += 9*(10**(2*i))
else:
  for i in range(int(l//2)):
    sum += 9*(10**(2*i))
  sum += n -10**(l-1) +1
print(sum)

Submission status: Accepted

Solution code:
n=int(input())
l=len(str(n))
ans=0
if l>=4:
    if l==6:
        ans+=100000-10000
    elif l==5:
        ans+=n+1-10000
    ans+=1000-100
    ans+=10-1
elif l>=2:
    if l==3:
        ans+=n+1-100
    ans+=10-1
else:
    ans+=n   
print(ans)

Submission status: Accepted

Solution code:
#B
import math
n = int(input())
count=0
for i in range(1, n + 1):
    if int(math.log10(i) + 1) % 2 != 0:
        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(909)
elif n < 100000:
    print(909+n-9999)
else:
    print(90909)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())

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

print(ans)
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する

Submission status: Accepted

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

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

Submission status: Accepted

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

N = int(input().strip())
#-----

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

s = 0
for i in range(1, d):
    s += 9 * 10 ** (i - 1) if i % 2 else 0
s += int(n) - 10 ** (d - 1) + 1 if d % 2 else 0

print(s)

Submission status: Accepted

Solution code:
N = int(input())

res = 0
if 1<= N <= 9:
  res = N
elif N <= 99:
  res = 9
elif N <= 999:
  res = 9 + (N-99)
elif N <= 9999:
  res = 9 + 900
elif N <= 99999:
  res = 9 + 900 + (N-9999)
else:
  res = 9 + 900 + 90000

print(res)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()
if len(a) ==6:
  print(90909)
elif len(a) == 5:
  print(90909-90000 +int(a)-9999)
elif len(a) == 4:
  print(90909-90000)
elif len(a) ==3:
  print(90909-90000-900+int(a)-99)
elif len(a) ==2:
  print(90909-90000-900)
else:
  print(int(a))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
B - Uneven Numbers
https://atcoder.jp/contests/abc136/tasks/abc136_b

"""
import sys


def solve(N):
    return sum(len(str(i)) % 2 for i in range(1, N+1))


def main(args):
    N = int(input())
    ans = solve(N)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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

Submission status: Accepted

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