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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())

while(n%10==0):
	n//=10
    
k=str(n)
ans=0

for i in range(1,len(k),2):
	ans+=i*9 
    
if(len(k)%2==1):
	m=n//pow(10,len(n)-1)
	ans+=m-1

print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
s=len(str(n))
if s%2==0:
    s=s-1
    x=''
    for i in range(s-1):
        if i%2==0:
            x+='9'
        else:
            x+='0'
    x+='9'
    print(x)
else:
    z=s-2
    x = ''
    for i in range(z - 1):
        if i % 2 == 0:
            x += '9'
        else:
            x += '0'
    x += '9'
    x=int(x)
    x+=n-int('9'*(z+1))
    print(x)

Submission status: Runtime Error

Solution code:
m = input()

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

Submission status: Runtime Error

Solution code:
n = int(input())

if len(str(n)) % 2 == 0:
  print(int("90" * int(len(str(n)) / 2 - 1) + "9"))
else:
  print(n - int("9" * (len(str(n)) -1)) + int("90" * (int((len(str(n)) - 1) / 2) - 1) + "9"))

Submission status: Runtime Error

Solution code:
N = int(input())
if len(str(N)) ==1:
  print(N)
else:
  ketas = list(range(1,len(str(N)),2))
  res = sum([9*pow(10,k-1) for k in ketas])
  if len(str(N))%2 ==1:
    res += N - pow(10,len(str(N))-1) + 1
print(res)

Submission status: Runtime Error

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[1:])+1 + (int(i[0])-1)*10**(len(i)-1)
	print(acc+addition)

Submission status: Runtime Error

Solution code:
N = input().strip()
total = 0
for i in range(1, len(N), 2):
    total += 10**i - 10**(i-1)
if len(N) % 2 == 0:
    pass
else:
    total += int(N[1:])+1
print(total)

Submission status: Runtime Error

Solution code:
N = int(input())

N_str = str(N)

N_length = len(N_str)
tmp_str = ""
ans = 0

if N_length%2 == 1:
  for i in range(len(N_str)-1):
    if i%2 == 0:
      tmp_str+="0"
    else:
      tmp_str+="9"
  if N_length-1 != 0:
    ans += N - (10 ** (N_length-1))
  else:
    ans += N
else:
  for i in range(len(N_str)-1):
    if i%2 == 0:
      tmp_str+="9"
    else:
      tmp_str+="0"

print(ans + int(tmp_str))

Submission status: Runtime Error

Solution code:
a = int(input())
i = 1
cnt = 0
while i <= a:
  if len(i)%2 == 1:
    cnt += 1
  i += 1

print("{}".format(cnt))

Submission status: Runtime Error

Solution code:
n=int(input())

count_1=9
count_3=900
count_5=90000

count=0

if n = 100000:
  count+=90909

if 10000 <= n and n < 100000:
  m=n-9999
  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: Runtime Error

Solution code:
N = int(input())
if len(str(N)) ==1:
  print(N)
else:
  ketas = list(range(1,len(str(N)),2))
  res = sum([9*pow(10,k-1) for k in ketas])
  if len(str(N))%2 ==1:
    res += N - pow(10,len(str(N))-1) + 1
print(res)

Submission status: Runtime Error

Solution code:
N = list(map(int,input().split()))

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
a = int(input())
if a <=9:
  print("{}".format(a));
  return
if a <=99:
  print('9')
  return;
if a < 999:
  print("{}".format(9+a-99))
  return
if a <= 9999:
  print('909')
  return
print("{}".format(909+a-9999))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
l = int(input())
if l <=9:
  print("{}".format(a));
  return
if l <=99:
  print('9')
  return;
if l < 999:
  print("{}".format(9+a-99))
  return
if l <= 9999:
  print('909')
  return
print("{}".format(909+a-9999))

Submission status: Runtime Error

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


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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
a = int(input())
if l <=9:
  print("{}".format(a));
  return
if l <=99:
  print('9')
  return;
if l < 999:
  print("{}".format(9+a-99))
  return
if l <= 9999:
  print('909')
  return
print("{}".format(909+a-9999))

Submission status: Runtime Error

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

print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
kotae = 0
if n == 100000:
  kotae = 90909
elif n => 10000:
  kotae = 909 + (n - 10000 + 1)
elif n => 1000:
  kotae = 909
elif n => 100:
  kotae = 9 + (n- 100 +1)
elif n => 10:
  kotae = 9
else:
  kotae = n

Submission status: Runtime Error

Solution code:
i = input()

if int(i) < 0:
  print("0")
else:

  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[1:])+1
    print(acc+addition)

