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 math
n=int(input())
a=round(math.log10(n))
count=0
result=0
while count<=a:
	if a<=1:
		result += n+1
		break
	else:
		if count==a:
			result += n-10**count + 1
			count += 2
		else:
			if  count==0:
				result+=10
				count +=2
			else:
				result += 10**(count+1)-10**count
				count += 2
print(result-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
v = 0
if N >= 10:
    v += 9
    if N >= 100:
        if N >= 1000:
            v += 900
            if N >= 10000:
                if N >= 100000:
                    v += 90000
                    if N >= 1000000:
                        pass
                else:
                    v += N % 100000 + 1
        else:
            v += N % 1000 + 1
else:
    v += N % 10
print(v)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

l = len(str(n))

ans=0

if l>1:
    ans+=9
if l>3:
    ans+=900
if l>5:
    ans+=90000

if l==1:
    ans=n
elif l in [3,5]:
    ans+=int(str(n)[1:])+1


print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n=input()
count=0
if len(n)==1:
  count=int(n)
else:
  count+=9
  if len(n)==3:
    count+=(int(n)//100)*100+int(n)%100+1
  elif len(n)>3:
    count+=900
    if len(n)==5:
      count+=(int(n)//10000)*10000+int(n)%10000+1
print(count)

Submission status: Wrong Answer

Solution code:
count = -1
a = int(input())
for row in range(a):
	if len(str(row)) % 2 == 0:
		pass
	else:
		count += 1
print(count)

Submission status: Wrong Answer

Solution code:
s = input()
a = int(len(s))
if a == 1:
  print(int(s[0]))
elif a == 2:
  print(9)
elif a == 3:
  print(10+int(s[1:]))
elif a == 4:
  print(909)
elif a == 5:
  print(910+int(s[1:]))
elif a == 6:
  print(90909)

Submission status: Wrong Answer

Solution code:
n = input()
keta = len(n)
N = int(n)
#print(keta)                                                                   
k = 0

if keta == 1:
    k = N
elif keta % 2 == 0:
    for i in range(keta):
        if (i+1) % 2 == 0:
            continue
        k += 9*(10**i)
    #print(int(n[0]))                                                          
else:
    for i in range(keta-1):
#        print("i = {}".format(i+1))                                           
        if (i+1) % 2 == 0:
            continue
        k += 9*(10**i)
        print(k)
    k += (N-int(n[0])*(10**(keta-1))+1)
print(k)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n>10:
    ans=9
else:
    ans=n
if n>10000:
    ans=ans+(n-9100)
elif n>100:
    ans=ans+(n-99)
print(ans)

Submission status: Wrong Answer

Solution code:
N=input()
i=int(len(N))
N=int(N)
print(N,i)
x=0
if i%2!=0:
    x=N-10**(i-1)+1
    i=i-1
    if i!=0:
        while i>0:
            i=i-2
            x=x+9*(10**i)
else:
    if N<10:
        x=N
    else:
        while i>1:
            x=x+9*(10**(i-2))
            print(i)
            i=i-2

print(x)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
a = int(input())
if a <10:
  print("{}".format(a));
if a <100:
  print("9")
elif a < 1000:
  print("{}".format(9+a-99))
elif a < 10000:
  print('909')
elif a < 100000:
  print("{}".format(909+a-9999))
else:
  print('90909')

Submission status: Wrong Answer

Solution code:
n = int(input())

one = n % 10
hund = n // 100
thou = n // 1000
cnt = 0

if  n < 10:
    cnt += n

elif 100 > n >= 10:
    cnt += 9

elif 1000 > n >= 100:
    cnt += (n - 100) + 10

elif 10000 > n >= 1000:
    cnt += 909

elif n == 10000:
    cnt += 910

elif 100000 >= n > 10000:
    cnt += (n - 10000) + 909

print(cnt)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    i = 0
    while N >0:
        n = int(str(N)[-1])
        if n % 2 != 0:
            i+=1
        N -= 1
    print(i)
main()

Submission status: Wrong Answer

Solution code:
n = input()
ans = 0
if len(n) % 2:
    ans += int(n) - 10 ** (len(n) - 1) + 1
    print(str(int('90' * ((len(n) - 3) // 2) + '9') + ans))

else:
    print(str(int('90' * ((len(n) - 2) // 2) + '9')))

Submission status: Wrong Answer

Solution code:
int_n = int(input())

n = str(int_n)

n_len = len(n)

ans = 0
tmp = 0

if n_len == 1:
    ans = int_n
else:
    for i in range(1,n_len):
        if i % 2 == 1:
            tmp = (10 ** i) - (10 ** (i-1)) - 1
            ans += tmp
    if (n_len % 2) == 1:
        tmp = int(n[1:]) + 1
        ans += tmp
    ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
#find number range

N = int(input())

range_num = 0
odd_num = 0

for i in range(7):
    if N % (10 ** i) == N:
        range_num = i
        break

if range_num == 1:
    odd_num = N
elif range_num == 2:
    odd_num = 9
elif range_num == 3:
    odd_num = N - 90
elif range_num == 4:
    odd_num = 900
elif range_num == 5:
    odd_num = N-9090
elif range_num == 6:
    odd_num = 90909
else:
    print("out of range")

print(odd_num)

Submission status: Wrong Answer

Solution code:
N = int(input())

num = [1,10,100,1000,10000, 100000]

for n in num:
    if N >= n:
        m = n


count = 0
for n in num:
    if len(str(n))%2==0: continue
    if n<m:
            if(len(str(n)))==1: count += 9
            else: count += n*10
    elif n==m:
            count+=N-m+1
            break

if N==100000: print(90909)
else: print(count)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
digit = round(math.log10(n))+1

result = 0

t = 1
while True:
    if digit < t:
        break
    elif digit == t:
        # (digit-1)桁で表現できる数
        x = int('1' + '0'*(digit-1)) - 1
        result += (n - x)
        break
    else:
        result += 9 * int('1' + '0'*(t-1))
    t += 2
print(result)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
a = int(input())
if a <10:
  print("{}".format(a));
if a <100:
  print("9")
elif a < 1000:
  print("{}".format(9+a-99))
elif a < 1000:
  print('909')
elif a < 10000:
  print("{}".format(909+a-9999))
else:
  print('90909')

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
ans = int(0)
s = math.ceil(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())

num = [1,10,100,1000,10000]

for n in num:
    if N >= n:
        m = n


count = 0
for n in num:
    if len(str(n))%2==0: continue
    if n<m:
            if(len(str(n)))==1: count += 9
            else: count += n*10
    elif n==m:
            count+=N-m+1
            break

if N==100000: print(90909)
else: print(count)

Submission status: Wrong Answer

Solution code:
import math
a = int(input())
if ((a > 0) & (a < 100000)):
    data_size = int (math.log10(a) + 1)
    if a == 100000:
        print(90909)
    elif data_size == 5:
        print(a - 10000 + 1 + 909)
    elif data_size == 4:
        print(909)
    elif data_size == 3:
        print(a - 100 + 1 + 9)
    elif data_size == 2:   
        print(9)
    elif data_size == 1:   
        print(a - 1 + 1)

Submission status: Wrong Answer

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

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(9 + 899)

# 10000番台  
elif len(s) < 6:
  print(9 - 9999 + 899  + int(s) )

# 100000番台  
elif len(s) < 7:
  print(90909)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N= int(input())

num = len(str(N))

a =N%10**(num-1)
b =N//10**(num-1)

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_+=(a+1)
    print(sum_)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
keta = round(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: Wrong Answer

Solution code:

n = int(input())
count = 0
lenn = len(str(int(n)))
if lenn == 1:
    count += n
else:
    for i in range(1,lenn+1):
        if i == 1:
            count += 9
        elif i % 2 == 0:
            pass
        elif i == lenn:
            if i % 2 == 0:
                count += ((10**i) - 1) - (10**(i-1)) +1
            else:
                count += ((10**(i - 1)) * int(str(n)[0])) - (10**(i - 1))
        else:
            count += ((10**i) - 1) - (10**(i-1)) +1

        
print(count)

Submission status: Wrong Answer

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

cnt=0
for i in range(len(s)//2):
    cnt+=9*(100**i)
if len(s)==1:
    cnt=n
elif len(s)%2==1:
    cnt+=int(s[1:])+1
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

N = int(input())

num = len(str(N))
odd = 0
for x in range(1, num):
    if x % 2 == 1:
        odd += (10 ** x)
        if x != 1:
            odd -= 10 ** (x-1)

if num % 2 == 1:
    odd += N % (10**(num-1)) + 1

odd -= 1

print(odd)

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:
a = int(input())
l = len(str(a))

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

print(ans)

Submission status: Wrong Answer

Solution code:
N= int(input())

num = len(str(N))

a =N%10**(num-1)
b =N//10**(num-1)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

num_digits = int(math.log10(N) + 1)

num = 0
if num_digits % 2 != 0:
    num += (N - (10**(num_digits-1)) + 1)
if N > 9:
    num -= 1

for i in range(num_digits-1):
    if (i + 1) % 2 != 0: #奇数
        num += 10**(i+1)       
    else:
        pass

print(num)

Submission status: Wrong Answer

Solution code:
n = int(input())

c = 0
t = n
while t // 10 != 0:
    c += 1
    t = t // 10

print(c)

ans = 0
if c == 0:
    ans = n
elif c == 1:
    ans = 9
elif c == 2:
    ans = n - 99 + 9
elif c == 3:
    ans = 909
elif c == 4:
    ans = n - 9999 + 909
else:
    ans = 90909

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0
d = 10

while True:
    if N / d >= 1:
        ans += 9 * (d / 10)
        d *= 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())

if N >=10000:
    print(90909)
elif N >=100:
    print(909)
else:
    print(9)

Submission status: Wrong Answer

Solution code:
n = int(input())
sum = 0
if n//10!=0:
  sum+=9
  if n//1000!=0:
    sum+=900
    if n//100000!=0:
      sum+=90000
    else:
      sum+=n-9999
  else:
    sum+=n-99
else:
  sum+=n
print(sum)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
digit = round(math.log10(n))+1

result = 0

t = 1
while True:
    if digit < t:
        break
    elif digit == t:
        # (digit-1)桁で表現できる数
        x =(10**(digit-1))-1
        result += (n - x)
        break
    else:
        result += int(9 * (10**(t-1)))
    t += 2
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0
if N >= 9: count += 9
else: count = N
if N >= 999: count += 9999 - 99
else: count += max(0, N - 99)
if N >= 99999: count += 99999 - 9999
else: count += max(0, N - 9999)

print(count)

Submission status: Wrong Answer

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

import math

import numpy as np


def calc(N: int) -> int:
    keta_suu = calc_ketasuu(N)

    # Nが奇数桁ならその桁の分を考慮
    max_keta_count = N - 10 ** (keta_suu - 1) if is_odd(keta_suu) else 0
    if is_odd(keta_suu) and keta_suu != 1:
        max_keta_count += 1

    # i 桁
    other_keta_count = 0
    for keta in range(keta_suu):
        if not is_odd(keta):
            continue
        other_keta_count += 10 ** keta - 10 ** (keta - 1)

    return max_keta_count + other_keta_count


def calc_ketasuu(value: int) -> int:
    return int(math.log10(value) + 1)


def is_odd(value: int) -> bool:
    return value % 2 == 1


def load_input_as_int_array() -> np.ndarray:
    return np.array([int(v) for v in input().split(" ")])


def main() -> None:
    N, = load_input_as_int_array()
    result = calc(N)
    print(result)


main()

Submission status: Wrong Answer

Solution code:
N = int(input())

lv1 = 10
lv2 = 1000

mod1 = 100
mod2 = 10000

if (N / mod1 < 1):
    if (N < lv1):
        print(N)
    else:
        print(lv1 - 1)
elif (N / mod2 < 1):
    if (N < lv2):
        print(N - (mod1 - 1) + (lv1 - 1))
    else:
        print(lv2 - mod1 + lv1 - 1)
else:
    print(N - mod2 + lv2 - mod1 + lv1 - 1)

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(9 + 900)
  
# 10000番台  
elif len(s) < 6:
  print(9 - 9999 + 899  + int(s) )
  
# 100000番台  
elif len(s) < 7:
  print(90909)

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

if (N < 10):
    answer = N

print(answer)

Submission status: Wrong Answer

Solution code:
import math
n = str(input()) 


keta = (len(n))
if (keta%2==0):
    max = int(keta/2)
else:
    max = int(keta/2)+1
count = 0
t = int(n)
if(keta%2==0):
    for i in range(1,max+1):
        count += 9*10**((2*(i-1)))
else:
    for i in range(1,max):
        print(max)
        count += 9*10**((2*(i-1)))
    t = t - 10**(keta-1)
    count += t
    count +=1
print(count)

Submission status: Wrong Answer

Solution code:
n = input()
keta = len(n)
N = int(n)
#print(keta)                                                                   
k = 0
if keta % 2 == 0:
    for i in range(keta):
        if i % 2 == 0:
            continue
        k += 9*(10**(i-1))
    #print(int(n[0]))                                                          
else:
    for i in range(keta):
        if i % 2 == 0:
            continue
        k += 9*(10**(i-1))
    k += (N-int(n[0])*(10**(keta-1))+1)
print(k)

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-n%(10**digit)
elif n<10:
  tmp = n
for i in range(1,digit+1,2):
    tmp += 9*10**(i-1)
print(tmp)

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(910)
elif X == 5:
    print(9 + 901 + (N - 10000 + 1))
elif X == 6:
    print(90909)

Submission status: Wrong Answer

Solution code:
import math


def main():
    n = int(input())
    ans = 0
    for i in range(1, n + 1):
        if math.log(i, 10) // 1 % 2 // 1 == 0:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if len == 1:
  print(n)
elif len == 2:
  print(9)
elif len == 3:
  print(n - 90)
elif len == 4:
  print(909)
elif len == 5:
  print(n - 90 - 9900)
elif len == 6:
  print(90909)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
ns = input().rstrip()
n = int(ns)
k = len(ns)
ans = 0
for i in range(0, k - 1, 2):
    ans += 9 * (10 ** i)
if k % 2 == 1 and k > 2:
    ans += n - (10 ** (k - 1)) + 1
print(ans)

Submission status: Wrong Answer

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

if C % 2 == 0:
  a ="09"
  a=a*(int(C/2))
  print(int(a))
elif C==1:
  print(int(N))
else:
  e = int(N)-10**(C-1)+1
  a = "09"
  a = a * (C-2)
  print(int(a)+e)

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:
# -*- coding: utf-8 -*-
a = int(input())
if a <=9:
  print("{}".format(a));
elif a <=99:
  print("9")
elif a < 999:
  print("{}".format(9+a-99))
elif a <= 9999:
  print('909')
else:
  print("{}".format(909+a-1000))

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 + 901 + (N - 10000 + 1))
elif X == 6:
    print(90909)

Submission status: Wrong Answer

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

n_len = len(n)

ans = 0
tmp = 0

if n_len == 1:
    ans = int_n
else:
    for i in range(1,n_len):
        if i % 2 == 1:
            tmp = (10 ** i) - (10 ** (i-1)) 
            ans += tmp
    if (n_len % 2) == 1:
        tmp = int(n[1:]) + 1
        ans += tmp

print(ans)

Submission status: Wrong Answer

Solution code:
N = input()

l = len(N)

ans = 9
if (l == 1):
  print(int(N))
elif (l == 2):
  print(ans)
else:
  for i in range(3, l + 1):
    if (i % 2 != 0):
      if (int(N) % 10**(i-1) == 0):
        if (i == l):
          ans += int(N) - 10**(i-1) + 1
        else:
          ans += 10**i - 10**(i-1)
      else:
        ans += int(N) - 10**(i-1) + 1
  print(ans)

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

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):
        ans += 9 * 10**i

    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 = 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 -= 10000
    ans += 1
    ans += 909
elif N == 6:
    ans = 90909
print(ans)

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(N-90)
elif N<10000:
  print(909)
else:
  print(909+N-10000+1)

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:
import math
a = int(input())
data_size = int (math.log10(a) + 1)
if a == 100000:
    print(90909)
elif data_size == 5:
    print(a - 10000 + 1 + 909)
elif data_size == 4:
    print(909)
elif data_size == 3:
    print(a - 100 + 1 + 9)
elif data_size == 2:   
    print(9)
elif data_size == 1:   
    print(2 - 1 + 1)

Submission status: Wrong Answer

Solution code:
num_str = input()

if len(num_str) == 2:
  odd_num = 9
elif len(num_str) == 3:
  odd_num = 9 + (int(num_str) - 99)
elif len(num_str) == 4:
  odd_num = 909
elif len(num_str) == 5:
  odd_num = 909 + (int(num_str) - 9999)
else:
  odd_num = 90909
  
print(odd_num)

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 ** (n-2))) + 1
    print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
i = 0
ans = 0
if n < 10:
    print(n-1)
    exit()
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 = input()
if len(N) == 1:
    print(N)
elif len(N) == 2:
    print(9)
elif len(N) == 3:
    print(9 + int(N) - 99)
elif len(N) == 4:
    print(9 + 900)
elif len(N) == 5:
    print(9 + 900 + 10000*int(N[0]) - 10000 + int(N[1:]))
elif len(N) == 6:
    print(9 + 900 + 90000)

Submission status: Wrong Answer

Solution code:
n = int(input())
numarr = [9 * 10 ** i for i in range(10)]
res = 0

for i, num in enumerate(numarr):
    if num >= n:
        res += sum(numarr[0:i:2])
        if i % 2 == 0:
            x = sum(numarr[0:i])
            res += (n - x)
        break

print(res)

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
if n < 10:
    print(n)
elif n >= 10 and n < 100:
    print(n)
elif n >=100 and n < 1000:
    print(9 + n - 100 + 1)
elif n >=1000 and n < 10000:
    print(909)
elif n >= 10000 and n < 100000:
    print(n - 9090)
elif n == 100000:
    print(90909)

Submission status: Wrong Answer

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

count = 0
while(n1 > 0):
    n1 = n1 // 10
    count = count + 1

if count == 1:
    print(n)
elif count == 2:
    print(9)
elif count == 3:
    print(9 + (n - 100) + 1)
elif count == 4:
    print(909)
elif count == 5:
    print(908 + (n - 10000) + 1)
else:
    print(90909)

Submission status: Wrong Answer

Solution code:
N = int(input())

cnt = 0
for i in range(1,N):
  t = int(i / 100)
  if t % 2 == 1 or i < 10:
    cnt += 1

print (cnt)

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

Submission status: Wrong Answer

Solution code:
N=input()
n=len(N)
n=int(n)
num=0
num1=1
for i in range(n):
    if(i%2==0):
        if(i>1):
            for k in range(i):
                num1=num1*10
        num+=9*num1

print(num)

Submission status: Wrong Answer

Solution code:
s = int(input())

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

Submission status: Wrong Answer

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

number = int(input())
count = 0

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

Submission status: Wrong Answer

Solution code:
N = int(input())

import math
order = int(math.log10(int(N)))
ans = 0

for i in range(order):
    if (i % 2) == 0:
        ans += 9 * 10 ** i

print(order)
if (order % 2) == 0:
    a = N - 10 ** order
    ans += a + 1 

print(ans)

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

Submission status: Wrong Answer

Solution code:
n = int(input())

if n<=9:
    print(n)
elif n<=99:
    print(9)
elif n<=999:
    s=9+n%100+1
    print(9+n%100+1)
elif n<=9999:
    print(909)
elif n<=99999:
    print(909+n%10000+1)
else:
    print(90909)

Submission status: Wrong Answer

Solution code:
N = int(input())
l = len(str(N))
if l == 1:
  print(N)
elif 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())

c = 0

for i in range(6):
    if N >= 10 ** i:
        if i % 2 == 1:
            c += 9 * (10 ** (i - 1))
            print(c)
    else:
        if i % 2 == 1:
            c += N - (10 ** (i - 1)) + 1
            print(c)
        break

print(c)

Submission status: Wrong Answer

Solution code:
N=input()
n=len(N)
n=int(n)
num=0
num1=1
for i in range(n):
    print(i)
    if(i%2==0):
        if(i>1):
            for k in range(i):
                num1=num1*10
        num+=9*num1

print(num)

Submission status: Wrong Answer

Solution code:
N = int(input())

lv1 = 10
lv2 = 1000

mod1 = 100
mod2 = 10000

if (N / mod1 < 1):
    if (N <= lv1):
        print(N)
    else:
        print(lv1 - 1)
elif (N / mod2 < 1):
    if (N <= lv2):
        print(N - mod1 + lv1)
    else:
        print(lv2 - mod1 + lv1 - 1)
else:
    print(N - mod2 + lv2 - mod1 + lv1 - 1)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N == 10**5:
    print(90909)
elif N > 10**4:
    print(9+len(range(10**2, 10**3))+len(range(10**4, N+1)))
elif N > 10**3:
    print(9+len(range(10**2, 10**3)))
elif N > 10**2:
    print(9+len(range(10**2, N+1)))
elif N > 10:
    print(9)
elif N > 0:
    print(N)

Submission status: Wrong Answer

Solution code:
n = input()

l = len(n)

ans = 0
j = 1
for i in range(1, l, 2):
    ans += 9 * j
    j *= 100

if l % 2 == 0:
    print(ans)
else:
    ans += (int(n[0]) - 1) * j
    if l != 1:
        ans += int(n[1:]) + 1
    print(ans)

Submission status: Wrong Answer

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

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

if n == 10**5:
    print(sum(levels))
if len(n_) == 5:
    print(sum(levels[:4]) + n - 100 + 1)
if len(n_) == 4:
    print(sum(levels[:3]))
if len(n_) == 3:
    print(sum(levels[:2]) + n - 100 + 1)
if len(n_) == 2:
    print(sum(levels[:1]))
if len(n_) == 1:
    print(n - 10 + 1)

Submission status: Wrong Answer

Solution code:

n = int(input())
count = 0
lenn = len(str(int(n)))
if lenn == 1:
    count += n
else:
    for i in range(1,lenn+1):
        if i == 1:
            count += 9
        elif i % 2 == 0:
            pass
        elif i == lenn:
            count += int(str(n)[-i+1:]) + 1
        else:
            count += ((10**i) - 1) - (10**(i-1)) +1

        
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0

if N <= 9:
  print(N)
else:
  for i in range(1, N+1, 1):
    i_str = str(i)
    if (len(i_str)%2) != 0:
        count = count + 1
print(count)

Submission status: Wrong Answer

Solution code:
s = int(input())

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

Submission status: Wrong Answer

Solution code:
s = int(input())
count = 0
for i in range(s):
  g = str(i)
  a = len(g)
  if a % 2 != 0:
    count += 1
print(count-1)

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
                    if N // 100000 >= 10:
                        if N // 10000 >= 10:
                            # 7桁以上
                            v += 9000000

                        else:
                            # 6桁
                            v += N % 1000000 + 1
                else:
                    # 4桁
                    v += N % 10000 + 1
        else:
            # 3桁
            v += N % 100 + 1

else:
    # 1桁
    v += N % 10

print(v)

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(9 + 899)
  
# 10000番台  
elif len(s) < 6:
  print(9 - 9999 + int(s))
  
# 100000番台  
elif len(s) < 7:
  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):
    tmp += 9*10**(i-1)
print(tmp)

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(N-90)
elif N<10000:
  print(9999-90-90000)
else:
  print(N-90-90000)