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())
ans = 0
for i in range(1, 6):
  if 10**i <= n and i%2==1:
    ans += 10**i - 10**(i-1)

  elif 10**i > n and i%2==0:
    break
  elif 10**i > n and i%2==1:
    ans += n - 10**(i-1) + 1
    break

print(ans)

Submission status: Accepted

Solution code:
strN = input()
keta, N = len(strN), int(strN)
if keta > 1:
  amari = N - (10**(keta-1))
  count = 0
  for i in range(1, keta):
    if i%2!=0:
      if i==1:
        count += 9
      else:
        count += (10**i) - (10**(i-1))  
  if keta%2!=0:
    count += amari+1
  print(count)
else:
  print(N)

Submission status: Accepted

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

N = int(input())

check = 0
for i in range(1, N+1):
    i_str = str(i)
    if len(i_str)%2 == 1:    #桁数が奇数だったら
        check += 1

print(check)

Submission status: Accepted

Solution code:
a = input()
sum = 0
if len(a) % 2 == 0:
    for i in range(1, len(a), 2):
        sum += (10 ** (i - 1)) * 9

else:
    for j in range(1, (len(a)-1), 2):
        sum += (10 ** (j - 1)) * 9
    b = 10 ** int(len(a) - 1)
    s = int(a) - b + 1
    sum += s
print(sum)

Submission status: Accepted

Solution code:
n=int(input())
s=len(str(n))
if n<10:
    print(n)
else:
    if s%2==0:
        s=s-1
        x=''
        for i in range(s-1):
            if i%2==0:
                x+='9'
            else:
                x+='0'
        x+='9'
        print(x)
    else:
        z=s-2
        x = ''
        for i in range(z - 1):
            if i % 2 == 0:
                x += '9'
            else:
                x += '0'
        x += '9'
        x=int(x)
        x+=n-int('9'*(z+1))
        print(x)

Submission status: Accepted

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

from sys import stdin
import math

# 標準入力をスペースで区切って、intに変換 listに収納
int_list  = [int(x) for x in stdin.readline().rstrip().split()]


N = int_list[0]

# 桁数が奇数　＝＞　1桁、3桁、5桁

def is_degits_odd(number):
    digits = len(str(number))
    if digits % 2 == 1:
        return 1
    else:
        return 0
cnt = 0
for i in range(N):
    number = N - i 
    if is_degits_odd(number):
        cnt+=1

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

if n < 10:
	result = n
elif n < 10**2:
	result = 9
elif n < 10**3:
	result = n -90
elif n < 10**4:
	result = 909
elif n < 10**5:
	result = n -9090
else:
	result = 90909

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
 
count=0
 
if n == 100000:
  count+=90909

if 10000 <= n and n < 100000:
  m=n-9999
  count+=m
  count+=909

if 1000 <= n and n < 10000:
  count+=909

if 100 <=n and n < 1000:
  l=n-99
  count+=l
  count+=9

if 10 <= n and n < 100:
  count +=9

if n < 10:
  count+=n

print(count)

Submission status: Accepted

Solution code:
i = input()

