← Home
```go
package main

import (
	"fmt"
	"math"
)

// Structure to store results for memoization
type pair struct {
	count, volume int64
}

var memo map[int64]pair

func solve(m int64) (int64, int64) {
	if m == 0 {
		return 0, 0
	}
	if res, ok := memo[m]; ok {
		return res.count, res.volume
	}

	// Calculate integer cube root a = floor(m^(1/3))
	// Using float64 approximation and correction loops
	a := int64(math.Cbrt(float64(m)))
	for (a+1)*(a+1)*(a+1) <= m {
		a++
	}
	for a*a*a > m {
		a--
	}

	// Option 1: Use the largest possible block (size a)
	// The remaining volume must be <= m - a^3
	volA := a * a * a
	c1, v1 := solve(m - volA)
	c1++
	v1 += volA

	// Option 2: Do not use block of size a, effectively capping volume at a^3 - 1
	// This forces the greedy algorithm to pick a smaller block first (size a-1 or less)
	var c2, v2 int64
	if a > 1 {
		c2, v2 = solve(volA - 1)
	}

	var ansC, ansV int64

	// Choose the option with more blocks, tie-break with larger volume
	if c1 > c2 {
		ansC, ansV = c1, v1
	} else if c2 > c1 {
		ansC, ansV = c2, v2
	} else {
		if v1 >= v2 {
			ansC, ansV = c1, v1
		} else {
			ansC, ansV = c2, v2
		}
	}

	memo[m] = pair{ansC, ansV}
	return ansC, ansV
}

func main() {
	memo = make(map[int64]pair)
	var m int64
	if _, err := fmt.Scan(&m); err != nil {
		return
	}
	c, x := solve(m)
	fmt.Println(c, x)
}
```