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

total_diff = 0

for x in [1, 100, 10000]:
    diff = 0
    if t >= x:
        diff = t - x + 1
    if diff > x*9:
        diff = x*9
    total_diff+=diff

print(total_diff)

Submission status: Accepted

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

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())
ans = 0

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

print(ans)

Submission status: Accepted

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

if n < 10:
    k = n

if 10 <= n < 100:
    k = 9

if 100 <= n < 1000:
    k = n -90

if 1000 <= n < 10000:
    k = 909

if 10000 <= n < 100000:
    k = n - 9090

if n == 100000:
    k = n - 9091

print(k)

Submission status: Accepted

Solution code:
a=input()
b=len(a)
c=int(a)
if b==1:
    print(c)
elif b==2:
    print(9)
elif b==3:
    d=c-99+9
    print(d)
elif b==4:
    print(909)
elif b==5:
    e=c-9999+909
    print(e)
else:
    print(90909)

Submission status: Accepted

Solution code:
import math

n = int(input())
cnt = 0
for a in range(1, n+1):
    if int(math.log10(a)+1) % 2 == 1: cnt += 1
print(cnt)

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())
if N == 10**5:
  res = 90909
elif 10**4 <= N < 10**5:
  res = N-9090
elif 10**3 <= N < 10**4:
  res = 909
elif 10**2 <= N < 10**3:
  res = N-90
elif 10 <= N < 10**2:
  res = 9
elif 1 <= N < 10:
  res = N
print(res)

Submission status: Accepted

Solution code:
n=int(input())
s=0
if n >100000:
  print(error)
elif n<10:
  s=n
elif n>=10 and n<100:
  s=9
elif n>=100 and n<1000:
  s=9+n-100+1
elif n>=1000 and n<10000:
  s=9+900
elif n>=10000 and n<100000:
  s=9+900+n-10000+1
else:
  s=9+900+90000
print(s)

Submission status: Accepted

Solution code:
N = input()
L = len(N)
N = int(N)
C = 0
dig = 1
try:
    while dig < L:
        if dig % 2 == 1:
            C = C + 10 ** dig * 0.9
        else:
            C = C
        dig += 1

    if dig == L:
        if dig % 2 == 1:
            C = C + N - (10 ** (dig - 1) - 1)
        else:
            C = C

    print(int(C))
except:
    print("ERROR NO 2")
    import traceback
    traceback.print_exc()

Submission status: Accepted

Solution code:
N = int(input())

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

print(count)

Submission status: Accepted

Solution code:
N = int(input())
leN = len(str(N))
counter = 0

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

if(leN % 2 == 1):
    counter = counter + N - 10**(leN - 1) + 1

print(counter)

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 python
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:
# https://atcoder.jp/contests/abc137/tasks/abc136_b
N = int(input())
count = 0
for x in range(1,N+1):
    if len(str(x)) % 2 == 1:
        count = count + 1
print( count )

Submission status: Accepted

Solution code:
n=int(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=int(input())
count=0
for i in range(1,n+1):
        keta=str(i) 

        if len(keta)%2==1:
                count+=1
print(count)

Submission status: Accepted

Solution code:
import math

def main(N, d):
  if d == 1:
    return N
  elif d == 2:
    return 9
  elif d == 3:
    return 9 + (N - 99)
  elif d == 4:
    return 909
  elif d == 5:
    return 909 + (N - 9999)
  else:
    return 90909
 

N = int(input())
d = int(math.log10(N)) + 1

print(main(N, d))

Submission status: Accepted

Solution code:
N = int(input())

digit = [5, 4, 3, 2, 1]
if N < 10:
    print(N)
elif N < 100:
    print(9)
elif N < 1000:
    print(9 + N - 99)
elif N < 10000:
    print(9 + 900)
elif N < 100000:
    print(9 + 900 + N - 9999)
else:
    print(9 + 900 + 90000)

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

Submission status: Accepted

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

if len(N)%2 == 1:
    sum += int(N) - 10**(len(N)-1)+1

print(sum)

Submission status: Accepted

Solution code:
n = int(input())

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

print(count)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num=input()

digit=len(num)
DIGIT=digit
num=int(num)
#桁数が1,3,5の場合数える
count=0

while digit!=0:

    if digit%2==0:
        digit-=1
        continue
    if digit==DIGIT:
        count+=num-10**(digit-1)+1
    else:
        count+=10**(digit)-10**(digit-1)
    
    digit-=1


print(count)

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
k = list(range(1, n+1))
s = np.array([len(str(i)) for i in k])
print(len(np.where(s % 2 == 1)[0]))

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

keta = len(str(N))
ans = 0
for i in range(1,6,2):
    if keta > i:
        ans += 9 * (10**(i-1))
    if keta == i:
        ans += N - (10**(i-1)) + 1
print(ans)

Submission status: Accepted

Solution code:
# B - Uneven Numbers
# https://atcoder.jp/contests/abc136/tasks/abc136_b
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())

