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:
# -*- coding: utf-8 -*-
import sys

import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque

#input = stdin.readline


j=0
k=0
n=3
r=1
a=[0]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"


#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])#

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ
#intを取ると文字列分解に使える
'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"


#a,b=map(int, input().split())  #int style 複数数値入力　「A B」みたいなスペース空いた入力のとき

#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


##############################################################################################
##############################################################################################
#under this line explains example calculation



'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''

#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''

'''
import itertools
from itertools import combinations_with_replacement

combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし

combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり


使用例 　　　　　　　　　　　                  出力　　
combinations('ABCD', 2)　　　　　　　　　　　　AB AC AD BC BD CD

combinations_with_replacement('ABCD', 2)　　 AA AB AC AD BB BC BD CC CD DD
'''



'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位ｎ個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
 #(1, 6)
#(3, 3)
#(4, 1)
'''


#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''

'''
素数の判定
'''


def is_prime(n):
    if n == 1: return False

    for k in range(2, int(np.sqrt(n)) + 1):
        #sqrt(n)+1以上は考えて約数はないので却下
        if n % k == 0:
            return False
            #割り切れたらFalse
    return True


'''
npのmaxとmaximumの違い
xs = np.array([1, -2, 3])
np.max(xs, 0)
この出力は3となります．[1, -2, 3]と0の4つの数字のうち，最も大きい値を出力します．

一方で，[max(1, 0), max(-2, 0), max(3, 0)]を出力したい時があります．
その時は，numpyのmaximum関数を用います．

xs = np.array([1, -2, 3])
np.maximum(xs, 0)  # [1, 0, 3]

