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

n = int(input())

l = math.log10(n)

cnt = 0

if l < 1:
    print(n)
elif l < 2:
    print(9)
elif l < 3:
    print(9 + n - 99)
elif l < 4:
    print(9 + 999 - 99)
elif l < 5:
    print(9 + 999 - 99 + n - 9999)
else:
    print(9 +999 - 99 + 99999 - 9999)

Submission status: Accepted

Solution code:
n=int(input())
if n < 10:
	print(n)
else:
	erg = 0
	if len(str(n)) % 2 == 1:
		erg += n - 10**(len(str(n))-1) + 1
	#print(erg)
	for k in range(1, len(str(n)), 2):
		erg += 10**k - (10**(k-1))
	print(erg)

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())
 
exp = 1000
expMin = 100
 
result = min(9, n)
while n >= exp - 1:
  result += (exp - expMin)
  expMin = exp * 10
  exp = exp * 100
  
remainder = n - (expMin - 1)
if remainder >= 0:
  result += remainder
  
print(result)

Submission status: Accepted

Solution code:
def keta(x):
  keta=1
  while x//10!=0:
    keta+=1
    x=x//10
  return keta
N=int(input())
numbers=0
for i in range(1,N+1):
  if keta(i)%2==1:
    numbers+=1

print(numbers)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("YES")
    elif q == 0:print("NO")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)
"""
#decomment when needed
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
"""
n=ip()
s=0
for k in range(1,n+1):
    if len(str(k))%2:s+=1
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
if len(n) == 1:
    print(n)
elif len(n) == 2:
    print(9)
elif len(n) == 3:
    print((int(n) - 90))
elif len(n) == 4:
    print(909)
elif len(n) == 5:
    print((int(n) - 9090))
elif len(n) == 6:
    print(9 + 900 + 90000)

Submission status: Accepted

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

Submission status: Accepted

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


def count_digit(n: int) -> int:
    digit = 0

    while n:
        digit += 1
        n //= 10

    return digit


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

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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


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

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

ans=0
num = int(input())

def div (num,n=0):
    if num<1:return n-1
    else:return div(num/10,n+1)

m=div(num)
mod = num-10**m+1
    
for i in range(m):
    if i%2==0: ans += 10**(i+1)-10**i
if m%2==0: ans+=mod

print(ans)

Submission status: Accepted

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

# keta=n
ttl=0
if len(str(n)) % 2 != 0:
    ttl+=(n - 10**(keta - 1)+1)
    
# keta<n
for i in [i for i in range(keta) if i % 2 != 0]:
    ttl+=(10**(i-1) * 9)

print(ttl)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    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:
# 桁数が奇数の時だけ数える（1~9, 100~999, 10000~99999)

n = int(input())
ans = 0

for i in range(1, n+1):
    if len(str(i)) in [1, 3, 5]:
        ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf = 10**20

def oddDigit(x):
    s = str(x)
    return(len(s)%2 == 1)

N = int(input())
ans=0
for i in range(1,N+1):
    if oddDigit(i):
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
a = int(input())

b = [i for i in range(a) if len(str(i+1))%2!=0]

print(len(b))

Submission status: Accepted

Solution code:
N = int(input())
def f(a,count):
    a2 = 10**a
    if a2 <= N:
        if a % 2 == 1:
            count = count + a2 - (10**(a-1))
        return f(a+1,count)
    else:
        if a % 2 == 1:
            return count+ (N- (10**(a-1))) + 1
        else:
            return count
print(f(1,0))

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1,N+1):
    N_str = str(i)
    N_list = []
    for k in N_str:
        N_list.append(k)
    if len(N_list)%2 == 1:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

if n < 10:
    print(n)

elif n < 100:
    print(9)

elif n < 1000:
    print(n - 90)

elif n < 10000:
    print(909)

elif n < 100000:
    print(n - 9090)

else:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

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


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


# 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 = int(input())
d = len(str(n))
a = [9, 0, 900, 0, 9000]
c = 0
for i in range(1, d):
  if i % 2 == 1:
  	c += 9 * (10**(i-1))
  
if d == 1:
  c += n
else:
  c += n - int('9'*(d-1)) if d % 2 == 1 else 0

print(c)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import math

in1 = input()
t = math.log(int(in1),10)
t2 = math.floor(t)
t3 = math.ceil(t2/2)

ii = 0
sum = 0
for i,t in enumerate(range(t3)):
    c = 9*(10**ii)
    ii += 2    
    sum += c

t4 = int(in1) - 10**t2 + 1 if t2%2 == 0 else 0

