Problem:


Score : 200 points

Problem Statement

Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Constraints

1 \leq N \leq 10^5

Input

Input is given from Standard Input in the following format:

N

Output

Print the number of positive integers less than or equal to N that have an odd number of digits.

Sample Input 1

11

Sample Output 1

9

Among the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \ldots, 9.

Sample Input 2

136

Sample Output 2

46

In addition to 1, 2, \ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \ldots, 136.

Sample Input 3

100000

Sample Output 3

90909



Sample input:
11


Sample output:
9

Submission status: Accepted

Solution code:
n = int(input().strip())
c = 0

if 1 <= n:
    if n < 10:
        c += n
    else:
        c += 9

if 100 <= n:
    if n < 1000:
        c += n - 99
    else:
        c += 900

if 10000 <= n:
    if n < 100000:
        c += n - 9999
    else:
        c += 90000

print(c)

Submission status: Accepted

Solution code:
n=input()
if len(n)==1:
  print(int(n))
elif len(n)==2:
  print(9)
elif len(n)==3:
  print(int(n)-90)
elif len(n)==4:
  print(909)
elif len(n)==5:
  print(int(n)-9090)
else:
  print(90909)

Submission status: Accepted

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

Submission status: Accepted

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

if N == 100000:
    N = 99999
while (10000 <= N < 100000):
    N = N - 1
    cnt += 1
if 1000 <= N < 10000:
    N = 999
while (100 <= N < 1000):
    N = N - 1
    cnt += 1
if 10 <= N < 100:
    N = 9
while (1 <= N < 10):
    N = N - 1
    cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
m = len(str(n))
ans = 0

if m % 2 == 0:
  m = m-1
else:
  ans += n-10**(m-1)+1
  m = m-2

while m > 0:
  ans += 10**m-10**(m-1)
  m = m-2

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

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

for i in range(len(str(N))):
    if i%2 == 0:
        min = 10**i
        max = 10**(i+1)-1
        if  max < N:
            count += (max-min+1)
        else:
            count += (N-min+1)
            break
print(count)

Submission status: Accepted

Solution code:
A, = [list(map(int, s.split())) for s in open(0)][0]

ans = 0
num_digits = len(str(A))
if num_digits == 1:
    ans += A 
else:
    if num_digits % 2 != 0:
        ans += A - 10 ** (num_digits - 1) + 1
    for i in range(3, num_digits, 2):
        ans += 10 ** i - 10 ** (i - 1) 
    ans += 9
print(int(ans))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    ans = 0
    for i in range(5):
        isAdd = i % 2 == 0
        if n < 10 ** (i+1):
            if isAdd:
                ans += n - 10 ** i + 1
            break
        elif isAdd:
            ans += 10 ** (i+1) - 10 ** i
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
while n>0:
    if len(str(n))%2!=0:
        cnt+=1
    n-=1
print(cnt)

Submission status: Accepted

Solution code:
num = [i for i in range (1,int(input())+1)]
ans = 0

if num[-1]<=9 :
	ans = num[-1]
elif num[-1]<=99 :
	ans = 9
elif num[-1]<=999 :
	ans = num[-1]-90
elif num[-1]<=9999:
	ans = 909
elif num[-1]<=99999 :
	ans = num[-1]-9090
else :
	ans = 90909

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = 0
key = int(math.log10(n))+1
for i in range(1,key+1,2):
  ans += (min(10**i-1,n)-10**(i-1)+1)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = input()
if len(A)%2 == 0 and len(A) / 2 == 1:
  print('9')
elif len(A) % 2 == 0 and len(A) / 4 == 1:
  print('909')
elif len(A) % 2 == 0 and len(A) / 6 == 1:
  print('90909')
elif len(A)%2 == 1 and len(A) / 1 == 1:
  print(A)
