The teacher gathered all the cubes and placed all the red-marked ones in one row, and all the blue-marked ones in another row. Both rows stretched from left to right and each cube had its 5 face on top and its 3 face toward the teacher.

In the red row, the sum of the digits on the left sides of the cubes was a perfect square, as was the sum of the digits on the right sides.

In the blue row, the corresponding sums were not squares, but rather prime numbers. The ratio of the larger to the smaller prime was less than 2.

How many students were absent? How many red markers and how many blue markers were handed out? What were the sums involved (the perfect squares and the primes)?