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())
s = [9,900,90000]
l = len(str(N))
if l ==6:
    print(sum(s))
elif l == 5:
    print(sum(s[:2])+N-9999)
elif l == 4:
    print(sum(s[:2]))
elif l == 3:
    print(sum(s[:1])+N-99)
elif l == 2:
    print(s[0])
else:
    print(N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

cnt = 0

for i in range(1,n+1):
  if i < 10:
    cnt += 1
    continue
  if i >= 100 and not (i >= 1000):
    cnt += 1
    continue
  if i >= 10000 and i != 100000:
    cnt += 1
    continue

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
tmp = len(N)
ans = 0

for i in range(1, int(N) + 1):
    if i < 10:
        ans += 1
    elif 100 <= i and i <= 999:
        ans += 1
    elif 10000 <= i and i <= 99999:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if N<10:
    print(N)
elif N >= 10 and N < 100:
    print(9)
elif N >= 100 and N < 1000:
    print(N-90)
elif N >= 1000 and N < 10000:
    print(909)
elif N >= 10000 and N < 100000:
    print(N - 9090)
else:
    print(90909)

Submission status: Accepted

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

while digit>0:
    digit-=2
    ans += 9*10**digit
print(ans)

Submission status: Accepted

Solution code:
n = input()
l = len(n)
d = [9, 0, 900, 0, 90000, 0, 9000000]
if l % 2 == 0:
    print(sum(d[:l]))
else:
    print(sum(d[:l - 1]) + int(n) - (10 ** (l - 1) - 1))

Submission status: Accepted

Solution code:
N = int(input())

ans = 1
if 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 100000 <= N and N < 1000000:
    ans = 90909
elif 1000000 <= N:
    ans = 90909 + (N-999999)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

c = 0

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

Submission status: Accepted

Solution code:
N = int(input())

if len(str(N)) == 1:
    print(N)
if len(str(N)) == 2:
    print(9)
if len(str(N)) == 3:
    print(N-100+1+9)
if len(str(N)) == 4:
    print(909)
if len(str(N)) == 5:
    print(N-10000+1+909)
if len(str(N)) == 6:
    print(90909)

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = 0
if N < 10:
    print(N)
elif N < 100:
    print(9)
elif N < 1000:
    print(N-90)
elif N < 10000:
    print(909)
elif N < 100000:
    print(N-9090)
elif N < 1000000:
    print(90909)

Submission status: Accepted

Solution code:
N=input()
A={1:9, 3:900, 5:90000}
l=len(str(N))

ans=0

for i in range(1,l,2):
	ans+=A[i]

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

print ans

Submission status: Accepted

Solution code:
import sys, math
from collections import deque

readline = sys.stdin.readline

A = int(readline())

n = math.floor(math.log10(A)) + 1

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

if n % 2 == 1:
    count += A - 10 ** (n - 1) + 1

print(count)

Submission status: Accepted

Solution code:
n = int(input()) 

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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


if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
N = int(input())

if N <=9:
    print(N)
elif 10<=N<=99:
    print(9)
elif 100<=N <=999:
    print(9+N-99)
elif 1000<=N<=9999:
    print(9+900)
elif 10000<=N<=99999:
    print(9+900+N-9999)
else:
    print(90909)

Submission status: Accepted

Solution code:
n = int(input())

if n == 10**5:
    print(90909)
elif n >= 10**4:
    print(909 + (n - 9999))
elif n >= 10**3:
    print(909)
elif n >= 10**2:
    print(9 + (n - 99))
elif n >= 10:
    print(9)
else:
    print(n)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for d in range(1, len(str(n))+1, 2):
    ans += min(10**d-1, n) - 10**(d-1) + 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()

k=len(n)//2
l=len(n)%2

ans=0
for i in range(0,2*k,2):
    ans+=9*10**i
if l!=0:
    ans+=int(n)-10**(len(n)-1)+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
if N<10:
    ans = N
elif 10<=N and N<100:
    ans = 9
elif 100<=N and N<1000:
    ans = 9+(N-100)+1
elif 1000<=N and N<10000:
    ans = 9+900
elif 10000<=N<100000:
    ans = 9+900+(N-10000)+1
else:
    ans = 90909
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if N<100:
    print(min(N,9))
elif N<10000:
    print(9+min(900,N-99))
elif N<=100000:
    print(909+min(90000,N-9999))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if 0<N<10:
  num = N
 
if 10<=N<100:
  num = 9
 
if 100<=N<1000:
  num = 9 + N - 99
  
if 1000<=N<10000:
  num = 9 + 900
 
if 10000<=N<100000:
  num = 909 + N - 9999
 
if N==100000:
  num=909+90000
  
print(num)

Submission status: Accepted

Solution code:
n = input()
l = len(n)
length_list = [9, 0, 900, 0, 90000, 0]
ans = sum(length_list[:l-1])
if l % 2 == 1:
    ans += int(n) + 1 - 10**(l-1)
print(ans)

Submission status: Accepted

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

keta = int(math.log10(N) + 1)
res = 0
while True:
    if keta % 2 == 0:
       N = N - (N % 10 ** (keta-1)) - 1
    else:
       res += N - 10 ** (keta - 1) + 1
       N = 10 ** (keta - 1) - 1
    if N <= 0:
        break
    keta = int(math.log10(N) + 1)
print(res)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
A = int(input())
if 1 <= A <= 9:
  print(A)
elif 10 <= A <= 99:
  print(9)
elif 100 <= A <= 999:
  print(A-90)
elif 1000 <= A <= 9999:
  print(909)
elif 10000 <= A <= 99999:
  print(A-9090)
else:
  print(90909)

Submission status: Accepted

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

if N >= 9:
  sum += 9
else:
  sum += N % 10

if N >= 999:
  sum += 999-99
elif N >= 100:
  sum += (N-99)%1000

if N >= 99999:
  sum += 99999-9999
elif N >= 10000:
  sum += (N-9999)%100000
  
print("{}".format(sum))

Submission status: Accepted

Solution code:
N = int(input())

if N<10:
    print(N)
elif N<100:
    print(9)
elif N<999:
    print(N-99+9)
elif N<9999:
    print(900+9)
elif N<99999:
    print(N-9999+900+9)
else:
    print(99999-9999+900+9)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

if N <= 9:
    ans = N
elif 10 <= N and N <= 99:
    ans = 9
elif 100 <= N and N <= 999:
    ans = 9 + ( N - 100 + 1 )
elif 1000 <= N and N <= 9999:
    ans = 9 + 900
elif 10000 <= N and N <= 99999:
    ans = 9 + 900 + (N - 10000 + 1)
elif N == 100000:
    ans = 9 + 900 + 90000
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
a = []
b = []
for i in range(1,N+1,1):
    a.append(i)
for i in range(len(a)):
    if(len(str(a[i]))%2 != 0):
        b.append(a[i])

print(len(b))

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

Submission status: Accepted

Solution code:
n = int(input())
m = n
cnt = 0
while(m != 0):
    cnt += 1
    m = m // 10
ans = 0
if(n < 10):
    print(n)
elif(n < 100):
    print(9)
else:
    if(cnt % 2 == 0):
        k = 0
        while(k<cnt):
            ans += 9*10**k
            k += 2
    else:
        k = 1
        while(k<cnt):
            ans += 9*10**(k-1)
            k += 2
        d = n - 10**(k-1) + 1
        ans += d
    print(ans)

Submission status: Accepted

Solution code:
import sys

def resolve():
    N = int(input())
    ans = 0
    if N >= 100000:
        ans = 90909
    elif N >= 10000:
        ans = 909 + N - 10000 + 1
    elif N >= 1000:
        ans = 909
    elif N >= 100:
        ans = 9 + N - 100 + 1
    elif N >= 10:
        ans = 9
    else:
        ans = N
    print(ans)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

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

else:
    for i in range(int((len(s)-1)/2)):
        ans += 9 * (10 ** (2 * i))

    p = n - 10 ** (len(s)-1) + 1
    ans += p

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)
elif n == 100000:
	print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
