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

x=0
if n1=1:
  x=n
elif n1=2:
  x=9
elif n1=3:
  x=9+(n-99)
elif n1=4:
  x=9+90
elif n1=5:
  x=9+900+(n-999)
elif n1=6:
  x=9+900+90000
  
print(x)

Submission status: Runtime Error

Solution code:
n=int(input())
n1=len([i for i in str(n)])

x=0
if n1=1:
  x=n
elif n1=2:
  x=9
elif n1=3:
  x=9+(n-99)
elif n1=4:
  x=9+90
elif n1=5:
  x=9+900+(n-999)
elif n1=6:
  x=9+900+90000
  
print(x)

Submission status: Runtime Error

Solution code:
n=int(input())
n1=[int(i) for i in str(n)]
n2=len(n1)

x=0
if n1=1:
  x=n
elif n1=2:
  x=9
elif n1=3:
  x=9+(n-99)
elif n1=4:
  x=9+900
elif n1=5:
  x=9+900+(n-999)
  
print(x)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = str(input())
a = 0
for dig in range(0, len(n)-1, 2):
    a = a + 9*(10**dig)

if len(n)%2:
    a = a + int(n[1:]) + 1

print(a)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
num = int(input())
num_digit = len(str(num))

if num_digit == 1:
    print(0)
elif num_digit == 2:
    print(9)
elif num_digit == 3:
    print(9 + (num - 100 + 1))
elif num_digit == 4:
    print(909)
elif num_digit == 5:
    print(909 + (num - 10000 + 1))

Submission status: Runtime Error

Solution code:
n = int(raw_input())

#整数をばらけさせてリスト化
list_n = list(range(1,n+1))
print(list_n)

#桁の長さが奇数なら数え上げる
cnt = 0
for i in list_n:
     if (len(str(i)))%2 == 1:
            cnt += 1
     else: pass
print(cnt)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
i = input()
n = len(i)
ans = 0
for j in range(n + 1):
  if j == n and j % 2:
    ans += int(i) - int(str(9) * (j - 1))
  elif j % 2 == 1:
    ans += 10 ** j - int(str(9) * (j - 1)) - 1
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
dig=len(str(N))
digr=dig-(dig%2)-2
intr=sum([10**i for i in range(0, digr+1,2)])*9
if (dig % 2):
    intr=intr+N-10**(dig-1)+1

print(intr+ad)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
h = list[map(int, input().split())]
 
is_ok = True
 
for num, i in enumerate(h):
  if is_ok:
    if h[num] - h[num+1] >= 2:
      is_ok = False
  else:
    break
    
if is_ok:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
N=int(input())
if N = 10**5:
  print("90909")
elif N >= 10**4:
  resid=N-10**4+1
  print(str(9+900+resid))
elif N >= 10**3:
  print("990")
elif N >= 10**2:
  resid=N-10**2+1
  print(str(9+resid))
elif N >= 10:
  print("9")
else:
  print(str(N))

Submission status: Runtime Error

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

print(c)

Submission status: Runtime Error

Solution code:
a = map(int,input().split())
unchi = 0
while a>=1:
    a -=1
    if 99999 >= a >= 10000:
        unchi += 1
    elif 999 >= a >= 100:
        unchi += 1
    elif 9 >= a >= 1:
        unchi += 1
print(unchi)

Submission status: Runtime Error

Solution code:
s = int(input())

if s < 100:
  print(s)
else if s < 1000:
  print(9+s)
else if s < 100000:
  print(908+s)

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 0
for i in range(1, n + 1):
	cnt = 1
    while True:
  		n //= 10
  		cnt += 1
  		if n < 10:
    		break
	if n % 2 != 0:
      ans += 1
print(ans)

Submission status: Runtime Error

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

print(ans)

Submission status: Runtime Error

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(910)
elif a < 100000:
  print(a - 90 - 9000)
elif a = 100000:
  print(90909)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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__":
    main1()

Submission status: Runtime Error

Solution code:
n = int(input())

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

print(count)

Submission status: Runtime Error

Solution code:
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(n)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Solution code:
intCount = 0

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

print(intCount)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Solution code:
import math
def main():
	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
	aaa=result-1
	print(aaa)
main()

Submission status: Runtime Error

Solution code:
s = len(input().split())
N = int(input())

if s < 2:
  print(N)
elif s < 3:
  print(9)
elif s < 4:
  print(N - 90)
elif s < 5:
  print(909)
elif s < 6:
  print(N - 9090)
else:
  print(90909)

Submission status: Runtime Error

