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())
if 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:
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:
import sys
input = sys.stdin.readline
import math

N = int(input())
ans = 0

for i in range(1, N+1):
    d = int(math.log10(i))+1
    if d % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    c = 0
    for i in range(1, N+1):
        if len(str(i)) % 2 == 1:
            c += 1
    return c

print(solve())

Submission status: Accepted

Solution code:
n=input();k=len(n)
print(sum(9*10**~-i for i in range(k) if i%2)-(10**~-k-int(n)-1)*(k%2))

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())

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

Submission status: Accepted

Solution code:
n = int(input())
digit_list = []
cnt = 0

for i in range(1, n+1):
    digit_list.append(len(str(i)))

for i in digit_list:
    if i % 2 == 1:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

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

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
num = 1
while num <= N:
    cnt += 1
    num += 1
    if len(str(num)) % 2 == 0:
        num *= 10
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
i = 0
while 10 ** (i + 1) <= N:
    i += 1

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

if i % 2 == 0:
    ans += N - 10 ** i + 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input()); c = 0

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
def main():
    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())

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

Submission status: Accepted

Solution code:
from math import log10
n =int(input())
print(len([i for i in range(1, n+1) if int(log10(i)+1) % 2 != 0 and i <= n]))

Submission status: Accepted

Solution code:
from math import log10
n = int(input())
cnt = 0
for i in range(1,n+1):
  if int(log10(i)+1) % 2 != 0 and i <= n:
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
# B
def keta(n):
    count = 0
    while n != 0:
        n = n//10
        count+=1
    return count

n  = int(input())
k = keta(n)
if k == 1:
    print(n)
elif k == 2:
    print(9)
elif k == 3:
    print(9 + n-99)
elif k == 4:
    print(909)
elif k == 5:
    print(909 + n-9999)
elif k == 6:
    print(90909)

Submission status: Accepted

Solution code:
def f(n):
	keta = 0
	while n:
		keta += 1
		n //= 10
	return keta % 2 == 1

N = int(input())
ans = 0
for i in range(1, N+1):
	if f(i):
		ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
count = 0
for digit in range(1, len(n)):
  if digit & 1:
    count += 10 ** digit - 10 ** (digit - 1)
if len(n) & 1:
  count += int(n) - 10 ** (len(n) - 1) + 1
print(count)

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

print(sumans)

Submission status: Accepted

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

Submission status: Accepted

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

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())
num = 0

for n in range(1,N+1):
    s_l = len(str(n))
    if s_l%2==1:
        num+=1
print(num)

Submission status: Accepted