n=len(str(N))//2
full=0
for i in range(n):
    full+=int('9'+'0'*i*2)

if len(str(N))%2==0:
    b=0
else:
    times=len(str(N))-1
    if times==0:
        nines=0
    else:
        nines=int('9'*times)
    b=N-nines
ans=full+b
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Fri Aug  9 21:17:49 2019

@author: Yamazaki Kenichi
"""

N = input()
n = int(N)

S = '909090'
S2 = '090909'

if len(N) & 1:
    ans = n - int(S[-len(N):])
else:
    ans = int(S2[-len(N):])

print(ans)

Submission status: Accepted

Solution code:
x = int(input())

if x <= 9:
  print(x)
elif x <= 99:
  print(9)
elif x <= 999:
  print(9+(x-99))
elif x <= 9999:
  print(909)
elif x <= 99999:
  print(909+(x-9999))
elif x==100000:
  print(90909)

Submission status: Accepted

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

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:
import math
N=int(input())
l = len(str(N))
if l == 1:
    print(N)
else:
    if l == 2:
        print(9)
    else:
        if l%2 == 1:
            a = [10**(l-i-2)-10**(l-i-3) for i in range(0,l+1,2)]
            print(math.floor(sum(a))+N-10**(l-1)+1)
        else:
            a = [10**(l-i-1)-10**(l-i-2) for i in range(0,l+1,2)]
            print(math.floor(sum(a)))

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 = 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 の値に関係なく一定
# 2桁なら 9、 4桁なら 909、 なので、偶数桁の数だけ '09'をつなげて int にする
# N の桁数が奇数の時は最大の桁の奇数桁の数を足す(N = 12500 なら 12500 - 10000 + 1)    
N = input()

digit = len(N)
ans = 0

if digit != 1:
  ans = '09' * (digit // 2)
  ans = int(ans)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

cnt = 0
for i in range(n):
  digit = 0
  x = i+1
  while(x):
    x //= 10
    digit += 1
   
  if(digit % 2 == 1):
    cnt += 1
   
print(cnt)

Submission status: Accepted

Solution code:
N = [i for i in range(int(input())+1) if i < 10 or (99 < i and i < 1000) or 9999 < i and i < 100000]
print(len(N)-1)

Submission status: Accepted

Solution code:
N = int(input())
X_1 = 9
X_2 = 900
X_3 = 90000
if N < 10:
  X = N
elif N < 10**2:
  X = X_1
elif N < 10**3:
  X = (N - 99) + X_1
elif N < 10**4:
  X = X_1 + X_2
elif N < 10**5:
  X = (N - 9999) + X_1 + X_2
elif N == 10**5:
  X = X_1 + X_2 + X_3

print(X)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n = int(input())

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

if k % 2 == 0:
    ks = k // 2
    ans = 9 * (100 ** ks - 1) // 99
else:
    ks = (k - 1) // 2
    ans = 9 * (100 ** ks - 1) // 99 + (n - 10**(k-1) + 1)

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())
ret = 0
for i in range(0, 5, 2):
    if 10**i <= n:
        ret += n - 10**i + 1 if n < 10**(i + 1) else 10**(i + 1) - 10**i
    else:
        break
print(ret)

Submission status: Accepted

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

if n <= 9:
	ct = n
elif n <= 99:
	ct = 9
elif n <= 999:
	ct = n - 90
elif n <= 9999:
	ct = 909
elif n <= 99999:
	ct = n - 9000  - 90
elif n == 100000:
	ct = 90909
	
print(ct)

Submission status: Accepted

Solution code:
a=int(input())
b=len(str(a))

ans=0

if b%2==0:
    for i in range(int(b/2)):
        c=1+i*2
        ans+=(10**c-(10**(c-1)))

else:
    ans+=(a-(10**(b-1))+1)
    for i in range(int((b-1)/2)):
        e=1+i*2
        ans+=(10**e-(10**(e-1)))

print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

for i in range(1, N + 1):
	if i < 10 or (i >= 100 and i < 1000) or (i >= 10000 and i < 100000):
		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:
n = input()

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

str_n = len(str(n))
if str_n == 6:
	ans = 90909
elif str_n == 4:
	ans = 909
elif str_n == 2:
	ans = 9
elif str_n == 5:
	ans = 909 + n - 9999
elif str_n == 3:
	ans = 9 + n - 99
else:
	ans = n

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
sum = 0
for i in range(1,n+1):
    length = 1
    num = i
    while num >= 10:
        num = num/10
        length += 1
    if (length % 2) == 1:
        sum += 1
print(sum)

Submission status: Accepted

Solution code:
n = int(input())
for i in range(5):
    if n == 100000:
        keta = 6
    elif 10**i <= n < 10**(i+1):
        keta = i+1
        break

if keta ==1:
    count = n
elif keta == 2:
    count = 9
elif keta == 3:
    count = 9 + (n - 99)
elif keta == 4:
    count = 9 + 900
elif keta == 5:
    count = 9 + 900 + (n - 9999)
else:
    count = 90909

print(count)

Submission status: Accepted

Solution code:

N = int(input())
A = 0
x = 1

if len(str(N))%2 == 0:
    for i in range(len(str(N))//2):
        A += 9*x
        x *= 100
    
    print(A)
else:
    A = N - 10**(len(str(N))-1) + 1
    
    for i in range((len(str(N))-1)//2):
        A += 9*x
        x *= 100
    
    print(A)

Submission status: Accepted

Solution code:
N = int(input())

result = 0
if N < 10:
  result = N
elif N < 100:
  result = 9
elif N < 1000:
  result = 9 + (N - 100 + 1)
elif N < 10000:
  result = 9 + 900
elif N < 100000:
  result = 9 + 900 + (N - 10000 + 1)
else:
  result = 9 + 900 + 90000
print(result)

Submission status: Accepted

Solution code:
N = int(input())

n = len(str(N))
if n == 1:
    print(N)
else:
    if n % 2 == 0:
        s = "90" * (n//2)
        print(s[:-1])
        
    else:
        s = "90" * ((n-1) // 2)
        ans = int(s[:-1]) + N - 10**(n-1) + 1
        print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = 0
i = 1
while N//i != 0:
    if N//(i*10) != 0:
        a += i*10 - i
        i = i*100
    else:
        a += N - i +1
        i = i*100
print(a)

Submission status: Accepted

Solution code:
n=int(input())

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


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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# n = map(int, input().split())
n = int(input())
# 文字列の入力
# 出力

num = 0
for i in range(1, n+1):
  if len(str(i)) % 2 == 1:
    num = num +1
    
print("{}".format(num))

Submission status: Accepted

Solution code:
N=int(input())
h=len(str(N))
if h%2==1:
  a=N-(10**(h-1))+1
  a=a+((100**((h-1)//2))-1)//11
  print(a)
elif h%2==0:
  a=((100**(h//2))-1)//11
  print(a)

Submission status: Accepted

Solution code:
N = int(input())

ans = min(9, N) + max(0, min(999, N) - 99) + max(0, min(99999, N) - 9999)

print(ans)

Submission status: Accepted

Solution code:
cnt = 0
n = int(input())
for r in range(n):
    if len(str(r+1))%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(9+N-99)
elif N < 10000:
  print(909)
elif N < 100000:
  print(9+900+N-9999)
else:
  print(90909)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
exc = {1:0, 3:99, 5:9999}
full = {1:9, 3:900, 5:90000}

for x in range(1, len(S) + 1, 2):
    if x == len(S):
        count += N - exc[x]
    else:
        count += full[x]

print(count)

Submission status: Accepted

Solution code:
num=input("")
count=0


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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
n = int(input())
if n == 100000:
  print(90909)
elif n / 10000 >= 1:
  print(9 + 900 + n - 10000 + 1)
elif n / 1000 >= 1:
  print(909)
elif n / 100 >= 1:
  print(9 + n - 100 + 1)
elif n / 10 >= 1:
  print(9)
elif n < 10:
  print(n)

Submission status: Accepted

Solution code:


N = int(input())
ketaCounter = 1
keta = 10
answer = 0

while N >= keta:
    ketaCounter += 1
    keta *= 10

for i in range(ketaCounter-1):
    ketaketa = i+1
    if ketaketa % 2 == 1:
        answer += 10 ** (ketaketa) - 10 ** (i) 
        

if ketaCounter == 1:
    answer += N
elif ketaCounter % 2 == 1:
    answer += N - 10 ** (ketaCounter-1) + 1
   
print(answer)

Submission status: Accepted

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

suji = []
suji_2 = []
mojiretu = ''
mojire = ''
flug = 0

if keta%2 == 0:
    for i in range(keta-1):
        if i%2 == 0:
            suji.append('9')
        else:
            suji.append('0')

else:
    if keta == 1:
        print(input_line)
        exit()
    else:
        for i in range(keta-2):
            if i%2 == 0:
                suji.append('9')
            else:
                suji.append('0')
        flug = 1

for x in suji:
    mojiretu += x

for y in range(keta-1):
    suji_2.append('9')

for x in suji_2:
    mojire += x


if flug == 0:
    print(mojiretu)
else:
    input_line = input_line - int(mojire)
    print(int(mojiretu) + input_line)

Submission status: Accepted

Solution code:
p=le=len([x for x in range(input()) if len(str(1+x))%2])
print p

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())
if n < 10:
    print(n)
elif n < 100:
    print(9)
elif n < 1000:
    print(n - 90)
elif n < 10000:
    print(909)
elif n < 100000:
    print(n - 9090)
else:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
def ketasuu(n):
  keta=0
  while n>0:
    n//=10
    keta+=1
  return keta
N_keta=ketasuu(N)
ans=0
if N_keta%2==0:
  for i in range(1,N_keta//2+1):
    ans+=10**(2*i-1)-10**(2*i-2)
else:
  for i in range(1,N_keta//2+1):
    ans+=10**(2*i-1)-10**(2*i-2)
  ans+=N-10**(N_keta-1)+1
print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

result = 0
for i, n in enumerate(N[::-1]):
    idx = len(N) - i
    if idx % 2 == 0:
        continue
    else:
        if i == 0:
            result += int(N) - (10 ** (idx - 1)) + 1
        else:
            result += 9 * (10 ** (idx - 1))

print(result)

Submission status: Accepted

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

a = 0
if digit % 2 == 0:
  while digit > 0:
    if digit % 2 != 0:
      a += 10 ** digit - 10 ** (digit-1)
    digit -= 1
else:
  digit -= 1
  a += n - 10 ** (digit) + 1
  while digit > 0:
    if digit % 2 != 0:
      a += 10 ** digit - 10 ** (digit-1) 
    digit -= 1

print(a)

Submission status: Accepted

Solution code:
n = int(input())

ans = int(0)

if n < 10:
  ans = n
if 100 > n and n >= 10:
  ans = 9
if 1000 > n and n >= 100:
  ans = n-90
if 10000 > n and n >= 1000:
  ans = 909
if 100000 > n and n >= 10000:
  ans = n-9090
if 100000 == n:
  ans = 90909

print(ans)

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
import math
N = int(input())
keta = math.floor(math.log10(N))+1
if keta<1:
  result = 0
elif keta == 1:
  result = N
elif keta == 2:
  result = 9
elif keta%2==1:
  result = 9
  a = (keta-2)//2
  for i in range(1,a+1):
    result += 9*10**(2*i)
  result += N - 10**(keta-1) + 1
else:
  result = 9
  a = (keta-2)//2
  for i in range(1,a+1):
    result += 9*10**(2*i)
print(result)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力


def main():
    # n
    n = int(input())
    print(process(n))


def process(n):
    first = n % 10
    second = (n - first) % 100
    third = (n - first - second) % 1000
    forth = (n - first - second - third) % 10000
    fifth = (n - first - second - third - forth) % 100000
    sixth = (n - first - second - third - forth - fifth) % 1000000
    if sixth != 0:
        return 9 + 900 + 90000
    if fifth != 0:
        return 9 + 900 + (n - 9999)
    if forth != 0:
        return 9 + 900
    if third != 0:
        return 9 + (n - 99)
    if second != 0:
        return 9
    if first != 0:
        return n


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:


n = input()
keta = len(n)
n = int(n)

count = 0
if keta == 1:
    count = (n-1+1)
elif keta == 2:
    count = (9-1+1)
elif keta == 3:
    count = (n-100+1) + (9-1+1)
elif keta == 4:
    count = (9-1+1) + (999-100+1)
elif keta == 5:
    count = (n-10000+1) + (9-1+1) + (999-100+1)
elif keta == 6:
    count = (9-1+1) + (999-100+1) + (99999-10000+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())
Nlen=len(str(N))

if Nlen==1:
  print(N)
elif Nlen==2:
  print(9)
elif Nlen==3:
  print(9+(N-99))
elif Nlen==4:
  print(9+900)
elif Nlen == 5:
    print(9 + (999 - 99) + (N - 9999))
elif Nlen == 6:
    print(9 + (999 - 99) + (99999 - 9999))

Submission status: Accepted

Solution code:
N = int(raw_input())

print len([j for j in xrange(1, 1+N) if len(str(j)) in [1, 3, 5]])

Submission status: Accepted

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

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(900+9)
elif 10000<=N and N<100000:
    print(909+(N-9999))
elif N==100000:
    print(90000+900+9)

Submission status: Accepted

Solution code:
# your code goes here
def odd_dig(n):
	n = str(n)
	return len(n) % 2 != 0
 
a = int(input())
count = 0
for i in range(1,a+1):
	if odd_dig(i):
		count += 1
 
print(count)

Submission status: Accepted

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

if N_length == 1:
    print(N)
if N_length == 2:
    print(9)
elif N_length == 3:
    print(9 + (N - 99))
elif N_length == 4:
    print(9 + (999 - 99))
elif N_length == 5:
    print(9 + (999 - 99) + (N - 9999))
elif N_length == 6:
    print(9 + (999 - 99) + (99999 - 9999))

Submission status: Accepted

Solution code:
number = list(input())

n = len(number) // 2
ans = 0
underNum = ''

if n == 0:
  ans = int(number[0])
else:
  ans = 9
  for i in range(3, len(number)+1):
    if i == len(number) and i % 2 != 0:
      if int(number[0]) == 1:
        for j in range(1, i):
          underNum += number[j]
        ans += int(underNum) + 1
      else:
        ans += (int(number[0]) - 1) * 100 ** (i // 2)
        for j in range(1, i):
          underNum += number[j]
        ans += int(underNum) + 1
    elif i % 2 != 0:
      ans += 9 * 100 ** (i // 2)
      
print(ans)

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:
print(sum([k-10**i if i%2==0 else 0 for i,k in enumerate(*[[int(N)+1 if i==0 else 10**(len(str(N))-i) for i in range(len(str(N)))][::-1] for N in [str(input())]])]) )

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:
    ans = N
elif N < 10 ** 2:
    ans = 9
elif N < 10 ** 3:
    ans = N - 10 ** 2 + 10
elif N < 10 ** 4:
    ans = 909
elif N < 10 ** 5:
    ans = N - 10 ** 4 + 910
else:
    ans = 90909
print(ans)

Submission status: Accepted

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

print(kekka)

Submission status: Accepted

Solution code:
n=int(input())

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

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:
  print(90909)

Submission status: Accepted

Solution code:
def solve(string):
    base = int(string) if len(string) % 2 == 1 else 10**(len(string) - 1) - 1
    excepts = sum([9 * 10**(i - 1) for i in range(2, len(string), 2)])
    return str(base - excepts)


if __name__ == '__main__':
    print(solve(input()))

Submission status: Accepted

Solution code:
N = int(input())
strN = str(N)
#print(N)
sum=0

if(len(strN)%2==1):
    sum+=N-10**(len(strN)-1)+1
    #print(sum)

for i in range(len(strN)-1,0,-1):
    #print(i)
    if(i%2==1):
        sum+=10**(i-1)*9
        #print(sum)
if(len(strN)==1):
    sum=N

print(sum)

Submission status: Accepted

Solution code:

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

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

        







main()

Submission status: Accepted

Solution code:
N = int(input())

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

print(res)

Submission status: Accepted

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

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:
        ans += 1
    else:
        pass
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N <= 9:
    result = N
elif N <= 99:
    result = 9
elif N <= 999:
    result = N - 90
elif N <= 9999:
    result = 909
elif N <= 99999:
    result = N - 9090
elif N == 100000:
    result = 90909

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#abc136b

n=int(raw_input())
res=0
for i in xrange(1,n+1):
 if len(str(i))%2==1:
  res+=1
print res

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

def count_uneven_digit(N):
    n_digits = int(math.log10(N) + 1)
    
    diffs = 0
    if n_digits%2 != 0:
        diffs = 9*10**(n_digits-1) - N + 10**(n_digits - 1) - 1
    
    num_uneven_digitnums = [9*10**i for i in range(n_digits) if i % 2 == 0]
    return sum(num_uneven_digitnums) - diffs
  
  
N = int(input())

print(count_uneven_digit(N))

Submission status: Accepted

Solution code:
n = int(input())

sn = str(n)
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())

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

print(res)

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:
l=[9,900,90000,900000]
n=int(input())
ld=len(str(n))
if ld==1:
  print(n)
elif ld==2:
  print(l[0])
elif ld==3:
  print(l[0]+(n-100)+1)
elif ld==4:
  print(l[0]+l[1])
elif ld==5:
  print(l[0]+l[1]+(n-10000)+1)
elif ld==6:
  print(l[0]+l[1]+l[2])