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, n + 1):
  cnt = 0
  while i > 0:
    i //= 10
    cnt += 1
  if cnt % 2 != 0:
    ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(count)

Submission status: Accepted

Solution code:
j = sum(1 for number in range(1, int(input()) + 1)
        if len(str(number)) % 2 != 0)

print(j)

Submission status: Accepted

Solution code:
def uneven(number):
    result = []
    for x in range(1, number + 1):
        numberOfDigits = 1
        y = x

        if(y >= 100000):
            numberOfDigits = numberOfDigits + 5
            y = y / 100000

        if(y >= 10000):
            numberOfDigits = numberOfDigits + 4
            y = y / 10000

        if(y >= 1000):
            numberOfDigits = numberOfDigits + 3
            y = y / 1000

        if(y >= 100):
            numberOfDigits = numberOfDigits + 2
            y = y / 100

        if(y >= 10):
            numberOfDigits = numberOfDigits + 1

        if (numberOfDigits % 2 != 0):
            result.append(x)

    print(len(result))
    return len(result)
  
uneven(int(input()))

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)

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

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

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())
a = len(str(n))
b = 0
c = a//2

if a%2 == 0:
    for j in range(c):
        b += 9*100**j
    print(b)
else:
    for j in range(c):
        b += 9*100**j
    print(n-10**(a-1)+1+b)

Submission status: Accepted

Solution code:
N = int(input())
print(len(list(filter(lambda x: len(str(x)) % 2 == 1, range(1, N+1)))))

Submission status: Accepted

Solution code:
A_int = int(input())

count = 0

if 1<= A_int <=10**5:
    for i in range(1,A_int+1,1):
        check = str(i)
        if len(check)%2==1:
            count += 1
        else:
            pass
else:
    pass

print(count)

Submission status: Accepted

Solution code:
a = int(input())
b = 0