res = 0
if n < 10:
    res = n
elif 10 <= n < 100:
    res = 9
elif 100 <= n < 1000:
    res = 9 + (n - 99)
elif 1000 <= n < 10000:
    res = 9 + 900
elif 10000 <= n < 100000:
    res = 9 + 900 + (n - 9999)
elif n == 100000:
    res = 9 + 900 + 90000
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1, 6, 2):
    if 10**i <= n:
        c += 9*10**(i-1)
    else:
        c += max(0, n-10**(i-1)+1)

print(c)

Submission status: Accepted

Solution code:
import sys

def solve(n):
  count = 0
  for i in xrange(n):
    i += 1
    if 10 <= i < 100:
      continue
    if 1000 <= i < 10000:
      continue
    if 100000 <= i:
      continue

    count += 1

  return count

if __name__ == '__main__':

  n = int(sys.stdin.readline().strip())
  print solve(n)

Submission status: Accepted

Solution code:
a = int(input())

def countDigits(x):
    return len(str(abs(x)))

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

print(count)

Submission status: Accepted

Solution code:
n = int(input())
if n < 10:
    print(n)
elif n < 100:
    print(9)
elif n < 1000:
    print(9+(n-99))
elif n < 10000:
    print(909)
elif n < 100000:
    print(909+(n-9999))
