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: Wrong Answer

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


def main():
    N = input().strip()
    ans = 0
    for i in range(0, len(N)-1, 2):
        x = 10**(i+1) - 10**i
        ans += x

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

ans = 0
keta_half = keta // 2

if keta_half > 0:
    if keta % 2 == 0:
        for i in range(keta_half):
            ans += 9 * 10 ** (2*i)
    else:
        for i in range(keta_half):
            ans += 9 * 10 ** (2*i)
            zan = int(N[1:]) + 1
            ans += zan
else:
    ans = int(N)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

X = len(str(N))

if X == 1:
    print(N)
elif X == 2:
    print(9)
elif X == 3:
    print(9 + (N - 100 + 1))
elif X == 4:
    print(909)
elif X >= 5:
    print(9 + 900 + (N - 10000))

Submission status: Wrong Answer

Solution code:
i = input()

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

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
i = 0
ans = 0
while n-10**i > 0:
    if not i & 1:
        if n-10**(i+1) < 0:
            ans += n - 10**i + 1
        else:
            ans += 10**i * 9

    i += 1

print(ans)

Submission status: Wrong Answer

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

if l == 6:
    ans = 90109
elif l == 5:
    ans = 109 + n - 10000 + 1
elif l == 4:
    ans = 109
elif l == 3:
    ans = 9 + n - 100 + 1
elif l == 2:
    ans = 9
else:
    ans = n 
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from collections import deque
import copy

N = int(input())

count = 0

if N < 10:
    print(N)
elif N < 100:
    print(9)
elif N < 1000:
    print(9 + min(N,999) - 100 + 1)
elif N < 10000:
    print(9 + 899)
elif N < 100000:
    print(9 + 899 + min(N , 9999)- 1000 + 1)
else:
    print(90909)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
dig = math.log10(n)
if dig<1:
    print(n)
elif 1 <= dig and dig < 2:
    print(9)
elif 2 <= dig and dig < 3:
    print(9+n-99)
elif 3 <= dig and dig < 4:
    print(9+999-99)
elif 4 <= dig and dig < 5:
    print(9+999-99+n-10000)
else:
    print(9+999-99+99999-10000+1)

Submission status: Wrong Answer

Solution code:
s = int(input())

tmp = s + 1
i = 0
output = 0
for i in range(tmp):
    i = i + 1
    if int(len(str(i)))%2 == 0:
        i = 0
    else:
        output = output + 1
        
print(output)

Submission status: Wrong Answer

Solution code:
N = int(input())
if N < 10:
    l = range(N)
else:
    l = range(1, N)

counter = 0
for s in l:
    n = len(str(s))
    if n % 2 == 1:
        counter += 1
print(counter)

Submission status: Wrong Answer

Solution code:
s=input()	

# 1番台
if len(s) < 2:
  print(int(s)) 
  
# 10番台
elif len(s) < 3:
  print(9)
  
# 100番台  
elif len(s) < 4:
  print(9 - 99 + int(s))
  
# 1000番台  
elif len(s) < 5:
  print(10 + 899)
  
# 10000番台  
elif len(s) < 6:
  print(9 - 9999 + int(s))
  
# 100000番台  
elif len(s) < 7:
  print(90909)

Submission status: Wrong Answer

Solution code:
n = int(input())

base = 10
odd = False