Solution code:
n = str(input())

N = int(len(n))
result = 0

if N == 1:
    result = n
elif N % 2 != 0:
    result += (int(n) - (10 ** (N-1))) + 1
    count = 0
    for i in range(N // 2):
        count += 1 
        a = "9" * count
        result += int(a)
else:
    for i in range(N // 2):
        count += 1 
        a = "9" * count
        result += int(a)

print(result)

Submission status: Runtime Error

Solution code:
str = input()
num = int(str)
numbers = len(str)
print(numbers)
con = 0
a = str[-6:0]
str = input()
num = int(str)
const = len(str)
numbers = len(str)
even = 0
con = 0
a = str[even:const]
b = int(a)
if numbers%2==1:
    pass
else:
    even += 1
    numbers -= 1
    a = str[even:const]
    b = int("9"*(numbers))
while numbers>0:
    con += (b - 10**(numbers-1) + 1)
    even += 2
    numbers -= 2
    if numbers>0:
        a = str[even:const]
        b = int("9"*(numbers))
print(con)

Submission status: Runtime Error

Solution code:
n=int(input())
n_d=len(str(n))
ans=1
for i in range(1,n,2):
	part1=9
	part2=10**i
	total=part1*part2
	total/=10
	ans+=total
part1=10**n
part2=n-part1
ans+=(part2+1)
print(ans)

Submission status: Runtime Error

Solution code:
N = map(int,input())
if N==100000:
  print(90909)
if N>=10000:
  print(909+N-9999)
if N>=1000:
  print(909)
if N>=100:
  print(9+N-99)
if N>=10:
  print(9)
else:
  print(N)

Submission status: Runtime Error

Solution code:
N = map(int,input())
if N==10^5:
  print(90909)
if N>=10^4:
  print(909+N-9999)
if N>=10^3:
  print(909)
if N>=10^2:
  print(9+N-99)
if N>=10:
  print(9)
else:
  print(N)

Submission status: Runtime Error

Solution code:
N = map(int,input().split())
if N==10^5:
  print(90909)
if N>=10^4:
  print(909+N-9999)
if N>=10^3:
  print(909)
if N>=10^2:
  print(9+N-99)
if N>=10:
  print(9)
else:
  print(N)

Submission status: Runtime Error

Solution code:
keta = (len(n))
max = int(keta/2)+1

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=input()
ans=0

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

Submission status: Runtime Error

Solution code:
N=input()
ans=0

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

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(4100000)
a = str(input())
a = a
length = len(a)
b = len(a)
ans = 0
for i in reversed(range(1,b+1)):
    if i%2 == 1 and i == b:
        temp = ""
        for k in range(i-1):
            temp += "9"
        ans += int(a[b-i:]) - int(temp)

    elif i%2 == 1:
        temp = 9*10**(i)//10

        ans += temp
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N = input()
if N < 10:
  print(N)
else:
  if 9 < N < 100:
    print("9")
  else:
    if 99 < N < 1000:
      print(N - 90)
    else:
      if 999 < N < 10000:
        print("909")
      else:
        if 9999 < N < 100000:
          print(909 +  N - 9999)
        else:
          if N = 100000:
            print("90909")

Submission status: Runtime Error

Solution code:
n = int(input())
a = len(str(n))
b = 0
j = 2*i
if a%2 == 0:
    for j in range(a//2):
        b += 10**(2*j+1)-10**(2*j)
    print(b)
else:
    for j in range(a//2):
        b += 10**(2*j+1)
    print(n-10**(a-1)+b)

Submission status: Runtime Error

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

if len(N) % 2 != 0:
    ans += ans * (int(N[0]) - 1)
    ans += int(N[1:]) + 1

print(ans)

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)
else n<100000:
  print(n-9090)
else:
  print(90909)

Submission status: Runtime Error

Solution code:
n = int(input())
n = int(x)
s = str(int(x))
s = s.rjust(6, '0')
l = len(str(n))

r = 0

if l == 1:
    r = r +int(s[5:])
else:
    if l > 4:
        r = r + n - 10000
    if l > 2:
        if l > 3 or s[3:] == "000":
            r = r + 900
        else:
            r = r + int(s[3:]) - 100
    if l > 1:
            r = r + 9  

print(r)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline


def main():
    n = str(input()).replace("\n", "")

    count = 0
    for i in range(len(n), 0, -1):
        if i % 2 != 0:
            if i == len(n):
                count += int(n[1:]) + 1
            else:
                s = str(i) + "0"
                count += int(s) - 1

    print(count)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N = input()

tmp = len(N)

ans = 0
for i in range(tmp):
    if i&1 == 1:
        ans += 10**(i) - 10**(i-1)
    elif i == tmp-1:
        ans += int(N[1:]) + 1

# if N[0] == "1" and N[1:]
print(ans)

Submission status: Runtime Error

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 - 99) + 9

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

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

elif n = 100000:
    cnt += 90909

print(cnt)

Submission status: Runtime Error

Solution code:
N = int(input())

num = 0
for i in range(len(str(num)):
  o = 10 ** (i+1)
  if N > o:
    num += (o - 10**i)
  else:
    if i % 2 == 1:
      num += N % o
print(num)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())

    ans = 0
    for i in range(len(str(N))):
        if len(str(N)) != i+1:
            if i % 2 == 0:
                ans += 9*(10**i)
        else:
            if i % 2 == 0:
                ans += int(str(N)[1:])+1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
N=int(input())
a=0
for i in range(N):
  if i//10==0:
    a+=1
  elif i//100:
  elif i//1000:
    a+=1
  elif i//10000:
  else:
    a+=1
print(a)

Submission status: Runtime Error

Solution code:
N = int(input())

def count(start, end):
  return end - start + 1

keta = 1
while True:
  if 10**keta > N:
    break
  else:
  	keta += 1

num = 0
for k in range(1, keta+1):
  if k % 2 == 1:
	num += count(10**(k-1), min(N, 10**k)-1)
    
print(num)

Submission status: Runtime Error

Solution code:
n = input()

count = 0

l = len(n)

if l % 2:
  num = n[1:l]
  count += int(num) + 1
  l -= 1

for i in range(l):
  tmp = 1
  if (i+1) % 2:
    for j in range(i+1):
      tmp *= 10
    tmp -= int(float(tmp) / float(10))
    count += tmp
    
print(count)

Submission status: Runtime Error

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

# print(l)
temp=''
ans=0

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

	if l%2==1:
		ans+=(int(n)-int('9'*(l-1)))

print(ans)

Submission status: Runtime Error

Solution code:
n = input()

count = 0

l = len(n)


if l % 2:
  num = n[1:l]
  count += int(num) + 1
  l -= 1

for i in range(l):
  tmp = 1
  if (i+1) % 2:
    for j in range(i+1):
      tmp *= 10
    tmp -= float(tmp) / float(10)
    count += tmp
    
print(int(count))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n = input()

count = 0

l = len(n)

#kisu
if l % 2:
  num = n[1:l]
  count += int(num) + 1
  l -= 1
#gusu
for i in range(l):
  tmp = 1
  if (i+1) % 2:
    for j in range(i+1):
      tmp *= 10
    tmp -= float(tmp) / float(10)
    count += tmp
    
print(int(count))

Submission status: Runtime Error

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

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

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

print(count)

Submission status: Runtime Error

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

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

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

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

print(count)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
// おまじない
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
// alias
#define gcd __gcd
#define pb push_back
#define all(x) (x).begin(), (x).end()
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
template<class T>
int lb(vector<T>& x,T n){return lower_bound(all(x) , n) - x.begin();}
template<class T>
int ub(vector<T>& x,T n){return upper_bound(all(x) , n) - x.begin();}
// for
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
// 入力
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
// 出力
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
// デバッグ出力
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
// 脳死
#define YN(x) out((x) ? "YES" : "NO"), indent()
#define Yn(x) out((x) ? "Yes" : "No"), indent()
#define yn(x) out((x) ? "yes" : "no"), indent()
// const
int INF = 1e18, MOD = 1e9 + 7;
double EPS = 1e-15, PI = acos(-1);
int dx[] = {0, 0, 1, 0, -1, -1, 1, 1, -1}, dy[] = {0, -1, 0, 1, 0, -1, -1, 1, 1};
// 数学的な
int lcm(int a, int b){return a / gcd(a, b) * b;}
int factorial(int a){return a < 2 ? 1 : factorial(a - 1) * a;}
int summation(int a){return a < 1 ? 0 : (a * a + a) / 2;}
int combination(int n, int r){ int res = 1; rep(i, 1, r + 1){ res *= n--, res /= i; } return res; }
bool isPrime(int n){ rep(i, 2, sqrt(n) + 1){ if(i > 3){ i++; } if(!(n % i)){ return false; } } return true; }
vector<int> divisor(int n){ vector<int> ans; rep(i, 1, sqrt(n) + 1){ if(!(n % i)){ ans.pb(i); if(i * i < n){ ans.pb(n / i); } } } return ans; }
map<int, int> factorization(int n){ map<int, int> ans; rep(i, 2, sqrt(n) + 1){ if(i > 3){ i++; } while(!(n%i)){ ans[i]++, n /= i; } } if(n > 1){ ans[n]++; } return ans; }
// MOD int
int extgcd(int a, int b, int &x, int &y){ int g = a; x = 1, y = 0; if(b){ g = extgcd(b, a % b, y, x); y -= a / b * x; } return g; }
int invmod(int a, int m = MOD){ int x = 0, y = 0; extgcd(a, m, x, y); return (x + m) % m; }
struct mint{
    int _num;
    mint(int x = 0) : _num(){ _num = x % MOD; if(_num < 0){ _num += MOD; } }
    inline mint operator = (int x){ _num = x % MOD; if(_num < 0){ _num += MOD; } return *this; }
    inline mint operator = (mint x){ _num = x._num; return *this; }
    inline mint operator + (int x){ return mint(_num + x); }
    inline mint operator + (mint x){ int a = _num + x._num; if(a >= MOD){ a -= MOD; } return mint{a}; }
    inline mint operator += (int x){ _num += x; _num %= MOD; if(_num < 0){ _num += MOD; } return *this; }
    inline mint operator += (mint x){ _num += x._num; if(_num >= MOD){ _num -= MOD; } return *this; }
    inline mint operator ++ (){ _num++; if(_num == MOD){ _num = 0; } return *this; }
    inline mint operator - (int x){ return mint(_num - x); }
    inline mint operator - (mint x){ int a = _num - x._num; if(a < 0){ a += MOD; } return mint{a}; }
    inline mint operator -= (int x){ _num -= x; _num %= MOD; if(_num < 0){ _num += MOD; } return *this; }
    inline mint operator -= (mint x){ _num -= x._num; if(_num < 0){ _num += MOD; } return *this; }
    inline mint operator -- (){ _num--; if(_num == -1){ _num = MOD - 1; } return *this; }
    inline mint operator * (int x){ return mint(_num * (x % MOD)); }
    inline mint operator * (mint x){ return mint{_num * x._num % MOD}; }
    inline mint operator *= (int x){ _num *= mint(x); _num %= MOD; return *this; }
    inline mint operator *= (mint x){ _num *= x._num; _num %= MOD; return *this; }
    inline mint operator / (int x){ return mint(_num * invmod(mint(x), MOD)); }
    inline mint operator / (mint x){ return mint{_num * invmod(x._num, MOD) % MOD}; }
    inline mint operator /= (int x){ _num *= invmod(mint(x), MOD); _num %= MOD; return *this; }
    inline mint operator /= (mint x){ _num *= invmod(x._num, MOD); _num %= MOD; return *this; }
    inline mint pow(int x){ mint ans = 1, cnt = *this; for(int i = 1; i < x + 1; i *= 2){ if(x & i){ ans *= cnt; x ^= i; } cnt *= cnt; } return ans; }
    inline operator int() { return _num; }
};
vector<mint> fac(1, 1), inv(1, 1);
void reserve(int a){
    if(fac.size() >= a) return;
    if(a < fac.size() * 2) a = fac.size() * 2;
    if(a >= MOD) a = MOD;
    while(fac.size() < a) fac.push_back(fac.back() * (int)(fac.size()));
    inv.resize(fac.size());
    inv.back() = mint(1) / fac.back();
    for(int i = inv.size() - 1; !inv[i - 1]; i--) inv[i - 1] = inv[i] * i;
}
mint fact(int n){ if(n < 0) return 0; reserve(n + 1); return fac[n]; }
mint perm(int n, int r){ if(r < 0 || n < r) return 0; reserve(n + 1); return fac[n] * inv[n - r]; }
mint comb(int n, int r){ if(r < 0 || n < r) return 0; reserve(n + 1); return fac[n] * inv[r] * inv[n - r]; }
mint mcomb(int n, int r){ return comb(n + r - 1, n - 1); } // r個をn部屋に分ける
// UnionFind
struct UF{
    vector<int> t;
    UF(int size): t(size, -1){}
    int root(int x){return t[x] < 0 ? x : t[x] = root(t[x]);}
    int size(int x){return -t[root(x)];}
    bool isSame(int x, int y){return root(x) == root(y);}
    bool unite(int x, int y){
        x = root(x), y = root(y);
        if(x != y){
            if(t[y] < t[x]){
                swap(x, y);
            }
            t[x] += t[y], t[y] = x;
        }
        return x != y;
    }
};
// main
main(){
    INCANT;
    int n, res = 0;
    in(n);
    rep(i, 1, n + 1){
        if(i < 100000 && i > 9999 || i < 1000 && i > 99 || i < 10){
            res++;
        }
    }
    print(res);
}

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())

    ans = 0
    for i in range(len(str(N))):
        if len(str(N)) != i+1:
            if i % 2 == 0:
                ans += 9*(10**i)
        else:
            if i % 2 == 0:
                if int(str(N)[1:]) == 0:
                    ans += 1
                else:
                    ans += int(str(N)[1:])
    print(ans)


if __name__ == "__main__":
    main()

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)
    b = '9' * (length-1)
    c = int(n) - int(b)
    ans += c
    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:
n = list(map(int, input()))
if len(n) == 6:
        print(90909)
elif len(n) == 5:
        num = n[0] * 10000 + n[1] * 1000 + n[2] * 100 + n[3] * 10 + n[4]
        ptint((num - 10000) + 1 + 900 + 9)
elif len(n) == 4:
        num = n[0] * 1000 + n[1] * 100 + n[2] * 10 + n[3] * 1
        print(909)
elif len(n) == 3:
        num = n[0] * 100 + n[1] * 10 + n[2] * 1
        print((num - 100) + 1 + 9)
elif len(n) == 2:
        num = n[0] * 10 + n[1] * 1
        print(9)
else:
        print(n)

Submission status: Runtime Error

Solution code:
n = input()

count = 0

l = len(n)

#kisu
if l % 2:
  num = n[1:l]
  count += int(num) + 1
  l -= 1
#gusu
for i in range(l):
  tmp = 1
  if (i+1) % 2:
    for j in range(i+1):
      tmp *= 10
    tmp -= tmp / 10
    count += tmp
    
print(int(count))

Submission status: Runtime Error

Solution code:
n = input()

count = 0

l = len(n)

#kisu
if l % 2:
  num = n[1:l]
  count += int(num) + 1
  l -= 1
#gusu
for i in range(l):
  tmp = 1
  if (i+1) % 2:
    for j in range(i+1):
      tmp *= 10
    tmp -= int(tmp / 10)
    count += tmp
    