elif n == 100000:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
a = int(input())
ans = 0
for i in range(1, a+1):
    if i < 10 or 100 <= i < 1000 or 10000 <= i < 100000:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

while i!=n+1:
    if (1<=i and 9>=i):

        ans+=1
    if (100<=i and 999>=i):

        ans+=1
    if (10000<=i and 99999>=i):
        ans+=1

    i+=1


print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N <= 9:
    print(N)
elif 10 <= N and N <= 99:
    print(9)
elif 100 <= N and N <= 999:
    print(9+N-100+1)
elif 1000 <= N and N <= 9999:
    print(9+900)
elif 10000 <= N and N <= 99999:
    print(9+900+N-10000+1)
else:
    print(9+900+90000)

Submission status: Accepted

Solution code:

n = int(input())

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

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
if N >= 100000:
    print(9+900+90000)
elif N >= 10000:
    print(9+900+(N-9999))
elif N >= 1000:
    print(9+900)
elif N >= 100:
    print(9+(N-99))
elif N >= 10:
    print(9)
else:
    print(N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if N%2 == 0:
    N = N-2
    while(N>=0):
        count = count + 9*(10**N)
        N = N-2
else:
    count = count + n-(10**(N-1))+1
    N = N-3
    while(N>=0):
        count = count + 9*(10**N)
        N = N-2 

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

count = 0

for i in range(N+1):
    if 0 < i and i < 10:
        count+=1
    elif 99<i and i<1000:
        count+=1
    elif 9999<i and i<100000:
        count+=1
    else:
        continue

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


def fun(N):
    c=0
    for i in range(1,N+1):
        if len(str(i)) % 2 != 0:
            c+=1
    return c

print(fun(N))

Submission status: Accepted

Solution code:
n = int(input())

t = 1
u = 10
res = 0
while t <= n:
    t += 1
    res += 1
    if t % u == 0:
        t *= 10
        u *= 100

print(res)

Submission status: Accepted

Solution code:
N = int(input())

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

print(s)

Submission status: Accepted

Solution code:
import math
n=int(input())
c=0
for i in range(1,n+1):
    if (int(math.log10(i)+1) % 2) == 1:
        c += 1
print(c)

Submission status: Accepted

Solution code:
s = input()
n = int(s)
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())
if n<10:
    print(n)
elif n<100:
    print(9)
elif n<1000:
    print(n-(99-9))
elif n<10000:
    print(999-(99-9))
elif n<100000:
    print(n-(9999-999)-(99-9))
elif n==100000:
    print(99999-(9999-999)-(99-9))

Submission status: Accepted

Solution code:
n=int(input())  #数値入力 「N」だけの入力のとき
#n=11
l=len(str(n))
if l ==1:
    print(n)
elif l==2:
    print(9)
elif l==3:
    print(9+n-99)
elif l==4:
    print(9+900)
elif l==5:
    print(9+900+n-9999)
elif l==6:
    print(9+900+90000)