ans = 0
while  n > base:
    t = n % base
    if odd:
        pass
    else:
        ans += (base - (base//10))
    odd = not odd
    base *= 10

if not odd:
    if base == n:
        ans += (base - (base // 10))
    else:
        base //= 10
        ans += (n - base + 1)

print(ans)

Submission status: Wrong Answer

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

if l == 2:
    print(int(9))
else:
    ans = a - ((10**(l-1))-1) 
    l -= 1
    while l >= 1:
        if l % 2 == 0:
            l -= 1
        else:
            ans += (10**(l))-1 
            l -= 1
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

numOfDigit = 1
answer = 0

n = 1
while(N >= n * 10):
    if (numOfDigit % 2):
        answer += n * 9
    numOfDigit += 1
    n *= 10

if (numOfDigit % 2):
    answer += N % n + 1

print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
digit= int(np.log10(n)//1)
tmp = 0
if digit%2==0 and n>=10:
  tmp = n%(10**digit)+1
elif n<10:
  tmp = n
for i in range(1,digit+1,2):
  if i == 1:
    tmp += 9
  else:
    tmp += 9*10**i
print(tmp)

Submission status: Wrong Answer

Solution code:
N = str(input())
m = len(N)
ans = int(N) 
if m == 2:
    ans = 9
elif m == 3:
    ans -= 90
elif m == 4:
    ans = 909
elif m == 5:
    ans -= 90
    ans -= 9000
    ans += 1
else:
    ans = 90909
print(ans)

Submission status: Wrong Answer

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

if 10000 <= n:
  m=n-10000
  count+=m
  count+=909

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

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

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

if n < 10:
  count+=n

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    N = int(input())
    logging.info("Hello!")

    answer = 0

    if N < 10:
        answer = N
    elif N >= 10 and N < 100:
        answer = 9
    elif N >= 100 and N < 1000:
        answer = 9 + N % 100 + 1
    elif N >= 1000 and N < 10000:
        answer = 909
    elif N >= 10000 and N < 100000:
        answer = 909 + N % 10000 + 1
    else:
        answer = 90909

    print(answer)
        
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:

n = int(input())

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

print(ans)

Submission status: Wrong Answer

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

l = len(Nstr)

_sum = 0

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

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

print(_sum)

Submission status: Wrong Answer

Solution code:
from sys import stdin


def main():
    N = stdin.readline().rstrip()
    N_num = int(N)

    if len(N) == 1:
        print(N_num)

    elif len(N) == 2:
        print(9)

    elif len(N) == 3:
        print(N_num % 100 + 10)

    elif len(N) == 4:
        print(909)

    elif len(N) == 5:
        print(N_num % 10000 + 910)

    elif len(N) == 6:
        print(90909)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

for i in range(10):
  q, mod =divmod(N, 10**(i+1))
  if i == 0:
    if q > 0:
      sum += 9
    else:
      sum += N
      break
  elif i % 2 == 0:
    if q > 0:
      sum += 9*10**i
    else:
      q2, mod2 = divmod(N, 10**i)
      sum += mod2 + 1
      break
  else:
    if q == 0:
      break
print(sum)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())

cont = 0

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

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
ans = int(0)
s = round(math.log10(N))+1


if s == 1:
    ans = N
elif s==2:
    ans = 9
elif s==3:
    ans = N%100+10
elif s==4:
    ans = 909
elif s==5:
    ans = N%10000+910
elif s==6:
    ans = 90909


print(ans)

Submission status: Wrong Answer

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

if N < 10:
	print(N)

elif N < 100:
	print(9)

elif N < 1000:
	print(N -90)

elif N < 10000:
	print(999-90)

elif N < 10000:
	print(N - 9090)

else:
	print(99999 - 9090)

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0

if N < 10:
    print(N)
elif N < 100:
    print(9)
elif N < 1000:
    print(9 + min(N,999) - 100 + 1)
elif N < 10000:
    print(9 + 899)
elif N < 99999:
    print(9 + 899 + min(N , 99999)- 1000 + 1)
else:
    print(90909)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
l=len(str(N))
if l==1:
  print(N)
elif l==2:
  print(9)
elif l==3:
  print(N-90)
elif l==4:
  print(909)
elif l==5:
  print(90909)

Submission status: Wrong Answer

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

ans = 0
keta_half = keta // 2

if keta_half > 0:
    if keta % 2 == 0:
        for i in range(keta_half):
            ans += 9 * 10 ** (2*i)
    else:
        for i in range(keta_half):
            ans += 9 * 10 ** (2*i)
            zan = int(N[1:]) + 1
            ans += zan
else:
    print("a")
    ans = int(N)

print(ans)

Submission status: Wrong Answer

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

for i in range(5):
  q, mod =divmod(N, 10**(i+1))
  if i == 0:
    if q > 0:
      sum += 9
    else:
      sum += N
      break
  elif i % 2 == 0:
    if q > 0:
      sum += 9*10**i
    else:
      q2, mod2 = divmod(N, 10**i)
      sum += mod2 + 1
      break
  else:
    if q == 0:
      break
print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if d%2==0:
    print(9*10**(d//2-1))
else:
    print(9*10**(d//2-1)+n-10**(d//2+1)+1)

Submission status: Wrong Answer

Solution code:
n = int(input())

if n < 10:  # 10^1
    print(n)  # 1-n
elif n < 100:  # 10^2
    print(9)  # 1-9
elif n < 1000:  # 10^3
    print(n-90) # 1-9, 100-n
elif n < 10000:  # 10^4
    print(9+900)
elif n < 100000: # 10^5
    print(n-9000)
else:
    print(9+900+90000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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 = (n - 90)
elif(1000 <= n and n < 10000):
    ans = 910
elif(10000 <= n and n < 100000):
    ans = (n-9090)
else:
    ans = 90909

print(ans)

Submission status: Wrong Answer

Solution code:
a = [9, 99, 999, 9999, 99999, 99999]

str = input()
org = int(str)
c = len(str)

if c == 1:
  ans = org
elif c == 2:
  ans = a[0]
elif c == 3:
  ans = a[0] + org - a[1]
elif c == 4:
  ans = a[0] + a[2]
else:
  ans = a[0] + a[2] + 1 

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0
d = 10
p = 1
while True:
    if N / d >= 1:
        ans += 9 * p
        d *= 100
        p *= 100
    else:
        if N / (d / 10) >= 1:
            ans += N % (d / 10) + 1
        break
print(int(ans))

Submission status: Wrong Answer

Solution code:
N=int(input())
l=len(str(N))
if l==1:
  print(N)
elif l==2:
  print(9)
elif l==3:
  print(N-90)
elif l==4:
  print(908)
elif l==5:
  print(90909)

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline
 
    n = input()
    out = 0
    
    for i in range(1, len(n)+1):
        if(i < len(n)) and ((i % 2) == 1):
            out += 9 * 10 **(i-1)
        # print(i)
    
    if (i % 2) == 1:
        out += int(n) - 10 ** (i-1) + 1
    
    print(out)

        
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = str(input())
m = len(N)
ans = int(N) 
if m == 2:
    ans = 9
elif m == 3:
    ans -= 90
elif m == 4:
    ans = 909
elif m == 5:
    ans -= 90
    ans -= 9000
else:
    ans = 90909
print(ans)

Submission status: Wrong Answer

Solution code:
a = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(tmp)

Submission status: Wrong Answer

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(b+(a-10**(len(str(a))-1)*int(str(a)[0])+1))
else:
    print(b)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
if n < 10:
  ans = n
elif n < 10**2:
  ans = 9 
elif n < 10**3:
  ans = n - 90
elif n < 10**4:
  ans = 909
elif n < 10**5:
  ans = n - 9091
else:#n==10**5
  ans = 90909
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = str(input())

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

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

Submission status: Wrong Answer

Solution code:
N=int(input())
l=len(str(N))
if l==1:
  print(N)
elif l==2:
  print(9)
elif l==3:
  print(N-90)
elif l==4:
  print(910)
elif l==5:
  print(90909)

Submission status: Wrong Answer

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

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

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

print(oddn)

Submission status: Wrong Answer

Solution code:
s = int(input())

tmp = s + 1
i = 0
output = 0
for i in range(tmp):
    if i%2 == 0:
        i = 0
    else:
        output = output + 1
        
print(output)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ct = 0
for i in range(N+1):
  k = i+1
  order = 0
  while(k>0):
  	order += 1
  	k //= 10
  if(order % 2 != 0):
    ct += 1
print(ct)

Submission status: Wrong Answer

Solution code:
n = input().strip()
nLen = len(n)
n = int(n)
ans = 0
if nLen == 1:
    ans = n
elif nLen == 2:
    ans = 9
elif nLen == 3:
    ans = n - 99 + 9
elif nLen == 4:
    ans = 9 + 900
elif nLen == 5:
    ans = n - 999 + 900 + 9
elif nLen == 6:
    ans = 90909
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Aug  4 21:00:32 2019

@author: sp8783
"""

n = int(input())

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

print(ans)

Submission status: Wrong Answer

Solution code:
n = str(input())
d = 0
if len(n) == 5:
    f = int(n)-9999
    g = 900
    h = 9
    d = f + g + h
if len(n) == 4:
    d = 909
if len(n) == 3:
    i = int(n)-99
    d = i + 9
if len(n) == 2:
    d = 9
if len(n) == 1:
    d = len(n)
if len(n) == 5:
    d = 90909
print(d)

Submission status: Wrong Answer

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


ans = 0

#1:1-9
if 1<=N<=9:
	ans += N

#2:10-99
if 10<=N<=99:
	ans += 9

#3:100-999
if 100<=N<=999:
	ans += N-99

#4:1000-9999
if 1000<=N<=9999:
	ans += 900

#5:10000-99999
if 10000<=N<=99999:
	ans += N-9999


#6:100000-999999
if 100000<=N<=999999:
	ans += 9999


print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())

digit = int(np.log10(N).round()+1)
cnt = 0

for x in range(digit):
    x += 1
    if x % 2 != 0:
        if x < digit:
            cnt += (10**x) - (10**(x-1))
        else:
            cnt += N - (10**(x-1)) + 1
print('{}'.format(cnt))

Submission status: Wrong Answer

Solution code:
import sys
import collections
import copy
input = sys.stdin.readline
N=input()
ans = 0
keta = int(len(N))
if keta%2 == 0:
    keta = keta-1
    for i in range(1,keta+2,2):
        ans += 9*(10**(i-1))
else:
    if keta == 1:
        ans = N
    else:
        keta = keta-2
        for i in range(1,keta+2,2):
            ans += 9*(10**(i-1))
        ans += (int(N)-(10**(keta+1))+1)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0
digit = 1

if N <= 9:
  print(N)
else:
  for i in range(1, N, 1):
    if (i % 10)==0:
      digit = digit + 1
      
    if(digit % 2) == 0:
      count = count + 0
    else:
      count = count + 1
      
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
if N<=9:
    print(N)
elif N<=99:
    print(9)
elif N<=999:
    print(9+(N-99))
elif N<=9999:
    print(909)
elif N<=99999:
    print(909+(N-9999))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
l=len(str(N))
if l==1:
  print(N)
elif l==2:
  print(9)
elif l==3:
  print(N-90)
elif l==4:
  print(999)
elif l==5:
  print(90909)

Submission status: Wrong Answer

Solution code:
N = str(input())
m = len(N)
ans = int(N) 
if m == 2:
    ans = 9
elif m == 3:
    ans -= 90
elif m == 4:
    ans -= 90
    ans %= 1000
elif m == 5:
    ans -= 90
    ans -= 9000
else:
    ans = 90909
print(ans)

Submission status: Wrong Answer

Solution code:
n = input()
le = len(n)

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

Submission status: Wrong Answer

Solution code:
n = input()

num = len(n)

if num == 1:
  print(n)
elif num == 2:
  print(9)
elif num == 3:
  result = (int(n)-100+1) + 9
  print(result)
elif num == 4:
  print(1009)
elif num == 5:
  result = (int(n)-10000+1) + 1000 + 9
  print(result)
else:
  print(90909)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
for i in range(1, 6):
  if 10**i < n and i%2==1:
    ans += 10**i - 10**(i-1)

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

Submission status: Wrong Answer

Solution code:
N = input()

if len(N) == 1:
    print(N)
if len(N) == 2:
    print(9)
if len(N) == 3:
    print(9 + int(N) - 100 + 1)
if len(N) == 4:
    print(9 + 900)
if len(N) == 5:
    print(9 + 900 + int(N) - 10000 + 1)
if len(N) == 6:
    print(909090)

Submission status: Wrong Answer

Solution code:
a=int(input())

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

print(s)

Submission status: Wrong Answer

Solution code:
N=int(input())
l=len(str(N))
if l==1:
  print(N)
elif l==2:
  print(9)
elif l==3:
  print(N-90)
elif l==4:
  print(909)
elif l==5:
  print(90909)

Submission status: Wrong Answer

Solution code:
N = int(input())
N_base = N
i = 1
while True:
    mod = N%10
    N = N//10
    if N == 0 and mod != 0:
        break
    elif N == 0 and mod == 0:
        i += 1
        break
    else:
        i += 1
if i == 1:
    print(i)
else:
    num = 0
    for j in range(1,i+1,2):
        if j == i:
            num += N_base - 10**(i-1) + 1
        else:
            num += 10**(j) - 10**(j-1)
    print(num)

Submission status: Wrong Answer

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

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

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

print(oddn)

Submission status: Wrong Answer

Solution code:
N = input()

if len(N) % 2 == 0:
    C = len(N) - 1
    if C == 5:
        print('90909')
    elif C == 3:
        print('909')
    elif C == 1:
        print('9')
elif len(N) % 2 == 1:
    if len(N) == 5:
        C = int(N) - 9999
        print(C+909)
    elif len(N) == 3:
        C = int(N) - 99
        print(C+9)
    elif len(N) == 1:
        print(len(N))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())
a = 0
if N < 10:
    a = N
elif 10 <= N <100:
    a = 9
elif 100 <= N < 1000:
    a = N - 90
elif 1000 <= N < 10000:
    a = 909
elif 10000 <= N < 100000:
    a = N - 9090
else:
    a = 90910

print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())
v = 0
if N // 1 >= 10:
    # 2桁以上
    v += 9
    if N // 10 >= 10:
        if N // 100 >= 10:
            # 4桁以上
            v += 900
            if N // 1000 >= 10:
                if N // 10000 >= 10:
                    # 5桁以上
                    v += 90000
                else:
                    # 4桁
                    v += N % 10000 + 1
        else:
            # 3桁
            v += N % 100 + 1

else:
    # 1桁
    v += N % 10 + 1

print(v)

Submission status: Wrong Answer

Solution code:
N = str(input())
m = len(N)
ans = int(N) 
if m == 2:
    ans = 9
elif m == 3:
    ans -= 90
elif m == 4:
    ans -= 90
    ans %= 1000
else:
    ans = 90909
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 0
if N > 9:
    ans += 9
if N <= 999:
    ans += max(0, N - 99)
    print(ans)
    exit()
elif N > 999:
    ans += 900
if N <= 99999:
    ans += max(0, N - 9999)
    print(ans)
    exit()
elif N > 99999:
    ans += 90000

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
def f(x):
  return ((x-2)//2)*"90"+"9"
if len(str(n)) % 2 == 0:
  print(f(len(str(n))))
else:
  print(int(f(len(str(n))-1))+n-10**(len(str(n))-1)+1)

Submission status: Wrong Answer

Solution code:
N=input()

if len(N)==1:
    print(int(N))
elif len(N)==2:
    print(9)
elif len(N)==3:
    print(9+int(N)-99)
elif len(N)==4:
    print(909)
else:
    print(909+int(N)-10000)

Submission status: Wrong Answer

Solution code:
n=int(input())
d=len(str(n))
print(d)

if d%2==0:
    print(9*10**(d//2-1))
else:
    print(9*10**(d//2-1)+n-10**(d//2+1)+1)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = 0
if N < 10:
    a = N
elif 10 < N <100:
    a = 9
elif 100 <= N < 1000:
    a = N - 90
elif 1000 <= N < 10000:
    a = 909
elif 10000 <= N < 100000:
    a = N - 9090
else:
    a = 90910

print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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