title: Count Distinct Non Negative Pairs X Y Satisfy Inequality Xx Yy N 2
signature: func countDistinctNonNegativePairsXYSatisfyInequalityXxYyN2(n int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(61, 54)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(45, 41)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(53, 50)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(4, 4)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(82, 73)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(86, 79)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(37, 35)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(48, 43)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(81, 71)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(50, 45)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def count_distinct_non_negative_pairs_x_y_satisfy_inequality_xx_yy_n_2(n):
      res = 0
      x = 0
      while ((x * x) < n):
          y = 0
          while (((x * x) + (y * y)) < n):
              res = (res + 1)
              y = (y + 1)
          x = (x + 1)
      return res
source_cpp: int count_distinct_non_negative_pairs_x_y_satisfy_inequality_xx_yy_n_2(int n) {
    int res = 0;
    for ( int x = 0;
    x * x < n;
    x ++ ) for ( int y = 0;
    x * x + y * y < n;
    y ++ ) res ++;
    return res;
  }