Submission status: Accepted

Solution code:
import numpy as np

N = input()
N = int(N)
stN = str(N)
count = 0
if(len(stN)==6):
    count = 90909
elif(len(stN)==5):
    count = (N-10000+1)+909
elif(len(stN)==4):
    count = 909
elif(len(stN)==3):
    count = (N-100+1)+9
elif(len(stN)==2):
    count = 9
else:
    count = N
print(count)

Submission status: Accepted

Solution code:
def intget():
    return int(input())

#a, b, c = map(int, input().split())

n = intget()

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

def rtnm(n,st):
    ans = 0
    for i in range(st,st*10):
        if(i > n):
            break
        else:
            ans += 1
    return ans

ans = 0

ans += rtnm(n,10**4) + rtnm(n,10**2) + rtnm(n,10**0)
        
print(ans)

Submission status: Accepted

Solution code:
num_str = input().strip()
number = int(num_str)

if len(num_str) == 1:
    print(number)
elif len(num_str) == 2:
    print(9)
elif len(num_str) == 3:
    print(number - 100 + 1 + 9)
elif len(num_str) == 4:
    print(909)
elif len(num_str) == 5:
    print(number - 10000 + 1 + 900 + 9)
elif len(num_str) == 6:
    print(90909)
exit(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
keta = 0
count = 10**keta
for i in range(1, N+1):
  count = 0
  keta = 0
  while count <= i:
    keta +=1
    count = 10**keta
  keta -=1
  if keta %2==0:
    ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
a=0
c=0
while a<=N:
  if (1<=a and a<=9) or (100<=a and a<=999) or (10000<=a and a<=99999):
    c+=1
    a+=1
  else:
    a+=1
print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
if x < 10:
  print(x)
elif 10 <= x <100:
  print(9)
elif 100<=x <1000:
  print(9+x-100+1)
elif 1000 <= x < 10000:
  print(909)
elif 10000 <= x < 100000:
  print(909+x-10000+1)
else:
  print(90909)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=input()
lenN=len(N)
ans=0

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

Submission status: Accepted

Solution code:
n = int(input())

keta = len(str(n))
index = 1
count = 0
while index < keta:
    count += 9 * (10 ** (index-1))
    index += 2

if index <= keta:
    count += n - (10 ** (index-1)) + 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def NDigit():
    N = int(input())
    if N < 10: return N
    elif N < 100: return 9
    elif N < 1000: return (N - 90)
    elif N < 10000: return 909
    elif N < 100000: return (N - 9090)
    else : return 90909

# main
print(NDigit())

Submission status: Accepted

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

Submission status: Accepted

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

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

print(c)

Submission status: Accepted

Solution code:
import sys,heapq,math,resource
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def setrlim():
  sys.setrecursionlimit(250000)
  soft,hard = resource.getrlimit(RLIMIT_STACK)
  # setrlimit works on ubuntu (and atcoder), but not on WSL
  #resource.setrlimit(RLIMIT_STACK, (128*1024*1024,hard))

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

Submission status: Accepted

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

keta = len(n)

if keta%2 == 0:
    result = 0
    for i in range(keta-1):
        if i%2 == 1:
            pass
        else:
            result += 9*10**i
else:
    result = 0
    for i in range(keta - 2):
        if i % 2 == 1:
            pass
        else:
            result += 9 * 10 ** i
    result += int(n) - 10**(keta-1) + 1

print(result)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

cnt = 0

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

print(cnt)

Submission status: Accepted

Solution code:
import math

N = int(input())
n = int(math.log10(N))

if n % 2 == 1:
    m = n // 2
    print((100 ** (m + 1) - 1) // 11)
else:
    m = n // 2
    val = (100 ** m - 1) // 11
    print(val + N - 100 ** m + 1)

Submission status: Accepted

Solution code:
import decimal
decimal.getcontext().prec = 100
def sum1(pre,l,r):
    l=max(l,0)
    if(l==0):
        return pre[r]
    return pre[r] - pre[l - 1]

x=int(raw_input())
ans=0
if(x<=9):
    ans=x
elif(x>=10 and x<100):
    ans=9
elif(x>=100 and x<1000):
    ans=9+x-99
elif(x>=1000 and x<10000):
    ans=9+900
elif(x>=10000 and x<100000):
    ans=9+900+x-9999
elif(x>=100000):
    ans=9+900+90000
print ans        


# a,b,c=map(int,raw_input().split())
# if(b+c<=a):
#     print 0
#     exit()
# print c-(a-b)
# # t=1
# # while(t!=0):
# #     t=t-1

Submission status: Accepted

Solution code:
n=int(input())
if n<10:
  print(n)
elif n>=10 and n<100:
  print(9)
elif n>=100 and n<1000:
  print(9+n-99)
elif n>=1000 and n<10000:
  print(909)
elif n>=10000 and n<100000:
  print(909+n-9999)
else:
  print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    N = int(input())

    count = 0
    for i in range(1, N + 1):
        if 1 <= i and i <= 9:
            count += 1
        elif 100 <= i and i <= 999:
            count += 1
        elif 10000 <= i and i <= 99999:
            count += 1

    print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
num = int(n)
len = len(n)

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

Submission status: Accepted

Solution code:
n = int(input())

if 1 <= n <= 8:
    print(n)

elif 9 <= 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:
#!/usr/bin/env python3


def num(l, r, n):
    r = min(r, n)
    if r >= l:
        return r - l + 1
    else:
        return 0


def solv(n):
    return num(1, 9, n) + num(100, 999, n) + num(10000, 99999, n)


if __name__ == '__main__':

    N = int(input())

    ans = solv(N)

    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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:
# coding: utf-8
n = str(input())
int_n = int(n)
#print(len(n), int_n)

ans = 0
for i in range(1,len(n)+1):
    if i%2==1:
        if i==len(n):
            ans += int_n - 10**(i-1) + 1
        else:
            ans += 10**(i)-10**(i-1)
        #print(ans)
print(ans)

Submission status: Accepted

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

def main():
  n = int(input())
  c = 0
  
  for i in range(n):
    x = i
    x += 1
    if x < 10:
      c += 1
    elif x >= 100 and x < 1000:
      c += 1
    elif x >= 10000 and x < 100000:
      c += 1
      
  print(c)




if __name__ == '__main__':
  main()

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(sys.stdin.readline())

    if N < 10:
        print(N)
    elif 10 <= N <= 99:
        print(9)
    elif 99 < N <= 999:
        print(9 + (N - 99))
    elif 999 < N <= 9999:
        print(9 + 900)
    elif 9999 < N <= 99999:
        print(909 + (N - 9999))
    else:
        print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

if n < 10**1:
  print(n)
elif n < 10**2:
  print(9)
elif n < 10**3:
  print(9 + n - 10**2 + 1)
elif n < 10**4:
  print(909)
elif n < 10**5:
  print(909 + n - 10 **4 + 1)
else:
  print(90909)

Submission status: Accepted

Solution code:
a = int(input())
ans = 0
for i in range(a+1):
    if 0<i<10 or 99<i<1000 or 9999<i<100000:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
#https://atcoder.jp/contests/abc136/tasks/abc136_b

import math

n = int(input())
a = int(math.log10(n))
cnt = 0
for i in range(a):
    if (i + 1) % 2 == 1:
        cnt += 10 ** (i + 1) - 10 ** i

if (a + 1) % 2 == 1:
    cnt += n - 10 ** a + 1

print(cnt)

Submission status: Accepted

Solution code:
from math import log10, floor
n=int(input())

tmp=floor(log10(n))
ans=0
for i in range(tmp):
    if i%2==0:
        ans+=9*10**i
if tmp%2==0:
    ans+=n-10**tmp+1
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(N-90)
elif keta == 4:
  print(909)
elif keta == 5:
  print(N-90-9000)
elif keta == 6:
  print(90909)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for i in range(1, n+1):
    string = str(i)
    if i == 10**5:
        pass
    elif i >= 10** 4:
        cnt += 1
    elif i >= 10 **3:
        pass
    elif i >= 10 ** 2:
        cnt += 1
    elif i >= 10:
        pass
    else:
        cnt += 1
print(cnt)