'''

def factorial(x, mod=10**9+7):
    # x!
    # 階乗
    # ex) factorial(5) = 120
    tmp = 1
    for i in range(1, x+1):
        tmp = (tmp * i) % mod
    return tmp
    '''
    Basically, when you do a**d % n, you actually have to calculate a**d, which could be quite large.
    But there are ways of computing a**d % n without having to compute a**d itself, and that is what pow does.
    '''


########################################################################
########################################################################
#b2=a[:]  #1次元のときはコピーはこれで良い
#print(b2)

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a)  #2次元配列はこうコピーする
#print(b3)

def main():

    steps=0
    state=0
    w=1
    j=0
    k=0
    n=int(input())
    for i in range(1,n+1):
     if len(str(i))%2==1:
        j +=1
    print(j)
    #a,b=map(int, input().split(" "))
    #nl=list(map(int, input().split(" ")))#数字の時
    #s=input()
    #a=[int(i) for i in s]#int取るとstrでも行ける
    #print(a)




    #if state in known_states and not flag: # state => 2 steps => 5
        #こうやってある要素がリストの中にあるか探すのか
    #print(f'steps: {steps}, state: {state}')
    #こう書いてあるとデバックしやすい

    #dp= [[0]*3 for i in range(5)]#列　行
    #dp用の0の入ったやつ
    #dp= [[0]*(w+1) for i in range(n+1)]#0からwまでのw+1回計算するから
    #print(dp)＃初期条件が入る分計算回数+1列分必要(この場合は判断すべきものの数)
    DP = np.zeros(w+1, dtype=int)#これでも一次元リストが作れる
    exdp=np.zeros((3,4)) # ３×４の２次元配列を生成。2次元ならこう
    #dtypeは指定しないとfloatになる
    #for i in range(n):#ちょっとした入力に便利
    #    a, b = map(int, input().split())
        #dp[i][0] += [a]
        #これだとintとlistをつなぐことになって不適
    #    dp[i] += [a]
    #    dp[i] += [b]
        #これはうまくいく
        #やり方はいろいろあるということ
    #print(dp)


    "1行1つの整数を入力を取得し、整数と取得する"
    #nl=list(map(int, input().split(" ")))#数字の時
    #print(number_list)
    "12 21 332 とか入力する時に使う"
    "1行に複数の整数の入力を取得し、整数として扱う"
    #brray=[list(map(int, input().split(" ")))for i in range(N)
    #print(brray)



    '''
    入力
    1234
    出力
    [1, 2, 3, 4]
    '''
    pin_l=["x" for i in range(10)]#内包表記に慣れろ
    #print(pin_l)

    ls = ["a", "b", "c", "d", "e"]


    #print(ls[2:5])
    #スライスでの取得

    #print(ls[:-3])
    #一番左端から右から3番目より左まで取得

    #print(ls[:4:2])
    #スライスで1個飛ばしで取得
    #ないときは左端スタート
    #始点のインデックス番号 : 終点のインデックス番号 : スキップする数+1
    #print(ls[::2])
    '''
    lsというリストの場合に、1つ飛びの値を取得したい場合には
    ls[::2]
    のようにします。こうすると、
    ["a", "c", "d"]と出力される
    '''

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from math import log10
print(sum(not (int(log10(n)) & 1) for n in range(1, int(input()) + 1)))

Submission status: Accepted

Solution code:
N = int(input())

keta = len(str(N))
cnt = 0

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

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

print(cnt)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:

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

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

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

Submission status: Accepted

Solution code:
import sys
import math
import bisect


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

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

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

#############
# Main Code #
#############
ans = 0
for i in range(1,int(input())+1):
  if len(str(i)) %2:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

def main():
    n=I()
    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:
# https://atcoder.jp/contests/abc136/tasks/abc136_b

N = input()
len_n = len(N)
N = int(N)

count = 0

if len_n % 2 == 1:
    current_len_min_val = 10 ** (len_n - 1)
    count += N - current_len_min_val + 1

for i in range(1, len_n, 2):
    count += 10 ** i - 10 ** (i-1)


print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import factorial as fact
import math
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
from collections import deque


#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(range(n),r))



def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
	
def count_str(m):
	tmp={}
	for i in range(10):
		if i in tmp:
			tmp[i]=1
		else:
			tmp[i]+=1
	return tmp

def is_prime(n):
	if n==1: return True

	for i in range(2,int(math.sqrt(n))+1):
		if n%i==0:
			return False
	return True

n=input1()

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

Submission status: Accepted

Solution code:
# ABC136B

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
if 0<=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:
    count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def ketasuu(n):
    ans  = 0
    while (n >= 1):
        n = n/10
        ans += 1
    return ans

n = int(input())

k = ketasuu(n)
ans = 0
for i in range(1,k,2):
    ans += 10**i-10**(i-1)
if (k%2 == 1):
    ans += n-10**(k-1)+1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

c = 0
for i in range(1, int(s)+1):
    sn = str(i)
    if len(sn) % 2 == 1:
        c += 1

print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n = I()
l = len(str(n))
ans = 0
if l % 2 == 1:
    ans += n - 10**(l-1) + 1

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

x = len(str(n))

ans = 0

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    ans = 0
    while True:
        if n == 0:
            break
        if len(str(n)) % 2 == 1:
            ans += 1
        n -= 1
    print(ans)


solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B - Uneven Numbers

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

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

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

print(x)

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:
a=int(input())
if a<=9:
    ans=a
elif a<=99:
    ans=9
elif a<=999:
    ans=9+(a-99)
elif a<=9999:
    ans=909
elif a<=99999:
    ans=909+(a-9999)
else:
    ans=90909
print(ans)

Submission status: Accepted

Solution code:
N = input()
nlen = len(N)
n = int(N)
j = nlen
ans = 0
while j > 0:
    if j % 2 == 0:
        j -= 1
        continue
    else:
        if j == nlen:
            ans += n - 10**(j-1) + 1
        else:
            ans += 10**j - 10**(j-1)
        j -= 1
print(ans)

Submission status: Accepted

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
N = int(input())
count =0
digit =0
for i in range(1,N+1):
    digit =len(str(i))
    if digit %2 ==1:
        count +=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
i = 0
ans = 0
while 10**(i+1) <= n:
  if i%2 == 0:
    ans += 10**i * 9
  i += 1

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

Submission status: Accepted

Solution code:
import sys
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]

N = ri()
m = len(str(N))
ans = 0
for i in range(0, 10, 2):
    if i == m - 1:
        ans += N - (10 ** i) + 1
        break
    elif i >= m:
        break
    else:
        ans += 9 * (10 ** i)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=[]
for i in range(1,n+1):
    l.append(i)
#print(l)
count=[]
keta=1
#print(keta)
for i in range(n):
    if l[i]//10==0:
        count.append(keta)
    elif 1<=l[i]//10<=9:
        keta+=1
        count.append(keta)
        keta=1
    elif 10<=l[i]//10<=99:
        keta+=2
        count.append(keta)
        keta=1
    elif 100<=l[i]//10<=999:
        keta+=3
        count.append(keta)
        keta=1
    elif 1000<=l[i]//10<=9999:
        keta+=4
        count.append(keta)
        keta=1
    elif 10000<=l[i]//10<=99999:
        keta+=5
        count.append(keta)
        keta=1
#print(count)
c=0
for i in count:
    if i==1 or i==3 or i==5:
        c+=1
print(c)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    sum=0
    for i in range(1,n+1):
        if 1<=i<10 or 100<=i<1000 or 10000<=i<100000:
            sum+=1
    print(sum)
resolve()

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(n):
  if len(str(i+1)) % 2 == 1:
    ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
m = int(input())
n = len(str(m))
if n == 1:
  print(m)
elif n == 2:
  print(9)
elif n == 3:
  ans = 9 + m - 99
  print(ans)
elif n == 4:
  ans = 999 - 99 + 9
  print(ans)
elif n == 5:
  ans = m - 9999 + 999 - 99 + 9
  print(ans)
elif n == 6:
  print(90909)

Submission status: Accepted

Solution code:



def solve(N):
    counter = 0
    for n in range(1,N+1):
        if(len(str(n)) % 2 == 1):
            counter+=1
    return counter
def main():
    N = int(input())
    # solve()
    print(solve(N))

if __name__ == "__main__":
    main()

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

Submission status: Accepted

Solution code:
n = int(input())


def countKeta(num):
    count = 1
    while num / 10 >= 1:
        count += 1
        num = num // 10
    return count


count = 0

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

Submission status: Accepted

Solution code:
n=int(input())
a=len(str(n))
if a<2:
    print(n)
elif a<3:
    print(9)
elif a<4:
    print(n-90)
elif a<5:
    print(909)
elif a<6:
    print(n-9090)
else:
    print(90909)

Submission status: Accepted

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

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

if digit % 2 == 1:
    ans += num - 10 ** (digit - 1) +1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

cnt, dig = 0, 1
for i in range(1, n+1):
    if pow(10, dig-1) <= i < pow(10, dig):
        pass
    else:
        dig += 1
    if dig % 2:
        cnt += 1
print(cnt)

Submission status: Accepted

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

for i in range(len(str(N))-1):
  if (i+1) % 2 == 1:
    cnt += 9*10**(i)

if len(str(N)) % 2 == 1:
  cnt += N - 10**(len(str(N))-1) + 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n=list(range(1,int(input())+1))

tf=[int(i) for i in n if (len(str(n[i-1])))%2==1]
print(len(tf))

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

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

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

    print(cnt)


main()

Submission status: Accepted

Solution code:
N = int(input())

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
if(n<10):
  x=n
elif(n<100):
  x=9
elif(n<1000):
  x=n-90
elif(n<10000):
  x=9+900
elif(n<100000):
  x=n-90-9000
elif(n==100000):
  x=90909
print(x)