Language: C++

int main() {
	int a, ans;

	std::cin >> a;
	
	if(a<10){
		std::cout << a << std::endl;
	}
	else if(a<100){
		std::cout << 9 << std::endl;
	}
	else if(a<1000) {
		std::cout << 9 + a % 100 + (a / 100)*100 - 99 <<std::endl;
	}
	else if (a < 10000) {
		std::cout << 9 + 900 << std::endl;
	}
	else if (a < 100000) {
		std::cout << 9 + 900 + a % 10000 + (a / 10000) * 10000 - 9999 << std::endl;
	}
	else if (a == 100000) {
		std::cout << 9 + 900 + 90000 << std::endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:14: error: 'cin' is not a member of 'std'
    4 |         std::cin >> a;
      |              ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | int main() {
a.cc:7:22: error: 'cout' is not a member of 'std'
    7 |                 std::cout << a << std::endl;
      |                      ^~~~
a.cc:7:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:7:40: error: 'endl' is not a member of 'std'
    7 |                 std::cout << a << std::endl;
      |                                        ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | int main() {
a.cc:10:22: error: 'cout' is not a member of 'std'
   10 |                 std::cout << 9 << std::endl;
      |                      ^~~~
a.cc:10:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:10:40: error: 'endl' is not a member of 'std'
   10 |                 std::cout << 9 << std::endl;
      |                                        ^~~~
a.cc:10:40: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:13:22: error: 'cout' is not a member of 'std'
   13 |                 std::cout << 9 + a % 100 + (a / 100)*100 - 99 <<std::endl;
      |                      ^~~~
a.cc:13:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:70: error: 'endl' is not a member of 'std'
   13 |                 std::cout << 9 + a % 100 + (a / 100)*100 - 99 <<std::endl;
      |                                                                      ^~~~
a.cc:13:70: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:16:22: error: 'cout' is not a member of 'std'
   16 |                 std::cout << 9 + 900 << std::endl;
      |                      ^~~~
a.cc:16:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:46: error: 'endl' is not a member of 'std'
   16 |                 std::cout << 9 + 900 << std::endl;
      |                                              ^~~~
a.cc:16:46: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:19:22: error: 'cout' is not a member of 'std'
   19 |                 std::cout << 9 + 900 + a % 10000 + (a / 10000) * 10000 - 9999 << std::endl;
      |                      ^~~~
a.cc:19:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:87: error: 'endl' is not a member of 'std'
   19 |                 std::cout << 9 + 900 + a % 10000 + (a / 10000) * 10000 - 9999 << std::endl;
      |                                                                                       ^~~~
a.cc:19:87: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:22:22: error: 'cout' is not a member of 'std'
   22 |                 std::cout << 9 + 900 + 90000 << std::endl;
      |                      ^~~~
a.cc:22:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:22:54: error: 'endl' is not a member of 'std'
   22 |                 std::cout << 9 + 900 + 90000 << std::endl;
      |                                                      ^~~~
a.cc:22:54: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'