print("{}".format(sum+t4))

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# li = list(map(int,input().split()))	

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

def keta(N):
    ten = 1
    for i in range(1, 8):
        if N/ten < 1:
            break
        ten = ten*10
    return i-1
        
if keta(N)==1:
    ans = N
elif keta(N)==2:
    ans = 9
elif keta(N)==3:
    ans = 9 + N-99
elif keta(N)==4:
    ans = 909
elif keta(N)==5:
    ans = 909 + N-9999
elif keta(N)==6:
    ans = 90909

print(ans)

Submission status: Accepted

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

n = int(input())

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

print(ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
num = int(input())
num_digit = len(str(num))

if num_digit == 1:
    print(num)
elif num_digit == 2:
    print(9)
elif num_digit == 3:
    print(9 + (num - 100 + 1))
elif num_digit == 4:
    print(909)
elif num_digit == 5:
    print(909 + (num - 10000 + 1))
elif num_digit == 6:
    print(90909)

Submission status: Accepted

Solution code:
import math

n = int(input())
ans = sum(1 for i in range(1, n + 1) if (math.floor(math.log10(i)) + 1) % 2 != 0)
print(ans)

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

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

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

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

print(ans)

Submission status: Accepted

Solution code:
n = input()

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

print(cnt)

Submission status: Accepted

Solution code:
N=int(input())
if N>9:
    if N>99:
        if N>999:
            if N>9999:
                if N>99999:
                    print(90909)
                else:
                    print(909+N-9999)
            else:
                print(909)
        else:
            print(9+N-99)
    else:
        print(9)
else:
    print(N)

Submission status: Accepted

Solution code:
N = int(input())
if 1 <= N and N < 10:
    ans = N
if 10 <= N  and N < 100:
    ans = 9
if 100 <= N and N < 1000:
    ans = 9 + N - 99
if 1000 <= N and N < 10000:
    ans = 9 + 999 - 100 + 1
if 10000 <= N and N < 100000:
    ans = 9 + (999 - 100 + 1) + N - 9999
if N == 100000:
    ans = 9 + (999 - 100 + 1) + N - 9999 - 1
print(ans)

Submission status: Accepted

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

if len(N) <= 1:
	print(n)
elif len(N) <= 2:
	print(9)
elif len(N) <= 3:
	print(9+n-99)
elif len(N) <= 4:
	print(9+999-99)
elif len(N) <= 5:
	print(9+999-99+n-9999)
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:
        count = count + 1
        
print("{}".format(count))

Submission status: Accepted

Solution code:
a = int(input())

counter = 0

if a < 10:
  counter = a
elif a < 100:
  counter = 9
elif a < 1000:
  counter = 9 + (a -99)
elif a < 10000:
  counter =  909
elif a < 100000:
  counter = 909 + (a - 9999)
elif a == 100000:
  counter = 90909

print(counter)

Submission status: Accepted

Solution code:
N = int(input())

c = 0
if N == 100000:
    c = (99999 - 9999) + (999 - 99) + (9 - 0)
elif N >= 10000:
    c = N - 9999 + (999 - 99) + (9 - 0)
elif N >= 999:
    c = (999 - 99) + (9 - 0)
elif N >= 100:
    c = N - 99 + (9 - 0)
elif N >= 9:
    c = (9 - 0)
else:
    c = N
print(c)

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

#整数をばらけさせてリスト化
list_n = list(range(1,n+1))
#print(list_n)

#桁の長さが奇数なら数え上げる
cnt = 0
for i in list_n:
     if (len(str(i)))%2 == 1:
            cnt += 1
     else: pass
print(cnt)

Submission status: Accepted

Solution code:


N = int(input())
counter =0

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

print(counter-1)

Submission status: Accepted

Solution code:
N = int(input())

n, count = 10, 0
while N >= n:
  count += n - n // 10
  n *= 100
if N >= n // 10:
  count += N - n // 10 + 1
print(count)

Submission status: Accepted

Solution code:
def q54(n):
    #a = [len(str(i))%2 for i in range(1, 11)]
    a = filter(lambda x: x != 0, [len(str(i))%2 for i in range(1, n+1)])
    print(len(list(a)))

N = int(input())
q54(N)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for i in range(1, N+1):
    if len(str(i)) % 2 == 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(909)
elif n<100000:
  print(909+(n-9999))
else:
  print(90909)

Submission status: Accepted

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

for i in range(1,n+1):

    if len(str(i)) % 2 == 1:
        count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
 
sum=0
i=0
 
while i<len(str(a)):
	if i==int(len(str(a)))-1:
		sum=sum+a-10**i+1
	else:
		sum=sum+10**(i+1)-10**(i)
	#print(i,sum)
	i=i+2
print(sum)

Submission status: Accepted

Solution code:
import sys

N = int(sys.stdin.readline().rstrip())
counter=0
if N >= 10:
  counter+=9
else:
  counter+=N
  print(counter)
  exit()

if N < 100:
  print(counter)
  exit()
  
if N >= 1000:
  counter+=900
else:
  counter+=N-99
  print(counter)
  exit()
  
if N < 10000:
  print(counter)
  exit()
  
if N >= 100000:
  counter+=90000
else:
  counter+=N-9999
  
print(counter)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
i = input()
n = len(i)
ans = 0
for j in range(n + 1):
  if j == n and j % 2 == 1 and j == 1:
    ans += int(i)
  elif j == n and j % 2 == 1:
    ans += int(i) - int(str(9) * (j - 1))
  elif j == 1:
    ans += 9
  elif j % 2 == 1:
    ans += 10 ** j - int(str(9) * (j - 1)) - 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
str_N = str(N)
if len(str_N)%2 == 0:
  N = 10 ** (len(str_N))-1
k = len(str_N)//2
ans2 = 0
for i in range(k):
  ans2 = ans2 + 10 ** (2*i+1) - 10 **(2*i)
ans2 += N - (10**(2*k) -1)
print(ans2)

Submission status: Accepted

Solution code:
"""
 // Author : snape_here - Susanta Mukherjee
 // Date : 27/07/2019

"""
from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
else:
    _str = str
    str = lambda x=b"": x if type(x) is bytes else _str(x).encode()

    
#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
from math import ceil,floor,log,sqrt,factorial,pow,pi
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *,threading


# For getting input from input.txt file 
#sys.stdin = open('input.txt', 'r')  
  
# Printing the Output to output.txt file 
#sys.stdout = open('output.txt', 'w') 

def ii(): return int(input())
def fi(): return float(input())
def si(): return str(input())
def mi(): return map(int,input().split())
def li(): return list(mi())

def main():
    
    n=ii()
    s=len(str(n))
    n=int(n)
    if s==1:
        ans=n 
    elif s==2:
        ans=9 
    elif s==3:
        ans=10+(n-100)
    elif s==4:
        ans=909 
    elif s==5:
        ans=910+(n-10000)
    elif s==6:
        ans=90909
    print(ans)

# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        if self.buffer.tell():
            return self.buffer.read()
        return os.read(self._fd, os.fstat(self._fd).st_size)

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", b" "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", b"\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip(b"\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
dig=len(str(N))
digr=dig-(dig%2)-2
intr=sum([10**i for i in range(0, digr+1,2)])*9
if (dig % 2):
    intr=intr+N-10**(dig-1)+1

print(intr)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys, math, itertools, bisect, copy, re
from collections import Counter, deque, defaultdict

# from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
# from functools import reduce
# from math import ceil, floor, log10, log2, factorial
# from pprint import pprint

INF = float('inf')
MOD = 10 ** 9 + 7
EPS = 10 ** -7
sys.setrecursionlimit(1000000)

# N = int(input())
# N,M = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]
# DP = [[0] * 100 for _ in range(100)]
# DP = defaultdict(lambda: float('inf'))

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())
a = 90000*(bool(N//100000))
b = 900*(bool(N//1000))
c = 9*(bool(N//10))
d = (N-99)*(bool(N//100)-bool(N//1000))
e = (N-9999)*(bool(N//10000)-bool(N//100000))
f = N*(1-bool(N//10))
print(a+b+c+d+e+f)

Submission status: Accepted

Solution code:
from heapq import heappush, heappop
from collections import deque
import itertools
from itertools import permutations
import sys
import bisect
sys.setrecursionlimit(10**6)
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
YNeos='YNeos'
GYN=['Yes','trumpet']
mo=10**9+7
imp='IMPOSSIBLE'

#a,b,c=MI()
n=I()
a=0
for i in range(1,n+1):
    if len(str(i))%2==1:
        a+=1
print(a)

Submission status: Accepted

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

for i in range(1, N+1):
	if len([x for x in 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:
p = 10
N = int(input())
r = 0
while N>=p**(2*r):
    r += 1
r -= 1
if N < p**(2*r+1):
    print(N-p**(2*r) + 1 + (p**(2*r)-1)//(p+1))
else:
    print((p**(2*(r+1))-1)//(p+1))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import glob

#IS_TEST = 1

# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = 'ABC\\136\\B'

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            return self.problem[self.index]
            self.index += 1
        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                self.initialize(path)
                self.resolve()
        except NameError:
            self.resolve()


class B(Common):

    def resolve(self):

        n = int(self.input_data())
        digits = len(str(n))
        result = 0
        if digits % 2 != 0:
            result += n - (10 ** (digits-1)) + 1
        for i in range(1, digits):
            if i % 2 == 0:
                continue
            else:
                result += 10 ** (i-1) * 9

        print(str(result))



solver = B(REL_PATH)
solver.exec_resolve()

Submission status: Accepted

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

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 n==10**5:
    print('90909')
elif n >= 10000:
    print(str(910 + n-10000))
elif n >= 1000:
    print('909')
elif n >= 100:
    print(str(10 + n-100))
elif n >= 10:
    print('9')
else:
    print(str(n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
if N == 10**5:
  print("90909")
elif N >= 10**4:
  resid=N-10**4+1
  print(str(9+900+resid))
elif N >= 10**3:
  print("909")
elif N >= 10**2:
  resid=N-10**2+1
  print(str(9+resid))
elif N >= 10:
  print("9")
else:
  print(str(N))

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for n in range(1, N + 1):
    ns = str(n)
    if len(ns) % 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())
print(len(list(filter(lambda x: len(str(x))%2 == 1, 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):
    digit = 1
    while i//10 > 0:
        digit += 1
        i /= 10
    if digit%2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = input()
keta = len(n)

nine_count = 9
ans = 0
for i in range(1, keta):
    if i%2 == 1:
        ans += nine_count
    nine_count *=10

if keta%2 == 1:
    num = "1"
    for i in range(keta - 1):
        num += "0"
    ans += (int(n) - int(num) + 1)

print(ans)

Submission status: Accepted

Solution code:
import math

n = input()

digits = len(n)
count = 0


def even_count(d):
    c = 0
    for i in range(0, int(d), +2):
        c += math.pow(10, i)
    return c * 9


if digits % 2 == 0:
    count += even_count(digits)
else:
    if digits - 1 != 0:
        count += even_count(digits - 1)
    count += int(n) - math.pow(10, digits - 1) + 1

print(int(count))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
if n > 99998:
  ans = 90909
elif n > 9998:
  ans = 909+n-9999
elif n > 998:
  ans = 909
elif n > 98:
  ans = 9+n-99
elif n > 8:
  ans = 9
else:
  ans = n

print(ans)

Submission status: Accepted

Solution code:
a = input()
l = len(a)
a = int(a)
num=0
if(l==6):
  num = 90909
elif(l==5):
  num = 909 + (a - 9999)
elif(l==4):
  num = 909
elif(l==3):
  num = 9 + (a - 99)
elif(l==2):
  num = 9
elif(l==1):
  num = a
print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
unchi = 0
while a>=1:
    if 99999 >= a >= 10000:
        unchi += 1
    elif 999 >= a >= 100:
        unchi += 1
    elif 9 >= a >= 1:
        unchi += 1
    a -= 1
print(unchi)

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for n in range(1, N + 1):
    if not (len(str(n)) / 2).is_integer():
        count += 1

print(count)

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())

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

if k%2 == 0:
    for i in np.arange(1, k+1, 2):
        ans += 9 * (10**(i-1))
    print(ans)
    
else:
    for i in np.arange(1, k, 2):
        ans += 9 * (10**(i-1))
    ans += N - 10**(k-1) +1
    print(ans)

Submission status: Accepted

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

print(result)

Submission status: Accepted

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

length = len ( N_str )

num = 0

for i in range(length-1):
    if (i%2!=0):
        continue
    num = num + 9 * 10 ** i

if (length%2!=0):    
    num = num + ( N - 10**(length-1) + 1 )

print ( num )

Submission status: Accepted

Solution code:
n = int(input())
m = n
cnt = 0
while(n>=1):
    n = n/10
    cnt += 1
ans = 0
i = 1
while( i < cnt):
    ans += 9 * 10**(i-1)
    i += 2
    

if cnt%2 == 1:
    ans += m-10**(i-1) + 1
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if s==6:
    ans = 10**(1-1)*9+10**(3-1)*9+10**(5-1)*9
elif s==5:
    ans = 10**(1-1)*9+10**(3-1)*9+(N-10000+1)
elif s==4:
    ans = 10**(1-1)*9+10**(3-1)*9
elif s==3:
    ans = 10**(1-1)*9+(N-100+1)
elif s==2:
    ans = 10**(1-1)*9
else:
    ans = N-1+1

print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

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

print(ans)

Submission status: Accepted

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