Solution code:
n=int(input())
ans=[int('9'+'0'*i) for i in range(0,8,2)]
p=len(str(n))
if len(str(n))&1==0:
    print(sum(ans[:p//2]))
else:
    print(sum(ans[:p//2])+(n+1-int('1'+'0'*(p-1))))

Submission status: Accepted

Solution code:
n=int(input())
ans=[int('9'+'0'*i) for i in range(0,8,2)]
p=len(str(n))
if len(str(n))&1==0:
    print(sum(ans[:p//2]))
else:
    print(sum(ans[:p//2])+(n+1-int('1'+'0'*(p-1))))

Submission status: Accepted

Solution code:
n = int(input())
ans = [i for i in range(1, n + 1) if str(i).__len__() % 2 != 0].__len__()
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())
cnt = 0
for i in range(1,N+1):
    if(len(str(i)) % 2 ==1):
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
#import numpy as np
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())

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:
import math
import sys


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

l = [len(str(n)) % 2 == 1 for n in range(1, N+1)]
print(sum(l))

Submission status: Accepted

Solution code:
N = int(input())
count, n1, n2 = 0, 1, 9
while n1 <= N:
    if n2 <= N:
        count += n1 * 9
    else:
        count += (N - n1 + 1)
    n1, n2 = n1 * 100, n1 * 1000 - 1
print(count)

Submission status: Accepted

Solution code:
import sys
import math
'''a,b= map(int,input().split())'''
#a, b, c = [list(map(int, input().split())) for _ in range(3)]
#li0= [int(x) for x in input().split()]
a=int(input())
count=0
for i in range(1,1+a):
  if len(str(i))%2==1:
    count+=1
print(count)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for i in range(1, n + 1):
    num = i
    digits = 0
    while num:
        digits += 1
        num //= 10
    if digits % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
import math
'''a,b= map(int,input().split())'''
#a, b, c = [list(map(int, input().split())) for _ in range(3)]
#li0= [int(x) for x in input().split()]
a=int(input())
count=0
for i in range(1,1+a):
  if len(str(i))%2==1:
    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 == 1 :
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = input()

odd_list = [i for i in range(len(N)) if i % 2 == 1]
count = 0
for i in range(len(odd_list)):
    count += 10**int(odd_list[i])-10**int(odd_list[i]-1)
if len(N) % 2 == 1:
    count += int(N)+1-10**(len(N)-1)

print(int(count))

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
l = [x for x in range(1, n + 1)]

print(len([i for i in l if len(str(i)) % 2 != 0]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

l = len(n)
if l == 1:
    print(int(n))
elif l == 2:
    print(9)
elif l == 3:
    print(9+int(n)-99)
elif l == 4:
    print(9+900)
elif l == 5:
    print(9+900+int(n)-9999)
elif l == 6:
    print(9+900+90000)

Submission status: Accepted

Solution code:

n = int(input())

cnt = 0

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

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(total)

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())
c=0
l=n
while l>0:
    l=l//10
    c+=1

def f(p):
    return 10**(p-1)*9

ans=0
if c==1:
    print(n)
elif c%2==0:
    for i in range(1,c,2):
        ans+=f(i)
    print(ans)
else:
    ans+=n
    for i in range(2,c,2):
        ans-=f(i)
    print(ans)

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())

cnt = 0

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(count-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:
#import math
#import bisect
#import numpy as np
#import itertools
#import copy
import sys

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n = int(input())
    l = len(str(n))
    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())
cnt=0
for i in range(1,N+1):
    if(len(str(i))%2==1):
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
import sys

import numpy as np
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
"""dd = [(-1, 0), (0, 1), (1, 0), (0, -1)];
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)];
ddn9 = ddn + [(0, 0)]
for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""

def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]  # WideIntPoint
def ws(): return sys.stdin.readline().split()
def si(): return int(sys.stdin.readline())  # SingleInt
def ss(): return input()
def hi(n): return [si() for _ in range(n)]
def hs(n): return [ss() for _ in range(n)]  # HeightString
def s_list(): return list(input())
def mi(n): return [wi() for _ in range(n)]  # MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]  # NumberGrid
def grid(n): return [s_list() for _ in range(n)]


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
input_string = input()
length = len(input_string)
n = int(input_string)

ans = 0

def func(i):
    a = '9'*i
    b = '1' + '0'*(i-1)
    A = int(a)
    B = int(b)

    if A > n:
        A = n

    return A - B + 1

ans = n
for i in range(0, length+1, 2):
    if i == 0:
        continue
    ans -= func(i)
print(ans)

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(1, N + 1):
    if len(str(i)) % 2 != 0:
        count += 1
print(count)

Submission status: Accepted

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

if 1 <= n and n <= 99:
    ans = min(n, 9)
elif 100 <= n and n <= 9999:
    ans = min(n-90, 909)
else:
    ans = min(n-9090, 90909)

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())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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
num = []

for i in range(N):
  num.append(i+1)
  
for j in range(len(num)):
  if len(str(num[j])) % 2 ==1:
    ans +=1
  else:
    continue
    
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
if 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(99999-9999+909)

Submission status: Accepted

Solution code:
def digit_sum(n):
    # 各桁の和を求める
    # 計算量: O(logN)
    ans = 0
    while n > 0:
        ans += 1
        n //= 10
    return ans

n = int(input())
cnt = 0

for i in range(1, n+1):
    cnt += digit_sum(i) % 2

print(cnt)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
import math

N=int(input())
#print(list(N))
digits=len(str(N))
cnt=-(-digits//2)
#print(cnt)


ans=0
for i in range(cnt):
    ans+=10**(i*2+1)-10**(i*2)
print(ans if digits%2==0 else ans-(10**(digits)-N)+1)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n=int(input())
ans=0
i=10
for i in range(1,4):
    buf=2*i-1
    if n>=10**buf:
        ans+=9*10**(buf-1)
    else:
        ans+=max(0,n-10**(buf-1)+1)
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__=='__main__':
  main()

Submission status: Accepted

Solution code:
N = int(input())

c = 0
for i in range (1,N+1):
    if len(str(i)) == 1:
        c += 1
    if len(str(i)) == 3:
        c += 1
    if len(str(i)) == 5:
        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:
count = 0
S=int(input())
for i in range(1,S+1):
    if len(str(i))%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((N-100+1)+9)
elif(N < 10000):
    print(909)
elif(N < 100000):
    print((N-10000+1)+909)
else:
    print(90909)

Submission status: Accepted

Solution code:
n = int(input())

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

print(c)

Submission status: Accepted

Solution code:

n = input()
num = int(n)
ans = 0

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

print(ans)

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())
NT=N
cnt=0
ans=0
while NT//10:
  cnt+=1
  NT//=10
if cnt==0:
  ans=N
if cnt==1:
  ans=9
if cnt==2:
  ans=N-90
if cnt==3:
  ans=909
if cnt==4:
  ans=909+(N-9999)
if cnt==5:
  ans=90909
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())

digit_max = len(str(N))

if digit_max ==2:
    ans =9
elif digit_max ==1:
    ans = N
elif digit_max >2:
    count=0
    for i in range(int(np.ceil(digit_max/2)-1)):
        j = 2*i+1
        count+=9*10**(j-1)
    if digit_max%2 ==1:
        count+=N-10**(digit_max-1)+1
    elif digit_max%2 ==0:   
        count+=9*10**(digit_max-2)
        
    ans = count
    
print(ans)

Submission status: Accepted

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

N = int(input())
ans = 0
if N < 10:
  ans = N
elif N < 100:
  ans = 9
elif N < 1000:
  ans = 9 + (N - 100 + 1)
elif N < 10000:
  ans = 909
elif N < 100000:
  ans = 909 + (N - 10000 + 1)
else:
  ans = 90909

print(ans)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
keta = len(str(N))
cnt = 0

if (keta % 2 == 0):
    cnt += 9
    keta -= 1
    
    while (keta > 1):
        cnt += 9 * 10 ** (keta - 1)
        keta -= 2

else:
    cnt += N - 10 ** (keta - 1) + 1
    keta -= 2
    
    while (keta > 0):
        cnt += 9 * 10 ** (keta - 1)
        keta -= 2

print(cnt)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int):
    result = 0
    for i in range(1, N + 1):
        if len(str(i)) % 2 != 0:
            result += 1

    print(result)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    N = input()
    cnt = 9
    len_n = len(N)
    if len_n == 1:
        cnt = int(N)
    elif len_n % 2 == 0:
        len_n -= 1
    else:
        cnt += int(N[1:]) + 1
        if int(N[0]) > 1:
            cnt += (int(N[0])-1) * 10 ** (len_n-1)
        len_n -= 2
    while len_n > 1:
        cnt += 10 ** (len_n - 1) * 9
        len_n -= 2
    print(cnt)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

n = sys.stdin.readline().rstrip()
l = len(n)

def main():
    cnt = 0
    for i in range(0, l, 2):
        if i < l-1:
            cnt += 10 ** (i + 1) - 10 ** i
        else:
            cnt += int(n) - (10 ** i - 1)

    return cnt

if __name__ == '__main__':
    ans = main()
    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 = input()
l = len(n)
y = 0
if l >= 2:
    for i in range(1, l, 2):
        y += 9 * 10 ** (i-1)
    if l % 2 == 1:
        y += int(n) - int('9'*(l-1))
else: y = int(n)
print(y)

Submission status: Accepted

Solution code:
N = int(input())

answer = sum(len(str(i))&1 for i in range(1,N+1))
print(answer)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
def readints():
    return list(map(int, input().split()))


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

Submission status: Accepted

Solution code:
n = int(input())

print(len(list(filter(lambda n: len(str(n)) % 2 == 1, range(1, n + 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:
n=int(input())
c=0
for i in range(n):
  if len(str(i+1))%2!=0:
    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(1,n+1):
    a=list(str(i))
    if len(a)%2==1:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
i=1
count=0
while i<=N:
    if len(str(i))%2==1:
        count+=1
    i+=1
print(count)

Submission status: Accepted

Solution code:
N = int(input())

sum=0
if len(str(N))%2==0:
    for i in range(1,len(str(N)),2):
        sum+=9*pow(10,(i-1))
else:
    for i in range(1,len(str(N)),2):
        sum+=9*pow(10,(i-1))
    sum+=N+1-1*pow(10,len(str(N))-1)
print(sum)

Submission status: Accepted

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

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:
#!/usr/bin/env python3
# https://atcoder.jp/contests/abc136/tasks/abc136_b

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for k in (1,3,5):
  tmp = min(10**k - 1, N) - 10**(k-1) + 1
  #print(k, tmp)

  if tmp > 0:
    ans += tmp
  else:
    break

print(ans)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = input()

total = 0
for i in range(1, len(N) + 1, 2):
	if i == len(N):
		total += int(N) - 10**(i-1) + 1
	else:
		total += 9*10**(i-1)

print(total)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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


def main():
    N = int(input())
    S = [1 if len(str(n)) % 2 == 1 else 0 for n in range(1, N + 1)]
    print(sum(S))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = input()

l = len(n) #nの桁数

if l==1: print(int(n))
elif l==2: print(9)
elif l==3: print(9+int(n)-99)
elif l==4: print(9+900)
elif l==5: print(9+900+int(n)-9999)
elif l==6: print(9+900+90000)

Submission status: Accepted

Solution code:
N = input()



ans = 0

for j in range(1,int(N)+1):
    if len(str(j)) % 2 == 1:
        ans += 1
    else:
        continue
print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
a = input()
b = int(a)
d = 0
c = list(range(1,b+1))
for i in range(b):
    d = d + (int((len(str(c[i]))) % 2 == 1))
print(d)

Submission status: Accepted

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