title: Check Number Is Perfect Square Using Additionsubtraction
signature: checkNumberIsPerfectSquareUsingAdditionsubtraction :: Integer -> Bool
  checkNumberIsPerfectSquareUsingAdditionsubtraction n = 
test_code: import Text.Printf
  import Control.Exception (catch, SomeException)
  import Data.Typeable
  import qualified Data.List as List
  import qualified Data.Map as Map
  import qualified Data.Set as Set
  
  -- SOLUTION CODE
  -- ============================================
  
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  validateSolution :: Bool -> Bool -> Bool
  validateSolution actual expected = do
      actual == expected
  
  
  driver :: Integer -> Bool -> String
  driver n expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME n) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      printf "TEST-0...%s\n" (driver (1) (True) )
  
      printf "TEST-1...%s\n" (driver (4) (True) )
  
      printf "TEST-2...%s\n" (driver (9) (True) )
  
      printf "TEST-3...%s\n" (driver (25) (True) )
  
      printf "TEST-4...%s\n" (driver (36) (True) )
  
      printf "TEST-5...%s\n" (driver (3) (False) )
  
      printf "TEST-6...%s\n" (driver (121) (True) )
  
      printf "TEST-7...%s\n" (driver (14) (False) )
  
      printf "TEST-8...%s\n" (driver (17) (False) )
  
      printf "TEST-9...%s\n" (driver (80) (False) )
  
source_py: def check_number_is_perfect_square_using_additionsubtraction(n):
      i = 1
      the_sum = 0
      while (the_sum < n):
          the_sum += i
          if (the_sum == n):
              return True
          i += 2
      return False
source_cpp: bool check_number_is_perfect_square_using_additionsubtraction(int n) {
    for ( int sum = 0, i = 1;
    sum < n;
    i += 2 ) {
      sum += i;
      if ( sum == n ) return true;
    }
    return false;
  }