title: Count Numbers That Dont Contain 3
signature: def count_numbers_that_dont_contain_3(n):
test_code: import array
  import bisect
  import collections
  import datetime
  import functools
  import heapq
  import itertools
  import math
  import queue
  import re
  import string
  import sys
  from typing import Any, Dict, List, Optional, Set
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  def validate_solution(actual, expected):
      return abs(actual - expected) < 1e-09
  
  def driver(n, expected):
      try:
          if validate_solution(PLACEHOLDER_FN_NAME(
              n),
              expected
          ):
              return "PASSED"
          return "FAILED"
      except Exception as exception_obj:
          return type(exception_obj).__name__
      
  if __name__ == "__main__":
      result = driver(85, 71.5)
      print(f"TEST-0...{result}")
  
      result = driver(86, 73.39999999999999)
      print(f"TEST-1...{result}")
  
      result = driver(3, 2.0)
      print(f"TEST-2...{result}")
  
      result = driver(35, 26.5)
      print(f"TEST-3...{result}")
  
      result = driver(59, 52.1)
      print(f"TEST-4...{result}")
  
      result = driver(38, 32.2)
      print(f"TEST-5...{result}")
  
      result = driver(33, 22.7)
      print(f"TEST-6...{result}")
  
      result = driver(15, 17.5)
      print(f"TEST-7...{result}")
  
      result = driver(75, 62.5)
      print(f"TEST-8...{result}")
  
      result = driver(74, 60.6)
      print(f"TEST-9...{result}")
  
      sys.exit(0)
source_py: def count_numbers_that_dont_contain_3(n):
      if (n < 3):
          return n
      elif ((n >= 3) and (n < 10)):
          return (n - 1)
      po = 1
      while ((n / po) > 9):
          po = (po * 10)
      msd = (n / po)
      if (msd != 3):
          return (((count_numbers_that_dont_contain_3(msd) * count_numbers_that_dont_contain_3((po - 1))) + count_numbers_that_dont_contain_3(msd)) + count_numbers_that_dont_contain_3((n % po)))
      else:
          return count_numbers_that_dont_contain_3(((msd * po) - 1))
source_cpp: int count_numbers_that_dont_contain_3(int n) {
    if ( n < 3 ) return n;
    if ( n >= 3 && n < 10 ) return n - 1;
    int po = 1;
    while ( n / po > 9 ) po = po * 10;
    int msd = n / po;
    if ( msd != 3 ) return count_numbers_that_dont_contain_3 ( msd ) * count_numbers_that_dont_contain_3 ( po - 1 ) + count_numbers_that_dont_contain_3 ( msd ) + count_numbers_that_dont_contain_3 ( n % po );
    else return count_numbers_that_dont_contain_3 ( msd * po - 1 );
  }