Submission status: Runtime Error

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
    ans += int(n[1:]) + 1
    print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
i = input()

if int(i)<0:
 	print("0")
else:
	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[1:])+1
		print(acc+addition)

Submission status: Runtime Error

Solution code:
n = input()
ans = 0
if len(n) % 2 == 0:
    length = len(n) - 1
    for i in range(length, -1, -2):
        if i == 1:
            ans += 9
        else:
            plus = '9' * i
            minus = '9' * (i - 1)
            ans += (int(plus) - int(minus))
    print(ans)
else:
    length = len(n)
    ans += (int(n[1:])+1)
    for i in range(length-2, -1, -2):
        if i == 1:
            ans += 9
        else:
            plus = '9' * i
            minus = '9' * (i-1)
            ans += (int(plus) - int(minus))
    print(ans)

Submission status: Runtime Error

Solution code:
A = int(input())

count =  0

if A<10:
    count= A
elif A <100:
    count = 9 
elif A < 1000:
    count = 9 + A - 99
elif A < 10000:
    count = 9 + 900
elif A < 100000:
    count = 9 + 900 + (A-9999)
elif A =100000:
    count = 90909
else:
    

print(count)

Submission status: Runtime Error

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: Runtime Error

Solution code:
N=int(input())
import math
if 0<=math.log10(N)<1:
  print(N)
elif 1<=math.log10(N)<2:
  print(9)
elif 2<=math.log10(N)<3:
  print(N-90)
elif 3<=math.log10(N)<4:
  print(909)
elif 4<=math.log10(N)<5:
  print(N-9090)
elif:
  print(90909)

Submission status: Runtime Error

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

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    str_n = str(N)
    len_n = len(str_n)
    s = N - int('9' * (len_n - 1)) if len_n % 2 else 0
    for i in range(1, len_n, 2):
        s += 9 * 10**(i - 1)
    print(s)
    return

main()

Submission status: Runtime Error

Solution code:
n = int(input())
t = n
c = 0
while t > 0:
    t //= 10
    c += 1
ans = 0
for i in range(1, c+1, 2):
    if i == c:
        tmp = int(str(n)[1:])
        ans += (tmp + 1)
    else:
        ans += (10**i - 10**(i-1))
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
if len(str(n)) == 6:
    print(90909)
elif len(str(n)) == 4:
    print(909)
elif len(str(n)) == 2:
    print(9)
elif len(str(n)) == 1:
    print(n)
elif len(str(n)) == 3:
    print(9 + (n - 100) + 1)
elif len(str(n)) == 5:
    print(9 + 900 + (n - 10000) + 1)

Submission status: Runtime Error

Solution code:
i = input()

if int(i)<0:
  print("0")
  return

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[1:])+1
  print(acc+addition)

Submission status: Runtime Error

Solution code:
N = int(input())
n = N
cnt = 0
while n>0:
  n = n//10
  cnt += 1

tmp = "90"*(cnt//2)
tmp = int(tmp[:-1])

if cnt%2!=0:
  tmp += N-int("9"*(cnt-1))

print(tmp)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
i = input()

if int(i)<0:
  print("0")

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[1:])+1
  print(acc+addition)

Submission status: Runtime Error

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

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

number = int(N)
if i%2 == 1:
    count += number + 1 - 10**(last+1)
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

i=1
x = 0

while True:
    m = 10 ** i - 1
    if N <= m:
      x += (N - (10 ** (i-1) - 1))
      break
	x += m
print(x)

Submission status: Runtime Error

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

ans = 0
for i in range(o):
    if i % 2 == 0:
        continue
    ans += hoge(i)

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
if 0<N<10:
  num = N

if 10=<N<100:
  num = 9

if 100=<N<1000:
  num = 9 + N - 99
  
if 1000=<N<10000:
  num = 9 + 900

if 10000=<N<100000:
  num = 909 + N - 9999

if N==100000:
  num=909+90000
  
print(num)

Submission status: Runtime Error

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[1:])+1
  print(acc+addition)

Submission status: Runtime Error

Solution code:
#
# Yet I'm feeling like
# 	There is no better place than right by your side
# 		I had a little taste
# 			And I'll only spoil the party anyway
# 				'Cause all the girls are looking fine
# 					But you're the only one on my mind


import sys
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()


inf = float("inf")
#sys.setrecursionlimit(1000000)


# abc='abcdefghijklmnopqrstuvwxyz'
# abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod,MOD=1000000007,998244353
# vow=['a','e','i','o','u']
# dx,dy=[-1,1,0,0],[0,0,1,-1]

#from cmath import sqrt
#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
from math import ceil,floor,log,sqrt,factorial,pow,pi,gcd,log10
#from bisect import bisect_left,bisect_right
#import numpy as np


