title: Circle Lattice Points
signature: def circleLatticePoints(r: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Int , expected: Int): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(r: Int, expected: Int): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(r),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        34, 
        12    
      )}")   
  
  
      println(s"TEST-1...${driver(
        56, 
        4    
      )}")   
  
  
      println(s"TEST-2...${driver(
        90, 
        12    
      )}")   
  
  
      println(s"TEST-3...${driver(
        47, 
        4    
      )}")   
  
  
      println(s"TEST-4...${driver(
        36, 
        4    
      )}")   
  
  
      println(s"TEST-5...${driver(
        63, 
        4    
      )}")   
  
  
      println(s"TEST-6...${driver(
        21, 
        4    
      )}")   
  
  
      println(s"TEST-7...${driver(
        76, 
        4    
      )}")   
  
  
      println(s"TEST-8...${driver(
        18, 
        4    
      )}")   
  
  
      println(s"TEST-9...${driver(
        75, 
        20    
      )}")   
  
  }
  
source_py: def circle_lattice_points(r):
      if (r <= 0):
          return 0
      result = 4
      for x in range(1, r):
          ySquare = ((r * r) - (x * x))
          y = int(math.sqrt(ySquare))
          if ((y * y) == ySquare):
              result += 4
      return result
source_cpp: int circle_lattice_points(int r) {
    if ( r <= 0 ) return 0;
    int result = 4;
    for ( int x = 1;
    x < r;
    x ++ ) {
      int ySquare = r * r - x * x;
      int y = sqrt ( ySquare );
      if ( y * y == ySquare ) result += 4;
    }
    return result;
  }