Problem:


Score : 200 points

Problem Statement

Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Constraints

1 \leq N \leq 10^5

Input

Input is given from Standard Input in the following format:

N

Output

Print the number of positive integers less than or equal to N that have an odd number of digits.

Sample Input 1

11

Sample Output 1

9

Among the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \ldots, 9.

Sample Input 2

136

Sample Output 2

46

In addition to 1, 2, \ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \ldots, 136.

Sample Input 3

100000

Sample Output 3

90909



Sample input:
11


Sample output:
9

Submission status: Accepted

Solution code:
N = int(input())

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

print(res)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

N, = map(int, input().split())

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

Submission status: Accepted

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

if digit_n % 2 == 0:
    for i in range(digit_n // 2):
        ans += 9 * 10 ** (i * 2)

else:
    if digit_n != 1:
        for i in range((digit_n - 1) // 2):
            ans += 9 * 10 ** (i * 2)
        hasuu = n - 10 ** ((i+1)*2)
        ans += hasuu + 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 = input('')

n = int(n)

result = []
for i in range(1,n+1):
    if len(str(i)) % 2 !=0:
        result.append(i)
print(len(result))

Submission status: Accepted

Solution code:
N = int(input())

result = list(filter(lambda i: len(str(i)) % 2 != 0, range(1,N+1)))
print(len(result))

Submission status: Accepted

Solution code:
n=str(input())
if len(n)%2==0:
    if len(n)==2:
        print(9)
    elif len(n)==4:
        print(909)
    else:
        print(90909)
else:
    if len(n)==1:
        print(int(n))
    elif len(n)==3:
        print(int(n)-90)
    else:
        print(int(n)-9090)

Submission status: Accepted

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

n= int(input())

sum = 0

i = 0
while True:
    min = 10 ** i
    max = 10 ** (i+1) - 1

    if n < min:
        break
    elif n < max:
        max = n

    sum += max - min + 1
    i += 2

print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(N):
    s = str(i+1)
    if len(s) == 1 or len(s) == 3 or len(s) == 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:
import math

n = int(input())

ans = 0
for i in range(1, n + 1):
    if math.floor(math.log10(i)) % 2 == 1:
        continue
    else:
        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:
        continue
    else:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
digit = 1

ans = 0
for i in range(1,N+1):
  if (10**digit)-1<i:
    digit += 1
  if digit%2==1:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

# inputa = [int(n) for n in inputa]
# inputa.sort()

# inputa = list(inputa[0])

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
max_power = int(np.log10(N))
counter = 0
for power in range(1, max_power+1, 2):
    counter += 10 ** power - 10 ** (power - 1)
if max_power % 2 == 0:
    counter += N - 10 ** max_power + 1
else:
    pass
print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

if n < 100:
  print(min(n,9))
elif n < 10000:
  print(min(n-90,909))
elif n <= 100000:
  print(min(n-9090,90909))

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
s = input()
n = int(s)
l = len(s)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

l = [i for i in range(1, n+1) if len(str(i)) % 2 == 1]

print(len(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=input()
#N=list(map(int,input().split()))
b=int(a)
l=len(a)

if l==1:
    s=b

if l==2:
    s=9

if l==3:
    s=9+b-99
if l==4:
    s=909
if l==5:
    s=909+b-9999
if l==6:
    s=90909

print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

def solve():
    N = int(input())
    # N以下の整数のうち、桁数が奇数のものの数

    """
    100 ~ 999 = (1000 - 100)
    """

    ans = 0
    if N >= 10**5:  # 100000
        ans += (10**5 - 10**4)
        ans += (10**3 - 10**2)
        ans += (10**1 - 1)
    elif N >= 10**4:  # 10000
        ans += (N - 10**4 + 1)
        ans += (10**3 - 10**2)
        ans += (10**1 - 1)
    elif N >= 10**3:  # 1000
        ans += (10**3 - 10**2)
        ans += (10**1 - 1)
    elif N >= 10**2:  # 100
        ans += (N - 10**2 + 1)
        ans += (10**1 - 1)
    elif N >= 10**1:  # 10
        ans += (10**1 - 1)
    elif N >= 1:
        ans += N
    
    print(ans)

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
ans=0
for i in range(1,x+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())
if(N<10):
    print(N)
elif(N<1000):
    print(max(0, N-99)+9)
elif(N<100000):
    print(max(0, N-9999)+909)
else:
    print(90909)

Submission status: Accepted

Solution code:
n = int(input())
c = len(list(str(n)))
if c % 2 == 1:
    # 奇数処理
    if c == 1:
        print(n)
    elif c == 3:
        print(9 + (n - 100 + 1))
    else:
        print(9 + 900 + (n - 10000 + 1))
else:
    # 偶数処理
    if c == 2:
        print(9)
    elif c == 4:
        print(9 + 900)
    else:
        print(9 + 900 + 90000)

Submission status: Accepted

Solution code:
N = int(input())

if(N == 100000):
    ans = 90909
elif(10000 <= N < 100000):
    ans = 909 + N - 9999
elif(1000  <= N < 10000):
    ans = 909
elif(100   <= N < 1000):
    ans = 9 + N -99
elif(10    <= N < 100):
    ans = 9
elif(1     <= N < 10):
    ans = N

print(ans)

Submission status: Accepted

Solution code:
a = int(input())
s = str(a)
c = 0
for i in range(len(s)-1):
    # print(c)
    if i%2 == 0:
        c += 10**(i+1) - 10**i 

if len(s) %2 == 1 and len(s)> 1:
    c += int(s[1:])+1 + (int(s[0])-1)*(10**(len(s)-1))
elif len(s)==1:
    c +=a

print(c)

Submission status: Accepted

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

print(num)

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 judge_digit(arg_num):
    result = len(str(arg_num))
    return result

N = int(input())
cnt =0

for i in range(1,N+1) :
    aaa = judge_digit(i)
    if aaa %2 ==0 :
        cnt +=0
    else:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
N = input()

int_n = int(N)
count=0

while(int_n > 0):
    #文字数取得
    letterLen = len(str(int_n))
 
    if (letterLen % 2 == 1):
        count +=1 
        
    int_n -=1

print(count)

Submission status: Accepted

Solution code:
n = int(input())

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

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

if N < 10:
    print(len(range(1, N+1)))
elif N < 100:
    print("9")
elif N < 1000:
    print(str(9 + len(range(100, N+1))))
elif N < 10000:
    print(str(9+900))
elif N < 100000:
    print(str(9+900+len(range(10000, N+1))))
else:
    print("90909")

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

import math

n = int(input())
o = math.floor(math.log(n, 10))
ans = 0

for i in range(o):
    if i % 2 == 0:
        ans += 10 ** (i + 1) - 10 ** i
    else:
        continue

if o % 2 == 0:
    ans += n - (10 ** o) + 1


print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 12 18:42:33 2019
@author: doppe
"""

N = int(input())

list = [9,0,900,0,90000,0,9000000]
count = 0
i = 0
param = 1
while True:
    if N  < param * 10:
        if i % 2 == 0:
            count += N - param + 1
        break
    else:
        count += list[i]
    i += 1
    param *= 10
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
keta = len(str(N))
cnt = 0

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

if keta % 2 == 1:
    cnt += N - 10**(keta-1) + 1

print(cnt)

Submission status: Accepted

Solution code:
import sys
from operator import itemgetter
import math
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
keta = len(str(n))
rs = 0
if keta % 2 == 1:
    rs += n - (10 ** (keta - 1)) + 1
li = [0, 9, 0, 900, 0, 90000]
keta -= 1
while keta > 0:
    rs += li[keta]
    keta -= 1
print(rs)

Submission status: Accepted

Solution code:
n = int(input())

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

print(nbs)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import io
import sys

MOD = 10 ** 9 + 7


def IN_S():
  return input()


def IN_I():
  return int(input())


def IN_L_I():
  return list(map(int, input().split()))


def IN_L_S():
  return list(map(str, input().split()))


def STR_SPLIT(s, n):
  for l in range(0, len(s), n):
    yield s[0 + l:n + l]


def T_IN():
  global test_str
  sys.stdin = io.StringIO(test_str[1:-1])


test_str = '''
136
'''


def MAIN():
  # T_IN()
  A()


def A():
  n = IN_I()

  t = 0
  if n > 9:
    t += 9

  if n > 999:
    t += 900

  if n > 99999:
    t += 90000

  if n <= 9:
    t += n
  elif 99 < n <= 999:
    t += n - 99
  elif 9999 < n <= 99999:
    t += n - 9999

  print(t)
  return None


def B():
  return None


def C():
  return None


MAIN()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import log10, floor, ceil
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):
    m = str(i)
    if len(m)%2==1:
        cnt += 1
print(cnt)

Submission status: Accepted

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

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:
"""
AtCoder
    :author: vierbein
"""
from __future__ import absolute_import, division, print_function

# import itertools as it
# import collections
import sys


def pp(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)


def get_digits(n):
    res = 0
    while n > 0:
        res += 1
        n //= 10
    
    return res


N = int(input())
digits = get_digits(N)

if digits == 2:
    res = 9
elif digits == 4:
    res = 909
elif digits == 6:
    res = 90909
elif digits == 1:
    res = N
elif digits == 3:
    res = N - 99 + 9
elif digits == 5:
    res = N - 9999 + 909
else:
    res = -1

print(res)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
N_bit = len(str(N))
ans=0
if N_bit%2==0:
  if N_bit==6:
    ans=90909
  elif N_bit==4:
    ans=909
  elif N_bit==2:
    ans=9
else:
  if N_bit==5:
    ans+=909
    ans+=N-10000+1
  elif N_bit==3:
    ans+=9
    ans+=N-100+1
  elif N_bit==1:
    ans+=N-1+1
print(ans)

Submission status: Accepted

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

n = int(input())
d = len(str(n))
count = 0
ans = n

for i in range(d):
    if i%2 == 0: count += min(ans, 9*(10**i))
    ans -= 9*(10**i)

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 main():
    value = int(input())
    count = 0
    while value > 0:
        if len(str(value)) % 2 != 0:
            count += 1
        value -= 1
    print(count)
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(N: int):
    k = math.floor(math.log10(N))
    counter = 0
    if k == 0:
        counter = N
    if k == 1:
        counter = 9
    if k == 2:
        counter = 9 + (N - 99)
    if k == 3:
        counter = 909
    if k == 4:
        counter = 909 + (N - 9999)
    if k == 5:
        counter = 90909
    print(counter)
    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:
import math as m

def has_odd_digits(i):
  if i > 10**5:
    raise Exception("?")
  if 0 <= i and i <= 9:
    return True
  elif 100 <= i and i <= 999:
    return True
  elif 10000 <= i and i <= 99999:
    return True
  return False

n = int(raw_input())
# 1 digit = 10
# 3 digit = 9*10*10 = 900
# 5 digit = 9*10*10*10*10 = 90000
x = m.log(n, 10)

p = 0
for i in xrange(n):
  if has_odd_digits(i+1):
    p += 1
print p

Submission status: Accepted

Solution code:
n = int(input())

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

print(count)

Submission status: Accepted

Solution code:
def solve(n):
    ans = 0
    for i in range(1, n+1):
        if (i < 10) or (10**2 <= i < 10**3) or (10**4 <= i < 10**5):
            ans += 1
    return ans

n = int(input())
print(solve(n))

Submission status: Accepted

Solution code:
n=input()
ans=0
nl=len(n)
if nl==1:
    print(n)
    exit()
if nl>1:
    ans+=9
if nl==3:
    ans+=int(n)-99
    print(ans)
    exit()
if nl>3:
    ans+=900
if nl==5:
    ans+=int(n)-9999
if nl==6:
    ans+=90000
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
a = int(stdin.readline().rstrip())
b = len(str(a))
c = b//2
d = 0
if b == 1:
    print(a)
elif b % 2 == 0:
    for i in range(c):
        d += (10**(2*i+1)-10**(2*i))
    print(d)
else:
    for s in range(c):
        d += (10**(2*s+1)-10**(2*s))
    d += a-(10**(2*c))+1
    print(d)

Submission status: Accepted

Solution code:
keta_count=1
N=int(input())
i=N
while i >=10:
     i=i//10
     keta_count+=1
      
if keta_count==1: 
    count=N
elif keta_count%2==0: 
    x=keta_count/2 
    count=0
    while x > 0:
        count+=9*100**(x-1)
        x-=1
else: 
    x=(keta_count-1)/2 
    count=0
    while x > 0:
        count+=9*100**(x-1)
        x-=1
    count+= N+1-10**(keta_count - 1)

print(str(round(count)))

Submission status: Accepted

Solution code:
N = int(input())

# 1桁
if N < 10:
    print(N)

# 2桁
elif N < 100:
    print(9)

# 3桁
elif N < 1000:
    print(9 + (N - 99))

# 4桁
elif N < 10000:
    print(9 + 900)

# 5桁
elif N < 100000:
    print(9 + 900 + (N - 9999))

elif N == 100000:
    print(9 + 900 + 90000)

Submission status: Accepted

Solution code:
N = input()

Nketa = len(N)

if Nketa % 2 == 0:
    total = 0
    for i in range(1, Nketa, 2):
        idai = int('9' + '0'*(i-1))
        total += idai
    
elif Nketa % 2 == 1:
    total = 0
    for i in range(1, Nketa, 2):
        idai = int('9' + '0'*(i-1))
        total += idai
    
    Nstart = int('1' + '0'*(Nketa-1))
    total += int(N) - Nstart + 1

print(total)

Submission status: Accepted

Solution code:
N = int(input())

if N < 10: # 1桁
    print(N)
elif N < 100: # 2桁
    print(9)
elif N < 1000: # 3桁
    print(9 + (N - 99))
elif N < 10000: # 4桁
    print(9 + 900)
elif N < 100000: # 5桁
    print(9 + 900 + (N - 9999))
elif N == 100000: # 6桁
    print(9 + 900 + 90000)

Submission status: Accepted

Solution code:
n = int(input())
if n == 10**5:
    print(9+900+90000)
elif 10**4<=n<10**5:
    print(909+(n-9999))
elif 10**3<=n<10**4:
    print(909)
elif 10**2<=n<10**3:
    print(9+(n-99))
elif 10<=n<10**2:
    print(9)
else:
    print(n)

Submission status: Accepted

Solution code:
n=int(input())

ans = list(range(1,n+1,1)) 

keta = [len(str(i)) for i in ans if len(str(i)) % 2==1]

print(len(keta))

Submission status: Accepted

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

count = 0

if N == 100000 :
  count = 90909
if N >= 10000 and N <= 99999 :
  count = N - 10000 + 1 + 900 + 9
if N >= 1000 and N <= 9999 :
  count = 909
if N >= 100 and N <= 999 :
  count = N - 100 + 1 + 9
if N >= 10 and N <= 99 :
  count = 9
if N >= 1 and N <= 9 :
  count = N

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()
count=0

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

Submission status: Accepted

Solution code:
count = 0

n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

count = 0
if N < 10:
    count = N
elif 10 <= N < 100:
    count = 9
elif 100 <= N < 1000:
    count += 9
    count += N - 99
elif 1000 <= N < 10000:
    count += 999 - 99 + 9
elif 10000 <= N < 100000:
    count += 999 - 99 + 9
    count += N - 9999
else:
    # N == 100000
    count = 99999 - 9999 + 999 - 99 + 9

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

Submission status: Accepted

Solution code:
N = int(input())
import math
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 == 1 :
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())

ANS=[0]*5
flag=0

if N<100000:
    if N<10000:
        if N<1000:
            if N<100:
                if N<10:
                    ANS[0]=int(N%10)
                    flag=flag+1
                ANS[1]=9
                flag=flag+1
            ANS[2]=9+N-100+1
            flag=flag+1
        ANS[3]=909
        flag=flag+1
    ANS[4]=9+900+N-10000+1
    flag=flag+1
elif N==100000:
    print(90909)

if flag==5:
    print(ANS[0])
if flag==4:
    print(ANS[1])
if flag==3:
    print(ANS[2])
if flag==2:
    print(ANS[3])
if flag==1:
    print(ANS[4])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
digit_count = len(str(N))
if digit_count == 1:
    print(N)
elif (digit_count % 2 == 1):
    print(N - int(str(90) * (digit_count//2)))
else:
    total = 0
    for i in range(0, digit_count//2):
        total += 9*(100**i)
    print(total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#22 ABC136B#
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:
x=int(input())
n=1
f=0
while(n<=x):
    n=str(n)
    if(len(n)%2==1):
        f+=1
    n=int(n)
    n+=1
print(f)

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

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

print(sum)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())

if n < 10:
  m = n
elif n < 100:
  m = 9
elif n < 1000:
  m = n - 90
elif n < 10000:
  m = 909
elif n < 100000:
  m = n - 9090
else:
  m = 90909
print(m)

Submission status: Accepted

Solution code:
# 整数の入力
n = int(input())
# lambdaは無名関数，引数はx
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:
str = input()
num = int(str)
const = len(str)
numbers = len(str)
even = 0
con = 0
a = str[even:const]
b = int(a)
if numbers%2==1:
    pass
else:
    even += 1
    numbers -= 1
    a = str[even:const]
    b = int("9"*(numbers))
while numbers > 0:
    con += (b - 10**(numbers-1) + 1)
    even += 2
    numbers -= 2
    if numbers>0:
        a = str[even:const]
        b = int("9"*(numbers))
print(con)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
while (n > 0):
    len_n = len(str(n))
    numbers_on_that_digit = n - 10**(len_n-1)+1
    n -= numbers_on_that_digit
    if len_n % 2 == 1:
        ans+=numbers_on_that_digit

print (ans)

Submission status: Accepted

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

n= int(input())

sum = 0

while (n > 0):
    n_len = len(str(n))
    cnt = n - 10 ** (n_len - 1) + 1

    if n_len % 2 == 1:
        sum += cnt

    n -= cnt

print(sum)

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

Submission status: Accepted

Solution code:
from sys import stdin

[n] = [int(x) for x in stdin.readline().rstrip().split()]
c = 0

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

Submission status: Accepted

Solution code:
N=int(input())

M=0

for i in range(1,6):
    if N<10**i:
        if i%2==1:
            M+=N-10**(i-1)+1
            break
        else:
            break

    else:
        if i%2==1:
            M+=9*(10**(i-1))


print(M)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
if 1<=N and N<10:
	print(N)
elif 10<=N and N<100:
	print("9")
elif 100<=N and N<1000:
	print(9+N-99)
elif 1000<=N and N<10000:
	print("909")
elif 10000<=N and 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())
print(len([i for i in range(1, n+1) if len(str(i)) % 2 == 1]))

Submission status: Accepted

Solution code:
S = input()
N = int(S)
ans = 0
if len(S) == 1:
    ans = N
if len(S) >= 2:
    ans += 9
if len(S) >= 4:
    ans += 900
if len(S) >= 6:
    ans += 90000
if len(S) == 3: 
    ans += N - 99    
if len(S) == 5:
    ans += N - 9999
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

count = 0

for i in range(6):                                                                                             
    if n >= 10**i and n < 10**(i+1):                                                                           
        for j in range(i+1):                                                                                   
            if j % 2 == 1:                                                                                     
                if j == 1:                                                                                     
                    count += 9                                                                                 
                else:                                                                                          
                    count += 10**j - 10**(j-1)                                                                 
        if i % 2 == 0:                                                                                         
            count += n - 10**i + 1                                                                             
                                                                                                               
        break                                                                                                  

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N_ori = int(input())
i = 1
N = N_ori
sum = 0
while True:
    N = N//10
    if i%2==1 and N >= 1:
        sum += 10**(i-1)*9
    elif i%2 == 1 and N < 1:
        sum += N_ori - 10**(i-1) + 1
    if N == 0:
        break
    i+=1
print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
A0=int(N/100000)
N0=N-A0*100000
A=int(N0/10000)
N1=N-10000*A
B=int(N1/1000)
N2=N1-1000*B
C=int(N2/100)
N3=N2-100*C
D=int(N3/10)
E=N3-10*D

if (A0 >0) :
    print(90909)
elif(A>0):
    print(909+int(N)-10000+1)
elif (B>0):
    print(909)
elif (C>0):
    print(9+int(N)-100+1)
elif (D>0):
    print(9)
else:
    print(int(N))

Submission status: Accepted

Solution code:
N = int(input())

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

print(odd_num)

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)