if len(str(a)) //2 *2 == len(str(a)):
    for i in range(len(str(a))//2):
        b += 10 **(2 *i) *9
    print(b)
else:
    for i in range(len(str(a))//2):
        b += 10 **(2 *i) *9
    b += a-10**(len(str(a))-1)+1
    print(b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
res = 0
def digit(x):
	d = 0
	while x:
		d += 1
		x //= 10
	return d
for i in range(1, n + 1):
	if digit(i) % 2 == 1:
		res += 1
print(res)

Submission status: Accepted

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

N = int(input())

ans = 0
for i in range(1, N+1):
    if len(str(i)) in {1, 3, 5}:
        ans += 1

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
x=len(n)
if x==1:
    print(int(n))

elif x<3:
    print(9)
elif x==3:
    print(9+int(n)-100+1)
elif x<5:
    print(909)
elif x==5:
    print(9+900+int(n)-10000+1)
else:
    print(90909)

Submission status: Accepted

Solution code:
N=int(input())
ct=0
for i in range(1,N+1):
    if len("{:d}".format(i))%2==1:
        ct+=1
print(ct)

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()
digits = len(n)
i = 0
count = 0
while (2*i+1) <= digits:
    if (2*i+1) == digits:
        count += int(n) - 10**(digits-1) + 1
        break
    else:
        count += (10**(2*i+1) - 1) - 10**(2*i) + 1
    i += 1

print(count)

Submission status: Accepted

Solution code:
a = int(input())

if a < 10:
  print(a)
elif a < 100:
  print(9)
elif a < 1000:
  print(a - 90)
elif a < 10000:
  print(909)
elif a < 100000:
  print(a - 90 - 9000)
elif a == 100000:
  print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
Mod = 1000000007



def main(): #startline-------------------------------------------
    ans = 0
    for i in range(1,int(input())+1):
        if len(str(i)) % 2 == 1:
            ans += 1
    print(ans)
if __name__ == "__main__":
    main() #endline===============================================




def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

Submission status: Accepted

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

def cal(n, len=1):
    if (n // 10)  < 1:
        return len
    len+=1
    return cal(n/10, len)

n = int(input())

count = 0
for i in range(1,n+1):
    len = cal(i)
    if len % 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-9000-90)
else: 
	print(90909)

Submission status: Accepted

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

for i in range(1,N+1):
    if i >= 100000:
        continue    
    elif i >= 10000:
        ans += 1
    elif i >= 1000:
        continue
    elif i >= 100:
        ans += 1
    elif i >= 10:
        continue
    else:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(res)

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

count = 0
l = len(str(N))

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

if n < 10:
    print(n)
    exit()

t = 10
k = 1
ans = 9
while t <= n:
    if k % 2 == 0:
        ans += t * 9
    t *= 10
    k += 1

#print(k, t, ans)

if k % 2 == 1:
    ans -= t - n - 1

print(ans)

Submission status: Accepted

Solution code:
a = input()
su = 0
for i in range(1, int(a)+1):
    li = list(str(i))
    if(len(li) % 2 == 0): # digit is even..
        continue
    #print(i)
    su = su + 1
print(su)

Submission status: Accepted

Solution code:
n = int(input())
nstr = str(n)
score = 0
ln = len(nstr)
lnfor = ln // 2

for i in range(lnfor):
  score += 9 * 100 ** i
if ln % 2 == 1:
  score += n - 10 ** (ln - 1) + 1
print(score)

Submission status: Accepted

Solution code:
N = int(input())

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

print(cut)

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

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

print (cnt)

Submission status: Accepted

Solution code:
n = int(input())

if True:
  max_d = int(len(str(n)))
  count = 0
  if max_d % 2 == 1:
    count = n - 10**(max_d-1) + 1
    for i in range(0, max_d-2, 2):
      count += 9*10**(i)
  else:
    for i in range(0, max_d-1, 2):
      count += 9*10**(i)
  print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
inp = raw_input("")
n = int(inp)
base = int(math.log10(n))
total = 0
for i in range(0, base, 2):
  total += 9 * (10 ** i)
if base % 2 == 0:
  total += n - (10 ** base) + 1
print total

Submission status: Accepted

Solution code:
import math
inp = raw_input("")
n = int(inp)
base = int(math.log10(n))
total = 0
for i in range(0, base, 2):
  total += 9 * (10 ** i)
if base % 2 == 0:
  total += n - (10 ** base) + 1
print total

Submission status: Accepted

Solution code:
print sum(len(str(i+1))&1for i in range(input()))

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<100:
	print(min(9,n))
elif n<10000:
	print(min(909,n-90))
else:
	print(min(90909,n-9090))

Submission status: Accepted

Solution code:
N = int(input())
N_list = list(map(int,[i for i in str(N)]))
N_list=N_list[::-1]


if len(N_list)%2==0:
  ans=0
  for i in range(len(N_list)):
    if i %2==0:
      ans+=9*(10**i)
else:
  ans=0
  for i in range(len(N_list)-1):
    if i % 2 ==0:
      ans+=9*(10**i)
  ans+=N - (10**(len(N_list)-1)) + 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0
if N < 10: # 10^1
  cnt = N
elif N < 100: # 10^2
  cnt = 9
elif N < 1000: # 10^3
  cnt = 9 + N - 100 + 1 
elif N < 10000: # 10^4
  cnt = 9 + 900
elif N < 100000: #10^5
  cnt = 9 + 900 + N - 10000 + 1
else :
  cnt = 9 + 900 + 90000

print(cnt)

Submission status: Accepted

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

print(count-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(n):
    if n < 10:
        return n
    elif n >= 10 and n < 100:
        return 9
    elif n >= 1000 and n < 10000:
        return 909
    elif n == 10**5:
        return 90909

    aux =  n - (10**(len(str(n)) -1)) + 1
    return aux + solve(10**(len(str(n)) -1)-1)

n = int(input())

ans = solve(n)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
list = [0]
i = 1
cnt = 0
while i <= N:
    if len(str(i)) % 2 != 0:
        cnt += 1
    i += 1
print(cnt)

Submission status: Accepted

Solution code:
a=int(input())
b=sum([10**i*9 for i in range(0, len(str(a))-1) if not i%2])
if len(str(a))%2:
    print()
    if len(str(a))==1:
        print(a)
    else:
        print(b+(a-10**(len(str(a))-1)+1))
else:
    print(b)

Submission status: Accepted

Solution code:
num = input()
result = 0

if len(num) != 1:
  result = int((len(num)-2)//2 * ("90") + "9")

if len(num) % 2 == 0:
  print(result)
else:
  numA = int("0" + (len(num) - 1) * "9")
  print(result + int(num) - numA)

Submission status: Accepted

Solution code:
num = input()

result = 0

if len(num) != 1:
  result = int((len(num)-2)//2 * ("90") + "9")

if len(num) % 2 == 0:
  print(result)
else:
  AAA = int("1" + (len(num) - 1) * "0") - 1
  print(result + int(num) - AAA)

Submission status: Accepted

Solution code:
n=int(input())
s=0
if n>=9:
    s+=9
else:
    s+=n
if n>=100:
    if n>=100 and n<=999:
        s+=n-100+1
    else:
        s+=900
if n>=10000:
    if n>=10000 and n<=99999:
        s+=n-10000+1
    else:
        s+=90000
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC136B - Uneven Numbers
def main():
    n = int(input())
    ans = sum(len(str(i)) % 2 for i in range(1, n + 1))
    print(ans)


if __name__ == "__main__":
    main()

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)-90)
elif len(n)==4:
  print("909")
elif len(n)==5:
  print(909+int(n)-10000+1)
else:
  print(90909)

Submission status: Accepted

Solution code:
l=[]
l.append(1)
for i in range(2,100001):
    T=list(str(i))
    if len(T)%2!=0:
        l.append(1+l[i-2])
    else:
        l.append(0+l[i-2])
n=int(input())
print(l[n-1])

Submission status: Accepted

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

Submission status: Accepted

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

# uneven numbers

if __name__ == "__main__":
    n = int(input())
    if n<10:
        print(n)
    elif n<100:
        print(9)
    elif n<1000:
        print(n-99+9)
    elif n<10000:
        print(909)
    elif n<100000:
        print(n-9999+909)
    elif n<1000000:
        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())
 
if n <10:
    count = n
elif n <100:
    count = 9
elif n <1000:
    count = n-90
elif n < 10000:
    count = 909
elif n < 100000:
    count = n-9090
else:
    count = 90909
 
print(count)

Submission status: Accepted

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

N = int(input())

odd = 0

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

print(odd)

Submission status: Accepted

Solution code:
# nの入力
n = int(input())
print(len(list(filter(lambda x: len(str(x)) % 2 == 1, range(1, n + 1)))))

Submission status: Accepted

Solution code:
n = int(input())

if n <10:
    count = n
elif n <100:
    count = 9
elif n <1000:
    count = n-90
elif n < 10000:
    count = 909
elif n < 100000:
    count = n-9090
else:
    count = 90909

print(count)

Submission status: Accepted

Solution code:
n = int(input())
print(len(tuple(filter(lambda x: len(str(x)) % 2 == 1, range(1, n + 1)))))

Submission status: Accepted

Solution code:
f = lambda : raw_input().rstrip()
f1 = lambda : f().split()
f2 = lambda t : map(t, f1())

def main1():
    A, B, C = f2(int)
    print 0 if B + C <= A else (B + C) - A

def main2():
    n = int(f())
    p = 0
    ans = 0
    while 10**p <= n:
        if 10**(p+1) > n:
            ans = ans + n - 10**p + 1
        else:
            ans = ans + 10**(p+1) - 10**p 
        p = p + 2
    print ans
    
def main3():
    n = int(f())
    a = f2(int)
    m = 0
    for i in xrange(1,n):
        if a[i] < a[i-1]:
            m = m + 1#(a[i-1] - a[i])
  
    print "Yes" if m < 2 else "No"

def main4():
    s = f()
    n = len(s)
    ans = [0]*n
    m = 1
    i = 1
    st = 0
    s = s + ("L" if s[-1]=="R" else "R")
    while i <= n:
        if s[i] != s[i-1]:
            #print i, st,
            j = st if s[i-1]=="L" else i
            #print j
            if m&1:
                ans[j-1] = ans[j-1] + m/2 + (1 if s[i-1] == "R" else 0) 
                ans[j] = ans[j] + m/2 + (1 if s[i-1] == "L" else 0)
            else:
                ans[j-1] =  ans[j-1] + m/2
                ans[j] = ans[j] + m/2
            m = 0
            st = i
        #print ans
        i = i + 1
        m = m + 1
    print " ".join(map(str,ans)) 
         
if __name__=="__main__":
    main2()

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:
i = list(map(int, input().split()))
n = i[0]
s = 0

if(n==100000):
    s = 90909
elif(n>=10000):
    s = n - 9999 + 900 + 9
elif(n>=1000):
    s = 900 + 9
elif(n>=100):
    s = n - 99 + 9
elif(n>=10):
    s = 9
else:
    s = n

print(s)

Submission status: Accepted

Solution code:
N = input()
n = len(N) - 1

ans = sum([9 * 10 ** i for i in range(0, n, 2)])
if n % 2 == 0:
    ans += int(N) - 10 ** n + 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

x = 0

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

print(x)

Submission status: Accepted

Solution code:
N=int(input())
if len(str(N))==1:
    print(N)
elif len(str(N))==2:
    print(9)
elif len(str(N))==3:
    print(N-90)
elif len(str(N))==4:
    print(909)
elif len(str(N))==5:
    print(N-9090)
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 ==1:
        cnt +=1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

count = 0

i = 1
while i <= N:
    if len(str(i)) % 2 != 0:
        count += 1
    i += 1
    
print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
def ii(): return int(stdin.readline())
def mi(): return map(int, stdin.readline().split())
def li(): return list(mi())
n=ii()
x=min(9, n)
if n>99:
    x+=min(900, n-99)
    if n>9999:
        x+=min(90000, n-9999)
print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
check = 1

a = [0, 9, 0, 900, 0, 90000]

for i in range(1, 6):
    check *= 10

    if (n < check):
        check = int(check / 10)

        if (i % 2 == 1):
            cnt += n - check + 1

        break

    cnt += a[i]

print(cnt)

Submission status: Accepted

Solution code:
import sys

for l in sys.stdin:
    N = int(l)
    result = d = 0
    while d < 5:
        d += 1
        if d % 2 == 0:
            if N < (10**d):
                break
            continue
        result += (10**d) - (10**(d-1))
        if N < 10**d:
            result -= 10**d - N - 1
            break
    print(result)

Submission status: Accepted

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

Submission status: Accepted

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

try:
    ans = int("09" * int(length / 2))
except BaseException:
    ans = 0

if length % 2 == 1:
    s = "9" * (length - 1)
    ans += N - int(s) if s else 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(n-90)
elif keta == 4:
    print(909)
elif keta == 5:
    print(n-9090)
else:
    print(90909)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# abc136/abc136_b
import sys
from math import log10

N = int(sys.stdin.readline().rstrip())
len_n = int(log10(N)) + 1
s = N - 10**(len_n - 1) + 1 if len_n % 2 else 0
for i in range(1, len_n, 2):
    s += 9 * 10**(i - 1)
print(s)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

N = input()

ans = 0

if len(N) == 1:
    ans = int(N)

else:
    for i in range(1, len(N) + 1, 2):

        dataS = N[i-1]

        if i == 1:
            ans = ans + 9

        elif i % 2 == 1:

            if i == len(N):
                data1 = (int(N[len(N) - i]) - 1)
                data2 = int(N[-(len(N)-1):]) + 1

                ans = ans + data1 *10**(i-1) + data2

            else:
                ans = ans + 9 * 10**(i-1)
            
print(str(ans))

Submission status: Accepted

Solution code:
N = int(input())

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

print(c)

Submission status: Accepted

Solution code:
n = int(input())

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

print(intCount)

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(9+N-99)
elif l ==4:
    print(9+900)
elif l ==5:
    print(9+999-99+N-9999)
elif N==100000:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

a = int(input())

cnt = 0

for i in range(1,10):
	cnt += 1
	if i == a :
		print (cnt)
		sys.exit()
if a < 100 :
	print (cnt)
	sys.exit()
for j in range(100,1000):
	cnt += 1
	if j == a :
		print (cnt)
		sys.exit()
        
if a < 10000 :
	print (cnt)
	sys.exit()
for k in range(10000,100000):
	cnt += 1
	if k == a :
		print (cnt)
		sys.exit()
if a == 100000 :
	print (cnt)
	sys.exit()

Submission status: Accepted

Solution code:
import math
s = input()
d = len(s)
ans = 0
if d % 2:
  ans += int(s) - pow(10, d-1) + 1
for i in range(1, d, 2):
  ans += 9*math.pow(10, i-1)
print(int(ans))

Submission status: Accepted

Solution code:
import math
N_str = input()
num = len(N_str)
N = int(N_str)
result = 0
for i in range(1, num):
  if i % 2 != 0:
    result += int(math.pow(10,i))-1 - int(math.pow(10,i-1)) + 1
if num % 2 !=0:
  result += N - int(math.pow(10,num-1)) + 1
  
print(result)

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())

array = np.arange(N)+1

n1=np.count_nonzero(array<10)
n2=np.count_nonzero((100<=array)&(array<1000))
n3=np.count_nonzero((10000<=array)&(array<100000))
ans=n1+n2+n3
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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; ansli = []; tmpli = []; candili = []
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def s_list(): return list(input())
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def num__grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]#NumberGrid
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def grid(n): return [s_list() for _ in range(n)]

n = i()

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
n_d=len(str(n))
ans=0
if n_d >1:
	for i in range(1,n_d,2):
		part1=9
		part2=10**i
		total=part1*part2
		total=total//10
		ans+=total
if n_d%2!=0:		
	part1=10**(n_d-1)
	part2=n-part1
	ans+=(part2+1)
print(int(ans))
# your code goes here

Submission status: Accepted

Solution code:
n = int(input())
str_n = str(n)
keta = len(str_n)
res = 0
for num in range(1, keta, 2):
  res += 9 * (10 ** (num - 1))
if(keta % 2 == 1):
  last = 0
  if(keta == 1):
    last = n
  else:
    last = (n - 10 ** len(str_n[1:])) + 1
  res += last
print(res)

Submission status: Accepted

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

keta = len(str(N))

count = 0

if N >= 10:
  
  count += 9
  
  for i in range(3, keta, 2):
    count += (10 ** (i) - 10 ** (i - 1))

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

Submission status: Accepted

Solution code:
def log(n):
    cnt=0
    for i in range(10):
        n=n//10
        cnt+=1
        if(n==0):
            break
    return cnt

N=int(input())
ans=0
for i in range(1,N+1):
    if(log(i)%2==1):
        ans+=1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
sl = len(s)
N = int(s)
if sl == 1:
    print(N)
elif sl == 2:
    print(9)
elif sl == 3:
    g = 9
    g += (N-100)+1
    print(g)
elif sl == 4:
    print(909)
elif sl == 5:
    g = 909
    g += N-10000+1
    print(g)
elif sl == 6:
    print(90909)

Submission status: Accepted

Solution code:
def get_ander_odds_digits(n):
    return [i for i in range(1, n + 1) if i % 2 == 1]

def get_number_of_odds(odd_list):
    return sum([9 * 10 ** (i - 1) for i in odd_list])

n = int(input())
number_of_digits = len(str(n))
answer = 0
if number_of_digits % 2 == 1:
    answer = n - 10 ** (number_of_digits - 1) + 1
number_of_digits -= 1

ander_odds_digits = get_ander_odds_digits(number_of_digits)
answer += get_number_of_odds(ander_odds_digits)
print(answer)

Submission status: Accepted

Solution code:
N= int(input())

num = len(str(N))

a =N%10**(num)


if num==1:
    print(N)
else:
    sum_=0
    for i in range(0,num-1,2):
        sum_+=9*(10**i)
    if num%2!=0:
        sum_+=(N-(10**(num-1))+1)
    print(sum_)