acc = 0
for j in range(len(i)//2):
  acc+=9*(10**(2*j))

if len(i)%2==0:
  print(acc)
else:

  addition = (int(i[0])-1)*10**(len(i)-1)+1
  if len(i)>1:
    addition += int(i[1:])
  print(acc+addition)

Submission status: Accepted

Solution code:
N = int(input())
d = len(str(N))
if d == 1:
    print(N)
elif d == 2:
    print(9)
elif d == 3:
    print(N-100+1+9)
elif d == 4:
    print(900+9)
elif d == 5:
    print(N-10000+1+900+9)
elif d == 6:
    print(9+900+90000)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
import numpy as np
v = np.array([0, 10**1 - 1, 0, 10**3 - 10**2, 0, 10**5 - 10**4])
n = np.log10(N)
i = int(np.floor(n))
cnt = np.sum(v[:i+1]) 
if i in [0, 2, 4]:
    cnt += (N - 10 ** i + 1)
print(cnt)

Submission status: Accepted

Solution code:
N=int(input())
X=0
if N<=9:
  X=N
elif N<=99:
  X=9
elif N<=999:
  X=9+(N-100+1)
elif N<=9999:
  X=9+900
elif N<=99999:
  X=909+(N-10000+1)
elif N<=100000:
  X=90909
print(X)

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:
num = input()

count = 0

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

print(count)

Submission status: Accepted

Solution code:
n =int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B問題
N = int(input())
S = str(N)
s = len(S)
ans = 0
for i in range(s//2):
    I = 2*i
    ans+=(10**(I))*9
if s%2 == 1:
    ans+=N-10**(s-1)+1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
NN=str(N)
n=len(NN)
data=[9,900,90000]
result=0
if(n==1):
	result=N
if (n==2):
	result=data[0]
if (n==3):
	result=data[0]+N-99
if(n==4):
	result=data[0]+data[1]
if(n==5):
	result=data[0]+data[1]+N-9999
if(n==6):
	result=data[0]+data[1]+data[2]

print(result)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

def main(n):  
    if n >= 10000:
        ans = n-10000+1 + 900 + 9
        if n == 100000:
            ans -= 1
        return ans

    if n>=1000:
        ans = 909
        return ans

    if n >= 100:
        ans = n - 100 + 1 + 9
        return ans

    if n >= 10:
        ans = 9
        return ans

    if n>= 1:
        ans = n
        return ans

print(main(n))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = input()
    n_keta = len(n)
    dp = [0 for _ in range(n_keta)]
    for i in range(n_keta):
        i_result = 10 ** (i + 1) - 1
        for j in range(i):
            i_result -= dp[j]
        dp[i] = i_result

    result = 0
    for i in range(0, n_keta, 2):
        result += dp[i]

    if n_keta % 2 != 0:
        result -= 10 ** n_keta - 1 - int(n)

    print(result)

Submission status: Accepted

Solution code:
n = input()
m = tuple(n)
n = int(n)
ans = 0
keta = len(m)
if keta%2 == 1:
    for i in range(keta-1):
        if (i+1)%2 == 0:
            ans += (10**(keta-(i+1)))*9
    print(n-ans)
else:
    for i in range(keta):
        if (i+1)%2 == 0:
            ans += (10**(keta-(i+1)))*9
    print(ans)

Submission status: Accepted

Solution code:

n = int(input())

ans = 0
if(n >= 100):
    ans += 9
    if(n >= 10000):
        ans += 900
        if(n >= 100000):
            ans += 90000
        else:
            ans += n-9999
    else:
        ans += min(n-99, 900)
else:
    ans += min(n,9)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

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

for x in range(digit):
    x += 1
    if x % 2 != 0:
        if x < digit:
            cnt += (10**x) - (10**(x-1))
        else:
            cnt += N - (10**(x-1)) + 1

print('{}'.format(cnt))

Submission status: Accepted

Solution code:

if __name__ == "__main__":
    N = int(input())
    cnt = 0
    if N == 100000:
        cnt = 90000 + 900 + 9
    elif N >= 10000 and N < 100000:
        cnt = (N - 10000)+ 910
    elif N >= 1000 and N < 10000:
        cnt = 909
    elif N >= 100 and N < 1000:
        cnt = (N - 100)+ 10 
    elif N >=10 and N < 100:
        cnt = 9
    elif N < 10:
        cnt = N
    print(cnt)

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(N-90)
elif l==4:
  print(909)
elif l==5:
  print(N-9090)
elif l==6:
  print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
def acinput():
    return list(map(int,input().split(" ")))


N=int(input())

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

print(count)

Submission status: Accepted

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

l = len(Nstr)

_sum = 0

# if odd
if l % 2 == 1:
    _sum += (N - (10**(l-1)-1))
else:
    pass

for keta in range(1,l,2):
    if keta % 2 == 0:
        continue
    _sum += (10**(keta) -1) - (10**(keta-1) -1)

print(_sum)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys, math, bisect, random, itertools
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c = LI()
    print(min(b+c,a))
    return

#B
def B():
    n = II()
    ans = 0
    for i in range(1, n + 1):
        if len(str(i)) % 2:
            ans += 1
    print(ans)
    return

#C
def C():
    n = II()
    h = LI()
    h = h[::-1]
    for i in range(1, n):
        if h[i] <= h[i-1]:
            continue
        if h[i] == h[i - 1] + 1:
            h[i] -= 1
            continue
        print("No")
        return
    print("Yes")
    return

#D
def D():
    s = S()
    lens = len(s)
    ans = [0] * len(s)
    i = 0
    while i != len(s):
        for j in range(i, lens):
            if s[j] == "R":
                continue
            break
        R = j - i
        for i in range(j, lens):
            if s[i] == "L":
                continue
            break
        else:
            i += 1
        L = i - j
        ans[j] = R // 2 + (L+1) // 2
        ans[j - 1] = L // 2 + (R+1) // 2

    print(*ans)
    return

#E
def E():
    return

#F
def F():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

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

if N < 10:
	print(N)

elif N < 100:
	print(9)

elif N < 1000:
	print(N -90)

elif N < 10000:
	print(999-90)

elif N < 100000:
	print(N - 9090)

else:
	print(99999 - 9090)

Submission status: Accepted

Solution code:
N_str = input()

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

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

print(ans)

Submission status: Accepted

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

for i in range(N):
    if (i + 1 >= 10 and i + 1 <= 99) or (i + 1 >= 1000 and i + 1 <= 9999) or i + 1 == 100000:
        pass
    else:
        answer += 1

print(answer)

Submission status: Accepted

Solution code:
N = int(input())
nm = len(str(N))-1
summ = 0
for i in range(nm):
    if i ==0:
      summ += 9
    elif i%2 ==0:
      summ += (10**(i+1)-10**(i))
if nm%2 == 0:
    summ += N-(10**nm)+1
print(summ)

Submission status: Accepted

Solution code:
M = input()
m = int(M)
N = list(M)
if len(N) == 1:
  print(m)
elif len(N) == 2:
  print(9)
elif len(N) == 3:
  print(9+(m-100)+1)
elif len(N) == 4:
  print(909)
elif len(N) == 5:
  print(909+(m-10000)+1)
elif len(N) == 6:
  print(90909)
elif m == 100000:
  print(90910)

Submission status: Accepted

Solution code:
n = input()

keta_num = len(n)
keta1 = 9
keta2 = 900
keta3 = 90000


if keta_num == 6:
    print(keta1+keta2+keta3)
elif keta_num == 5:
    print(int(n) - 10000+1+keta1+keta2)
elif keta_num == 4:
    print(keta1+keta2)
elif keta_num == 3:
    print(int(n)-100+1+keta1)
elif keta_num == 2:
    print(keta1)
elif keta_num == 1:
    print(int(n)-1+1)

Submission status: Accepted

Solution code:
N = int(input())
if N >= 0 and N < 10:
    print(N)
elif  N >= 10 and N < 100:
    print("9")
elif  N >= 100 and N <= 999:
    print(N-90)
elif  N >= 1000 and N <= 9999:
    print("909")
elif  N >= 10000 and N <= 99999:
    print(909+(N-9999))
elif N >= 100000:
    print("90909")

Submission status: Accepted

Solution code:
a = int(input())

count = 0

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

print(count)

Submission status: Accepted

Solution code:
n = int(input())
 
i = [10, 100, 1000, 10000,100000]
digit = 0
p = [0, 9, 9, 909, 909, 90909]
for j in i:
  if j > n:
    break
  else:
    digit += 1
 
if digit%2 == 1:
  print(p[digit])
elif digit == 0:
  print(n)
else:
  
  print(p[digit]+n-i[digit-1]+1)

Submission status: Accepted

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

while n > 0:
    if len(str(n)) % 2 == 0:
        n -= 1
        continue

    count += 1
    n -= 1

print(count)

Submission status: Accepted

Solution code:
N = int(input())

cont = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
order = len(str(N))

if order == 2:
  print(9)
  
elif order == 4:
  print(909)
  
elif order == 6:
  print(90909)
  
elif order == 1:
  a = int(N)
  print(a)

elif order == 3:
  b = int(N) - 90
  print(b)

elif order == 5:
  c = 909 + int(N) - 10000 + 1
  print(c)

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    ans = 0
    for i in range(1, N+1):
        if 1 <= i < 10 or 100 <= i < 1000 or 10000 <= i < 100000:
            ans += 1

    return ans


if __name__ == '__main__':
    print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)

if N == 1:
	print(S)
elif N == 2:
	print(9)
elif N == 3:
	A=int(S[0])
	B=int(S[1])
	C=int(S[2])
	print(((A-1)*100)+(B*10)+C+10)
elif N == 4:
	print(909)
elif N == 5:
	A=int(S[0])
	B=int(S[1])
	C=int(S[2])
	D=int(S[3])
	E=int(S[4])
	print(((A-1)*10000)+(B*1000)+(C*100)+(D*10)+E+910)
else:
	print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

# l = list(map(int,input().split()))
n = int(input())
digit = len(str(n))

if digit % 2 == 0:
        start_d = digit-1
        check = False
else:
        start_d = digit -2
        check = True
cn = 0
for d in range(start_d, 0, -2):
        mx = 10 ** d - 1
        mn = 10 ** (d-1) 
        cn += (mx - mn + 1)
        # print('for',cn)
if check:
        cn += n - 10**(digit-1) +1
# print('res',cn)
print(cn)

Submission status: Accepted

Solution code:
import sys
n = sys.stdin.readline().rstrip()
n_int = int(n)
if len(n)==1:
    print(n)
elif len(n)==2:
    print(9)
elif len(n)==3:
    print(n_int - 99 + 9)
elif len(n)==4:
    print(909)
elif len(n)==5:
    print(n_int - 9999 + 909)
else:
    print(90909)

Submission status: Accepted

Solution code:
N = input()
a = len(N)
#1桁は9個、3桁は100~999の900個、5桁は10000 ~ 99999 の　　９００００
if a%2==0:
    b = 0
    for i in range(int(a/2)):
        b += 9*(10**(2*i)) 
else:
    c = 0
    for i in range(int((a-1)/2)):
        c += 9*(10**(2*i))
    d = int(N) - 10**(a-1) +1
    b = c+d
print(b)

Submission status: Accepted

Solution code:
a = int(input())
i = 1
cnt = 0
while i <= a:
  if len(str(i))%2 == 1:
    cnt += 1
  i += 1
 
print("{}".format(cnt))

Submission status: Accepted

Solution code:
n = int(input())
i=1
count = 0
while i <= n:
    a = list(map(int,list(str(i))))
    i=i+1
    if len(a)%2==1:
      count+=1
print(str(count))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
for i in range(1, keta + 1):
    if i != keta:
        if i % 2 != 0:
            cnt += (10 ** i) - (10 ** (i - 1))
    else:
        if i % 2 != 0:
            cnt += int(N) - (10 ** (i - 1) - 1)

print(cnt)

Submission status: Accepted

Solution code:
a = int(input())

if a <= 9:
  print(a)
elif a <= 99:
  print(9)
elif a <= 999:
  print(9 + (a - 99))
elif a <= 9999:
  print(9 + 900)
elif a <= 99999:
  print(9 + 900 + (a - 9999))
else:
  print(9 + 900 + 90000)

Submission status: Accepted

Solution code:
N = int(input())

resp = 0
if N < 10:
    resp = N
elif 10 <= N < 100:
    resp = 9
elif 100 <= N < 1000:
    a = 9
    b = N - 99
    resp = a + b
elif 1000 <= N < 10000:
    resp = 9 + (999 - 99)
elif 10000 <= N < 100000:
    a = 9
    b = 999 - 99
    c = N - 9999
    resp = a + b + c
elif 100000 <= N:
    resp = 90909

print(resp)

Submission status: Accepted

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

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

    count = 0
    for i in range(1, len(str(N))+1):
        if i % 2 == 1:
            if i == len(str(N)) and N != 10**i :
                count += N - 10**(i-1) + 1
            else:
                count += 10**i - 10**(i-1)
        # print(i, count)
    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
keta = len(str(N))
cnt = 0
for i in range(keta):
  if i%2 == 1:
    cnt += 9*10**(i-1)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
if n < 10:
  ans = n
elif n < 10**2:
  ans = 9 
elif n < 10**3:
  ans = n - 90
elif n < 10**4:
  ans = 909
elif n < 10**5:
  ans = n - 9090
else:
  ans = 90909
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:
n = input()

if len(n) == 1:
  print(n)
elif len(n) == 2:
  print(9)
elif len(n) == 3:
  print(int(n) - 99 + 9)
elif len(n) == 4:
  print(909)
elif len(n) == 5:
  print(int(n) - 9999 + 909)
elif len(n) == 6:
  print(90909)

Submission status: Accepted

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

l=len(str(n))
for i in range(0,l-1):
    if i%2==0:
        s=s+(10**(i+1)-10**(i))
    else:
        continue
if l%2==1:
    m=n-10**(l-1)+1
    print(m+s)
else:
    print(s)

Submission status: Accepted

Solution code:
N = int(input())
 
i=1
x = 0
 
while True:
  m = 10 ** i - 1
  if N <= m:
    x += max((N - (10 ** (i-1) - 1)), 0)
    break
  x += (m - (10 ** (i-1) - 1))
  i += 2
print(x)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
keta = 1
if(n // 10 == 0):
    ans = n
else:
    ans += 9
    for i in range(2, 5, 2):
        now = n // (10 ** i)
        if now < 10 and now > 0:
            ans += (now - 1) * 10 ** i + n % 10 ** i + 1
        if now >= 10:
            ans += 10 ** i * 9
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

j = 1
Ans = 0
Q = 1
n = N

while n > 0:
    if n >= 10:
        if j == 1:
            Ans += 9 * Q
    else:
        if j == 1:
            Ans += N - Q + 1
    n = n // 10
    j = j * (-1)
    Q = Q * 10

print(Ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
t = n
c = 0
while t > 0:
    t //= 10
    c += 1
ans = 0
for i in range(1, c+1, 2):
    if i == c:
        ans += n - 10 ** (i-1) + 1
    else:
        ans += (10**i - 10**(i-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())

r=len(list(filter(lambda x: len(str(x))%2 != 0, range(1,n+1))))

print(r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
values = input().split(' ')
value = int(values[0])
#print(value)
sum = 0
for x in reversed(range(1, value+1)):
  if( len(list(str(x))) % 2 == 0): ## even digit
    continue
    print("hoge")
  sum = sum + 1
#  print(x)
#  print(len(list(str(x))) % 2 )
print(sum)

Submission status: Accepted

Solution code:
num = input()
ans = [9,0,900,0,90000]
tmp = 0

if len(num)%2==0:
  tmp = sum(ans[:len(num)])
elif len(num)==1:
  tmp = num
else:
  tmp += sum(ans[:len(num)-2])
  tmp += int(num)-10**(len(num)-1)+1

print(tmp)

Submission status: Accepted

Solution code:
# an = list(map(int, input().split()))
# n, m = map(int, input().split())
n = int(input())

cnt = 0
a = 1
while True:
  if n < a:
    break
  elif n < a * 10:
    cnt += n - a + 1
    break
  else:
    cnt += 9 * a
    a *= 100
print(cnt)

Submission status: Accepted

Solution code:
def hasOddDigits(num):
    s = str(num)
    return len(s) % 2 == 1


N = int(input())

counter = 0
for i in range(1, N+1):
    if hasOddDigits(i):
        counter += 1


print(counter)

Submission status: Accepted

Solution code:
n = int(input())
kotae = 0
if n == 100000:
  kotae = 90909
elif n >= 10000:
  kotae = 909 + (n - 10000 + 1)
elif n >= 1000:
  kotae = 909
elif n >= 100:
  kotae = 9 + (n- 100 +1)
elif n >= 10:
  kotae = 9
else:
  kotae = n
print(kotae)

Submission status: Accepted

Solution code:
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

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

mod = 1000000007

if __name__ == "__main__":
    n = int(input())
    k = len(str(n))
    c=0
    for i in range(k-1):
        if i % 2 ==0:
            c+=9*(10**i)
    if k % 2 !=0:
        c+=n-10**(k-1)+1
    print(c)

Submission status: Accepted

Solution code:
N = str(input())

# 桁数が奇数の値の個数
length = len(N)

# MAX6桁1000000
if length == 6:
    # 5桁、3桁、1桁全て
    # 10000-99999
    # 100-999
    # 1-9
    print(90000 + 900 + 9)
elif length == 5:
    # 3桁、1桁全てと4桁
    print(900 + 9 + (int(N) - 10000 + 1))
elif length == 4:
    # 3桁と1桁
    print(900 + 9)
elif length == 3:
    # 1桁と3桁
    print((9 + (int(N)) - 100 + 1))
elif length == 2:
    print(9)
else:
    print(N)

Submission status: Accepted

Solution code:
from math import log10, floor
n = int(input())
l = log10(n)
if floor(l)%2 :
    s = 0
    for i in range(floor(l)) :
        if (i+1)%2 :
            s += 9*10**i
else :
    s = 0
    for i in range(floor(l)) :
        if (i+1)%2 :
            s += 9*10**i
    s += n-10**floor(l)+1
print(s)

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

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


print(ans)

Submission status: Accepted

Solution code:
N = int(input())
for i in range(N):
    if 10 **i <= N < 10 ** (i+1):
        keta_10 = i+1
        break
total = 0
if keta_10 % 2 == 0 :
    for k in range(1, keta_10 + 1):
        if k % 2 == 1:
            total = total + 9 * (10**(k-1))
else:
    for k in range(1, keta_10 + 1 - 2):
        if k % 2 ==1:
            total = total + 9 * (10**(k-1))
    total = total + N - 10 ** i + 1

print(total)

Submission status: Accepted

Solution code:
n = int(input())

if n < 10:
  ans = n
elif 10 <= n < 100:
  ans = 9
elif 100 <= n < 1000:
  ans = n - 99 + 9
elif 1000 <= n < 10000:
  ans = 9 + 900
elif 10000 <= n < 100000:
  ans = n - 9999 + 909
else:
  ans = 99999 - 9999 + 909
  
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if 1 <= n <= 9:
    print(n)
elif 10 <= n <= 99:
    print(9)
elif 100 <= n <= 999:
    print(9 + (n - 99))
elif 1000 <= n <= 9999:
    print(909)
elif 10000 <= n <= 99999:
    print(909 + (n - 9999))
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(N):
  r = N - i
  digit = len(str(r))
  if digit % 2 == 1:
    count += 1
print(count)

Submission status: Accepted

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

ans = 0
if N < 10:
    ans = N
elif N < 100:
    ans = 9
elif N < 1000:
    ans += 9
    ans += max(0, N - 99)
elif N < 10000:
    ans += 9 + 900
elif N < 100000:
    ans += 9 + 900
    ans += max(0, N - 9999)
else:
    ans += 9 + 900 + 90000

print(ans)

Submission status: Accepted

Solution code:
a=int(input())

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

print(s)

Submission status: Accepted

Solution code:
N = int(input())

result = 0

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

Submission status: Accepted

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

sum = 0
if keta%2==0: #桁が偶数
  kaisuu = keta//2
  for i in range(kaisuu):
    sum = sum + 9 * (10 ** (i*2))
else: # 桁が奇数
  if keta == 1:
    sum = N
  else:
    kaisuu = (keta-1)//2
    for i in range(kaisuu):
      sum = sum + 9 * (10 ** (i*2))
    sum = sum + (N - ((10 ** (keta-1)) - 1))

print(sum)

Submission status: Accepted

Solution code:
n = int(input())
if 1 <= 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:
import sys
n=int(input())

oddn=0
if n<10:
  oddn+=n
  print(oddn)
  sys.exit()
else:
  oddn+=9
if n<100:
  print(oddn)
  sys.exit()
  
if n<1000:
  oddn+= n-99
  print(oddn)
  sys.exit()
else:
  oddn+=900

if n>=10000:
  oddn+=n-9999
if n==100000:
  oddn-=1

print(oddn)