title: Squared Triangular Number Sum Cubes
signature: func squaredTriangularNumberSumCubes(s 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(s int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(s),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(15, -1)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(36, 3)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(39, -1)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(43, -1)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(75, -1)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(49, -1)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(56, -1)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(14, -1)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(62, -1)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(97, -1)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def squared_triangular_number_sum_cubes(s):
      _sum = 0
      n = 1
      while (_sum < s):
          _sum += ((n * n) * n)
          n += 1
      n -= 1
      if (_sum == s):
          return n
      return (- 1)
source_cpp: int squared_triangular_number_sum_cubes(int s) {
    int sum = 0;
    for ( int n = 1;
    sum < s;
    n ++ ) {
      sum += n * n * n;
      if ( sum == s ) return n;
    }
    return - 1;
  }