Let x = the number of cubes
y = the number of pyramids
x + y = 17 and so y = 17 - x
6x + 5y = 95
6x + 5(17 - x) = 95
6x + 85 - 5x = 95
x + 85 = 95
x = 95 - 85
x = 10 and so y = 7. (Check : 10 + 7 = 17 and 6(10) + 5(7) = 95)