print(count)

Submission status: Runtime Error

Solution code:
num_str = input()
if len(nums_str) == 1:
  odd_num = int(num_str)
elif 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: Runtime Error

Solution code:
n=input()
l=len(n)
s=0
if l%2==1:
    s+=int(n[1:])+1+(int(n[0])-1)*(10**(l-1))
    l-=1
for i in range(int(l/2)):
    s+=9*10**(i*2)
print(s)

Submission status: Runtime Error

Solution code:
count = len(str(input()).split())
N = str(input())

if count = 1:
  print(N)
elif count = 2:
  print(9)
elif count = 3:
  print(N - int(90))
elif count = 4:
  print(int(909))
elif count = 5:
  print(N - int(9090))
else:
  print(int(90909))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Solution code:
def main():
    N = int(input())

    ans = 0
    for i in range(len(str(N))):
        if len(str(N)) != i+1:
            if i % 2 == 0:
                ans += 9*(10**i)
        else:
            if i % 2 == 0:
                if int(str(N)[1:]) == 0:
                    ans += 1
                else:
                    ans += int(str(N)[1:])+1
    print(ans)


if __name__ == "__main__":
    main()

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:
N = input().strip()
N = N + "."
N.strip("0")
N = N[:-1]
total = 0
for i in range(1, len(N), 2):
    total += int("1"+"0"*i) - int("1"+"0"*(i-1))
if len(N) % 2 == 0:
    pass
else:
    total += int(N[1:])+1
print(total)

Submission status: Runtime Error

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

def count(x):
    k = len(str(x)) // 2
    for i in range(k):
        if i==0:
            ans = '9'
        else:
            ans += '09'
    return (int(ans))

if le%2==0:
    ans = count(n)
else:
    nn = n[1:]
    ans = count(nn)
    ans += int(n) - 10**(le-1) + 1
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
if 1 <= n and n <= 9:
    pint(n)
elif 10 <= n and n <= 99:
    print(9)
elif 100 <= n and n <= 999:
    print(9+n-99)
elif 1000 <= n and n <= 9999:
    print(9+999-99)
elif 10000 <= n and n <= 99999:
    print(9+999-99+n-9999)
elif 100000 <= n and n <= 999999:
    print(9+999-99+999999-99999)