n=int(input())
count=0
for i in range(1,n+1):
    z=int(log10(i))+1
    if z&1:
       count+=1
print(count)

Submission status: Runtime Error

Solution code:
import sys, math
from collections import deque

readline = sys.stdin.readline

A = int(readline())

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

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

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

print(count)

Submission status: Runtime Error

Solution code:
n = int(n)

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

Submission status: Runtime Error

Solution code:
def func(len_a):
    ans = ""
    for i in range(1, len_a):
        if i & 1 == 0:
            ans += "0"
        elif i & 1 == 1:
            ans += "9"
    return ans

def main():
    a = input()
    len_a = len(a)
    if len_a & 1 == 0:
        ans = func(len_a)
        print(ans)
    else:
        ans = int(func(len_a-1))
        ans = ans + ( int(a) - 10 ** (len_a-1) ) + 1
        print(ans)


main()

Submission status: Runtime Error

Solution code:
a = input()

if len(a)==5:
    b = int(a)
    c = b - 9999 + 9 + 1000
elif len(a)==4:
    b = int(a)
    c = 9 + 1000
elif len(a)==3:
    b = int(a)
    c = b - 99 + 9
elif len(a)==2:
    b = int(a)
    c = 9
elif len(a)==1:
    b = int(a)
    c = b
print(c)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
nm = N//10
sum = 0
for i range(nm):
    if N%2 ==0:
        sum += (10**i-1)
if nm%2 != 0:
    sum += N-(10**nm)+1

Submission status: Runtime Error

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

if keta == 1:
    print(n)
elif keta == 2:
    print(9)
elif keta == 3:
    print(n - 90 + 9)
elif keta == 4:
    print(909)
elif keta == 5:
    print(n - 9000 + 900 - 90 + 9)
else:
    print(90909)

Submission status: Runtime Error

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[1:])+1

print(tmp)

Submission status: Runtime Error

Solution code:
i = input()

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

if len(i)%2==0:
  print(acc)
else:
  addition = int(i[1:])+1
  print(acc+addition)

Submission status: Runtime Error

Solution code:
if n1 < 10:
    print(n1)
elif n1 <= 99:
    print(9)
elif n1 < 1000:
    print(9 + (n1 - 99))
elif n1 <= 9999:
    print(909)
elif n1 < 100000:
    print(909 + (n1 - 999))
else:
    print(90909)

Submission status: Runtime Error

Solution code:
n = int(input())
def numOfDigits(num):
    return len(str(num))
ans += 1
while n > 0:
    if numOfDigits(n)%2 == 1:
        ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

length = len(str(N))

ans=0
for i in range(1, length + 1, 2):
    if i != length:
        ans += 10 ** i -(10**(i-1))
    else:
        ans += int(str(N)[1:]) + 1


print(ans)

Submission status: Runtime Error

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


for i in range(1,lenN,2):
    ans+=10**i*9//10
    #print(ans)

if lenN%2==1:
    ans+=int(N[1:])+1
    
print(ans)
    
    


#0をひかない

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
l = len(str(N))
ans = 0

if l%2 == 0:
    for i in range(0, l, 2):
        ans += 9*(10**i)
else:
    for i in range(0,l-2, 2):
        ans += 9*(10**i)
        #print(ans)
    ans += N - int('9'*(len(str(N))-1))

print(ans)
#print(l)

Submission status: Runtime Error

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

print(count)

Submission status: Runtime Error

Solution code:
import os,re
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations
from sys import stdin,setrecursionlimit
from copy import deepcopy
import pysnooper
setrecursionlimit(10**6)

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

Submission status: Runtime Error

Solution code:
n = input()

s = len(n)

ans = 0

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

m = n[1:]

if s %2 != 0:
    ans += int(m)+1

print(ans)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <cmath>

int main(void){
  int n;
  std::cin >> n;

  int count = 0;
  for(int i=1; i<=n; i++){
    if(((int) std::log10(i) + 1) % 2){
      count++;
    }
  }
  std::cout << count << std::endl;
  return 0;

}

Submission status: Runtime Error

Solution code:
def int_multiple():
    return  [int(c) for c in input().split()]

def int_single():
    return int(input())

def str_multiple():
    return [c for c in input().split()]

def str_single():
    return input()

# start

n = int_single()

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

print(res)

Submission status: Runtime Error

Solution code:
N = int(input())

count = 0
for i in range(1,N+1):
  a = [_ for _ in str(i)]
  if len(a)%2=1:
    count += 1

print(count)

Submission status: Runtime Error

Solution code:
N = int(input())

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

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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