title: Square Pyramidal Number Sum Squares
signature: pub fn square_pyramidal_number_sum_squares(s: i32) -> i32 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: i32, expected: i32)->bool{
  return actual==expected
  }
  pub fn driver(s: i32, expected: i32)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(s), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        1, 
        1
      ));
      
      println!("TEST-1...{}", driver(
        5, 
        2
      ));
      
      println!("TEST-2...{}", driver(
        14, 
        3
      ));
      
      println!("TEST-3...{}", driver(
        140, 
        7
      ));
      
      println!("TEST-4...{}", driver(
        204, 
        8
      ));
      
      println!("TEST-5...{}", driver(
        3, 
        -1
      ));
      
      println!("TEST-6...{}", driver(
        506, 
        11
      ));
      
      println!("TEST-7...{}", driver(
        42, 
        -1
      ));
      
      println!("TEST-8...{}", driver(
        4, 
        -1
      ));
      
      println!("TEST-9...{}", driver(
        87, 
        -1
      ));
      
  }
source_py: def square_pyramidal_number_sum_squares(s):
      _sum = 0
      n = 1
      while (_sum < s):
          _sum += (n * n)
          n += 1
      n -= 1
      if (_sum == s):
          return n
      return (- 1)
source_cpp: int square_pyramidal_number_sum_squares(int s) {
    int sum = 0;
    for ( int n = 1;
    sum < s;
    n ++ ) {
      sum += n * n;
      if ( sum == s ) return n;
    }
    return - 1;
  }