elif len(A)%2 == 1 and len(A) / 3 == 1:
  A = int(A)
  p = A%100 + 9
  p += ((A//100)-1)*100
  print(p+1)
elif len(A)%2 == 1 and len(A) / 5 == 1:
  A = int(A)
  p = A%10000 + 909
  p += ((A//10000)-1)*10000
  print(p+1)

Submission status: Accepted

Solution code:
N = int(input())

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
itr = 1
while(itr<=N):
    if itr < 10:
        ans += 1
    if 100 <= itr & itr < 1000:
        ans += 1
    if 10000 <= itr & itr <100000:
        ans+=1
    itr += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 20m over
n = int(input())
ans = 0
for i in range(n):
    ans += 1 if len(str(i+1))%2 == 1 else 0
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if N < 100:
    print(min(9, N))
elif N < 10000:
    print(min(909, N-90))
else:
    print(min(90909, N-9090))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

counter = 0

for _ in range(1, int(N)+1):
    if len(str(_)) % 2 != 0:
        counter += 1

print(counter)

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
#力技
N = int(input())
n = len(str(N)) # 桁数
if n == 1:
    print(N)
elif n == 2:
    print(9)
elif n == 3:
    print(N-90)
elif n == 4:
    print(909)
elif n == 5:
    print(N-9090)
elif n == 6:
    print(90909)
else:
    None

Submission status: Accepted

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: Accepted

Solution code:
n = int(input())

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

print(count)

Submission status: Accepted

Solution code:
N = int(input())
if N <= 9:
    ans = N
elif N <= 99:
    ans = 9
elif N <= 999:
    ans = N - 90
elif N <= 9999:
    ans = 909
elif N <= 99999:
    ans = N - 9090
else:
    ans = 90909
print(ans)

Submission status: Accepted

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: Accepted

Solution code:
lst=[str(_+1) for _ in range(int(input()))]
cnt=0
for l in lst:
    len_l=len(l)
    if len_l%2!=0:
        cnt+=1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n) :
  j = str(i+1)
  if int(len(j))%2 == 1 :
    count += 1

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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: Accepted

Solution code:
# https://atcoder.jp/contests/abc144/tasks/abc144_b

N = int(input())

ans = 0

for i in range(1,N+1):
   #桁数ー奇数
   if (len(str(i)) % 2 == 1):
      ans = ans + 1 

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

#Pythonのfor文range()の右側<最大値>は書いている値から-1されるものなので、注意する。(+1する)

for i in range(1, N + 1):

    if len(str(i)) % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
import math

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if L == 1 :
    print(N)
elif L == 2:
    print(9)
elif L == 3:
    print(9 + (N-10**2+1))
elif L == 4:
    print(909)
elif L == 5:
    print(9 + 900 + (N-10**4+1))
else:
    print(90909)

Submission status: Accepted

Solution code:
N=int(input())

count=0

for i in range(N+1):
    if i>=1:
        if len(str(i))%2==1:
            count+=1
        else:
            pass
print(count)

Submission status: Accepted

Solution code:
n = int(input())

keta = len(str(n))

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

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

Solution code:
a=int(input())
if a < 10:
    print(a)
elif a<10**2:
    print(9)
elif a<10**3:
    print(9+a%100+1)
elif a<10**4:
    print(909)
elif a<10**5:
    print(909+a-9999)
else:
    print(90909)

Submission status: Accepted

Solution code:
N = int(input())

if N / 10 < 1:
	print(N)
elif N / 10 >= 1 and N / 100 < 1:
	print(9)
elif N / 100 >= 1 and N / 1000 < 1:
	print(9 + N - 99)
elif N / 1000 >= 1 and N / 10000 < 1:
	print(9 + 900)
elif N / 10000 >= 1 and N / 100000 < 1:
	print(9 + 900 + N - 9999)
else:
	print(9 + 900 + 90000)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
n = int(N)
N_len = len(N)

count = 0
for i in range(1, N_len+1):
    if i % 2 == 0:
        continue
    else:
        if i == N_len:
            count += (n - 10**(N_len-1) + 1)
        elif i == 1:
            count += 9
        else:
            count += (10**(i) - 10**(i-1))
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

flg=0
for i in range(1, N+1): #N以下
    keta = len(str(i))
    if keta % 2 ==1:
        flg += 1

print(flg)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for i in range(1, N + 1):
    num_dig = 0
    ii = i
    while ii > 0:
        ii = int(ii / 10)
        num_dig += 1
    if num_dig % 2 != 0:
        count += 1

print(count)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
#ABC-136-B
N = int(input())
ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n=int(input())
c=0
for i in range(1,n+1):
    if int(math.log10(i))%2==0:
        c+=1
print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def cal_digit(n):

    digit = 0

    while(n > 0):
        n //= 10
        digit += 1

    return digit

def solve(N):

    ans = 0

    for i in range(1, N+1):

        if(cal_digit(i)%2 == 1):
            ans += 1
        
        #print(cal_digit(i))
    
    return ans

N = int(input())
print(solve(N))

Submission status: Accepted

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

for i in range(1,N+1):
    count = 0

    while i != 0:
        i = i//10
        count += 1
    
    if count % 2 == 1:
        count_N += 1

print(count_N)

Submission status: Accepted

Solution code:
n = int(input())
 
if n < 10:
    print(n)
elif n < 100:
    print(9)
elif n < 1000:
    print(9 + (n-100+1))
elif n < 10000:
    print(9 + 900)
elif n < 100000:
    print(9 + 900 + (n-10000+1))
else:
    print(9 + 900 + 90000)

Submission status: Accepted

Solution code:
n=int(input())
l=[x+1 for x in range(n)]
cnt=0
for num in l:
  s=str(num)
  if len(s)%2!=0:
    cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
i=int(input())
l=[x+1 for x in range(i)]
cnt=0
for num in l:
  s=str(num)
  if(len(s))%2!=0:
    cnt+=1
print (cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
hako = []
ans = 0
for i in range(N):
    hako.append(N-i)
for k in range(N):
    nakami = hako[k]
    if len(str(nakami))%2 >= 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(raw_input())

digit = len(str(N))

ans  = 0
num = [9, 0, 900, 0, 90000]
if digit%2 == 1:
    ans += sum(num[:digit-1])
    ans += N - 10 ** (digit-1) + 1
else:
    ans += sum(num[:digit-1])

print ans

Submission status: Accepted

Solution code:
N=int(input())
if N<10:
  A=N
elif N<100:
  A=9
elif N<1000:
  A=9+N-99
elif N<10000:
  A=9+900
elif N<100000:
  A=9+900+N-9999
else:
  A=9+900+90000  
print(A)

Submission status: Accepted

Solution code:
n = input()

counter = 0
for val in range(1,int(n)+1):
    if len(str(val))%2 != 0:
        counter +=1

print(counter)

Submission status: Accepted

Solution code:
def main():
    i = list(map(int, input().split()))
    n = i[0]

    if not (1 <= n and n <= 10**5):
        return

    num = 0
    for j in range(n):
        if(len(str(j+1)) % 2 != 0):
            num += 1

    print(num)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    # map(int, input().split())
    n = int(input())
    ans = 0
    for i in range(1, n + 1):
        if len(str(i)) % 2 == 1:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
K = len(str(N))
if K % 2 == 0:
  NN = 10**(K-1) - 1
else:
  NN = N
KK = len(str(NN))
if KK == 1:
  print(NN)
else:
  print(NN-int('90'*int((KK-1)/2)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
if len(str(n))==2:
  print(9)
elif len(str(n))==4:
  print(909)
elif len(str(n))==6:
  print(90909)
elif len(str(n))==1:
  print(n)
elif len(str(n))==3:
  print(n-90)
else:
  print(n-9090)

Submission status: Accepted

Solution code:
n=int(input())
d=len(str(n))
ans=0
if d%2==1:
  ans+=n-100**(d//2)+1
for i in range(1,d)[::2]:
  ans+=9*100**(i//2)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

result = 0

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

print(result)

Submission status: Accepted

Solution code:
import collections

n = int(input())
print(collections.Counter([len(str(i))%2 for i in range(1,n+1)])[1])

Submission status: Accepted

Solution code:
N = int(input())

if N<10:
    ans = N
elif N<100:
    ans = 9
elif N<1000:
    ans = N - 99 + 9
elif N<10000:
    ans = 900 + 9
elif N<100000:
    ans = N - 9999 + 900 + 9
else:
    ans = 90000 + 900 + 9

print(ans)

Submission status: Accepted

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

for i in range(1, n+1):
  num = [int(x) for x in list(str(i))]
  if (len(num) % 2) == 1:
    count = count + 1
    
print(count)

Submission status: Accepted

Solution code:
n=input()
L=[9,0,900,0,90000]
ans=0
if len(n)==1:ans=int(n)
else:
    for i in range(len(n)-1):
        ans+=L[i]
    if len(n)%2!=0:ans+=int(n)-int("9"*max(0,len(n)-1))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
number = 0
for i in range(1, N + 1):
    if len(str(i)) == 1 or len(str(i)) == 3 or len(str(i)) == 5:
        number += 1
print(number)

Submission status: Accepted

Solution code:
n = int(input())

if n == 100000:
    print(90909)
elif n <= 99999 and n >= 10000:
    print(n - 9999 + 909)
elif n <= 9999 and n >= 1000:
    print(909)
elif n <= 999 and n >= 100:
    print(n - 99 + 9)
elif n <= 99 and n >= 10:
    print(9)
elif n <= 9:
    print(n)

Submission status: Accepted

Solution code:
N = int(input())
#9 900 90000..
buf = 0

if len(str(N)) % 2 != 0 : #Nが奇数桁
    buf += N - 10**(len(str(N))-1) +1
    for i in range((len(str(N))-1)//2) :
        buf += 9 * (100**(i))

else : #Nが偶数桁
    for i in range(len(str(N))//2) :
        buf += 9*(100**i)

print(buf)

Submission status: Accepted

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
# ABC 136: B – Uneven Numbers
n = int(input())

odd_digits = 0

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

print(odd_digits)

Submission status: Accepted

Solution code:
n = int(input())

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

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(cnt)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
digit = len(str(n))

# print(digit)

if digit == 6:
  ans = 90909
elif digit == 5:
  ans = (n - 10000) + 1 + 909
elif digit == 4:
  ans = 909
elif digit == 3:
  ans = (n - 100) + 1 + 9
elif digit == 2:
  ans = 9
elif digit == 1:
  ans = n


print(ans)

Submission status: Accepted

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: Accepted

Solution code:
n = int(input())
l = []
for i in range(0, 6, 2): 
        l += [x for x in range(10**i, 10**(i+1))]
print(sum(i <= n for i in l))

Submission status: Accepted

Solution code:
n = int(input())
l = [i for i in range(1, 10)] + [i for i in range(10**2, 10**3)] + [i for i in range(10**4, 10**5)]
print(sum(i <= n for i in l))

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
# 2019-11-16 10:55:08(JST)
import sys
# import collections
import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n = int(sys.stdin.readline().rstrip())

    digits = math.floor(math.log10(n))
    if  digits % 2 == 0:
        ans = n
    else:
        ans = 10 ** digits - 1
        
    for i in range(1, digits, 2):
        ans -= 10 ** (i+1) - 1 - 10 ** i + 1
    
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# 2019-11-16 10:55:08(JST)
import sys
# import collections
import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n = int(sys.stdin.readline().rstrip())

    if  math.floor(math.log10(n)) % 2 == 0:
        ans = n
    else:
        ans = 10 ** (math.floor(math.log10(n))+1) - 1
    for i in range(1, math.floor(math.log10(n)+1), 2):
        ans -= 10 ** (i+1) - 1 - 10 ** i + 1
    
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
digit = 0
while n >= 10**digit:
    if digit % 2 == 1:
        pass
    else:
        ans += min(n,10**(digit+1)-1) - 10**digit +1
    digit += 1
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict,deque, Counter
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
ans = 0
n = inp()
if 0<n and n<=9:
    ans = n
elif 10 <= n and n < 100:
    ans = 9
elif 100<= n and n<1000:
    ans = n-99+9
elif 1000 <= n and n < 10000:
    ans = 9+900
elif 10000<= n and n < 100000:
    ans = n- 9999 +900 +9
elif n == 100000:
    ans = 9+900+90000
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

digit = int(len(n))

odd_number = 0

# 1-9(10-99)100-999(1000-9999)10000-99999(100000-999999)1000000
# １桁（２桁）３桁（４桁）５桁（６桁）７桁

for i in range(1 , digit+1):
    if i % 2 == 1 and i != digit:
        odd_number += 10**i - 10**(i-1)
    if i % 2 == 1 and i == digit:
        odd_number += N - 10**(i-1) + 1

print(odd_number)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    N = int(input())
    
    for n in range(6,0,-1):
        if N >= 10**(n-1):
            d=n
            break
    ans = 0
    while d > 0:
        if d%2:
            ans += N - 10**(d-1) + 1
        d -= 1
        N = 10**d - 1
    print(ans)

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc136","b",main)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

if 1 <= n <= 9:
  print(n)
elif n <= 99:
  print(9)
elif n <= 999:
  print(n - 90)
elif n <= 9999:
  print(909)
elif n <= 99999:
  print(n - 9090)
else:
  print(90909)

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# 初項s, 交差dのn個の数列の和
def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def print_ans(N):
    """Test Case
    >>> print_ans(11)
    9
    >>> print_ans(136)
    46
    >>> print_ans(100000)
    90909
    """
    counter = 0
    for i in range(1, N + 1):
        if len(str(i)) % 2 != 0:
            counter +=1
    print(counter)


if __name__ == '__main__':
    N = int(input().rstrip())
    print_ans(N)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def print_ans(N):
    """Test Case
    >>> print_ans(11)
    9
    >>> print_ans(136)
    46
    >>> print_ans(100000)
    90909
    """
    counter = 0
    for i in range(1, N + 1):
        if len(str(i)) % 2 != 0:
            counter +=1
    print(counter)

if __name__ == '__main__':
    N = int(input().rstrip())
    print_ans(N)

Submission status: Accepted

Solution code:
n = int(input())
numbers = list(str(i) for i in range(1,n+1))

count = 0
for number in numbers:
    if len(number)%2==1:
        count += 1
print(count)

Submission status: Accepted

Solution code:
a=int(input())
lis=[]
for i in range(1,a+1):
    lis.append(str(i))
cnt=0
for i in lis:
    if len(i)%2==1:
        cnt+=1
print(cnt)